http://stackoverflow.com/comment/136154991
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77217545
type: QuestionComment
has text: Check that `fzf` is in `PATH`.

http://stackoverflow.com/q/77073753
tagged with: lua
has answer: http://stackoverflow.com/a/77110280
type: UnansweredQuestion
has body: 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 the script is: local DatastoreService=game:GetService("DataStoreService") local zombiePointIncrease=DatastoreService:GetDataStore("zombiePointIncrease") game.Players.PlayerAdded:Connect(function(player) local leaderstats=Instance.new("Folder", player) leaderstats.Name="leaderstats" local points=Instance.new("IntValue", leaderstats) points.Name="points" local data local success, errormessage=pcall(function() data=zombiePointIncrease:GetAsync(player.UserId.. "-cash") end) if success then points.Value=data else print("there was a error, getting your data") end end) game.Players.PlayerRemoving:Connect(function(player) local success, errormessage=pcall(function() zombiePointIncrease:SetAsync(player.UserId.. "-cash", player.leaderstats.points.Value) end) if success then print("Data Successfully saved") else print("There was a error while saving your data") warn(errormessage) end end) All goes fine then i get a zombie model and make this script under it, it basically looks for other players and follows them within the agroDistance: local zombieHumanoid=script.Parent:WaitForChild("Humanoid") local zombieTorso=script.Parent:WaitForChild("HumanoidRootPart") local function findTarget() local agroDistance=100 local target for i, v in pairs(game.Workspace:GetChildren()) do local human=v:FindFirstChild("Humanoid") local torso=v:FindFirstChild("HumanoidRootPart") if human and torso and v~=script.Parent then --check distance if (torso.Position-zombieTorso.Position).magnitude<agroDistance then agroDistance=(torso.Position-zombieTorso.Position).magnitude target=torso return target end end end end while wait(1) do local torso=findTarget() if torso then zombieHumanoid:MoveTo(torso.Po…
answer count: 1
has title: I am getting a error which makes legit no sense it's is based on datastore, magnitude and .touched event
score: 0
type: Question
tagged with: roblox

http://stackoverflow.com/comment/136065733
type: AnswerComment
score: 1
type: Comment
has text: @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?
comment on: http://stackoverflow.com/a/77175650

http://stackoverflow.com/a/77191876
has body: In the current version of GHub the PROFILE_ACTIVATED event has its second parameter arg=nil (in the previous versions arg was 0), so you must replace OutputLogMessage("event = %s, arg = %d\n", event, arg) with either OutputLogMessage("event = %s, arg = %s\n", event, tostring(arg)) or OutputLogMessage("event = %s, arg = %d\n", event, arg or 0) Without such modification, all your GHub scripts now fail to handle events PROFILE_ACTIVATED and PROFILE_DEACTIVATED as the code generates an exception at the line OutputLogMessage.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77189065
answers question: http://stackoverflow.com/q/77189065

http://stackoverflow.com/q/77210020
has comment: http://stackoverflow.com/comment/136115354
tagged with: nvim-lspconfig
has answer: http://stackoverflow.com/a/78464858
has comment: http://stackoverflow.com/comment/136121407
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/136120281
answer count: 1
type: UnansweredQuestion
tagged with: neovim
favorite count: 0
has comment: http://stackoverflow.com/comment/136115726
tagged with: windows-10
has body: I'm trying to configuring my lua LSP, but it's keep giving me "Client 1 quit with exit code 1 and signal 0" 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. Neovim (Windows 10) NVIM v0.9.2 Build type: RelWithDebInfo LuaJIT 2.1.1694082368 Compilation: 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 system vimrc file: "$VIM\sysinit.vim" fall-back for $VIM: "C:/Program Files (x86)/nvim/share/nvim" Run :checkhealth for more info Code vim.lsp.set_log_level "debug" local ready, lspconfig = pcall(require, "lspconfig") if not ready then print "ERROR: C:/User/Alpha/AppData/Local/nvim/plugin/lspconfig rc.lua: Failed to load nvim-lspconfig" return end local protocol = require "vim.lsp.protocol" local augroup_format = vim.api.nvim_create_augroup("Format", { clear = true }) local enable_format_on_save = function(_, bufnr) vim.api.nvim_clear_autocmds { group = augroup_format, buffer = bufnr } vim.api.nvim_create_autocmd("BufWritePre", { group = augroup_format, buffer = bufnr, callback = function() vim.lsp.buf.format { bufnr = bufnr } end }) end local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_…
tagged with: configuration
has comment: http://stackoverflow.com/comment/136115288
tagged with: lua
has title: Why LSP keep giving "Client 1 quit with exit code 1 and signal 0" error (lua_ls)?
type: Question
has comment: http://stackoverflow.com/comment/136121615
upvote count: 1

libreoffice
tags question: http://stackoverflow.com/q/77150165
tags question: http://stackoverflow.com/q/77179926
type: Tag
tag name: libreoffice
tags question: http://stackoverflow.com/q/79105654

http://stackoverflow.com/q/77168985
tagged with: love2d
tagged with: gpu-instancing
accepted answer: http://stackoverflow.com/a/77219943
has title: Why are my billboarded quads being rendered this way?
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/77219943
score: 0
tagged with: shader
type: Question
tagged with: glsl
tagged with: lua
has body: 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, or I am doing something else wrong? Here is the vertex shader code for the regular, non-billboard version: mat4 ModelView = viewMatrix*modelMatrix; relativeWorldPosition = projectionMatrix * ModelView * (vertexPosition + vec4(instancePositions[love_InstanceID].xyz, 0)); return relativeWorldPosition; Here is the vertex shader code for the billboard version: mat4 ModelView = viewMatrix*modelMatrix; ModelView[0][0] = 1; ModelView[0][1] = 0; ModelView[0][2] = 0; // Column 1: ModelView[1][0] = 0; ModelView[1][1] = 1; ModelView[1][2] = 0; // Column 2: ModelView[2][0] = 0; ModelView[2][1] = 0; ModelView[2][2] = 1; relativeWorldPosition = projectionMatrix * ModelView * (vertexPosition + vec4(instancePositions[love_InstanceID].xyz, 0)); return relativeWorldPosition; I tried to add billboarding to each instance of a mesh (a quad). I expected them to face the camera like a billboard from their current position. My attempt resulted in the instances rendering in a weird position that changed based on the cameras rotation.

http://stackoverflow.com/q/77164011
has body: How can I get points of parabola as by the Bresenham's argorithm? Now I have: function getParabolaBresenham (x0, y0, a, b, c, deltaXmax) local pixels = {} local dy = 0 local dx = 0 local p = b while math.abs(dx) &lt;= deltaXmax do local x1 = x0 + dx local y1 = a * x1 * x1 + b * x1 + c setPixel(pixels, x1, y1) dy = dy + 1 if p &lt; 0 then dx = dx + 1 p = p + 2 * a else -- next column dy = dy + 1 dx = dx + 1 p = p + 2 * a - 2 * b end end return pixels end where x0, y0 - starting point of drawn parabola; a, b, c, - parabola's values in function y = a * x * x + b * x + c deltaXmax - the horizontal limit of parabola (the deltaYmax will be helpful too) Actually, I need to draw every second manhattan's pixel, but it will be helpful to fix the problem.
tagged with: lua
has comment: http://stackoverflow.com/comment/136051284
tagged with: bresenham
answer count: 1
has answer: http://stackoverflow.com/a/77174470
accepted answer: http://stackoverflow.com/a/77174470
has title: Bresenham's parabola algorithm, Lua
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/136035142
type: Question

http://stackoverflow.com/comment/136121615
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77210020
type: Comment
has text: @MonsieurMerso after reinstalling it, it's working now. Thank you for helping me!

http://stackoverflow.com/comment/136035142
type: Comment
has text: Bresenham's argorithm is about drawing (a parabola) on usual pixel grid (x,y - integers). So, what is the meaning of `deltaXmax` ?
comment on: http://stackoverflow.com/q/77164011
score: 0
type: QuestionComment

http://stackoverflow.com/q/77141904
tagged with: ingress-nginx
score: 1
tagged with: nginx
favorite count: 0
has title: How to use lua plugins in ingress-nginx controller?
type: Question
upvote count: 1
downvote count: 0
answer count: 0
has body: 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. Steps on K8s 1. Rename the auth.lua to main.lua 2. Create configMap auth-lua using the file above. k create configmap auth-lua --from-file main.lua -n ingress-nginx 3. Mount the configmap as folder inside ingress-nginx deployment .. ... spec: volumes: - name: auth-lua configMap: name: auth-lua defaultMode: 420 containers: - ... ... volumeMounts: - name: auth-lua mountPath: /etc/nginx/lua/plugins/auth-lua 4. Update the ingress-nginx confimap to include this plugin data: plugins: auth-lua 5. Rollout restart the ingress-nginx deployment. 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? I want to use this plugin only for some ingress resource. and how can I achieve this?
tagged with: ingress-controller
tagged with: lua
tagged with: kubernetes
type: UnansweredQuestion

http://stackoverflow.com/q/77209867
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77211865
answer count: 1
has answer: http://stackoverflow.com/a/77211865
type: Question
score: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/136115578
tagged with: syntax
has body: Is there an alternative syntax for Account = {} function Account:new (o) o = o or {} setmetatable(o, self) self.__index = self return o end where new could be put directly into the table constructor for Account, and where the function gains an implicit self variable? Or must one use a self parameter (or equivalent), and do it the following way? Account = { new = function (self, o) o = o or {} setmetatable(o, self) self.__index = self return o end }
has title: Can a Lua function using the colon syntactic sugar be defined inside a table?
has comment: http://stackoverflow.com/comment/136116096
upvote count: 3
has comment: http://stackoverflow.com/comment/136114779
has comment: http://stackoverflow.com/comment/136115285
downvote count: 0
tagged with: lua

lua
tags question: http://stackoverflow.com/q/77120892
tags question: http://stackoverflow.com/q/77210020
tags question: http://stackoverflow.com/q/77209895
tags question: http://stackoverflow.com/q/77209042
tags question: http://stackoverflow.com/q/77099924
tags question: http://stackoverflow.com/q/77077778
tags question: http://stackoverflow.com/q/77150165
tag name: lua
tags question: http://stackoverflow.com/q/77153081
tags question: http://stackoverflow.com/q/77189752
tags question: http://stackoverflow.com/q/77170295
tags question: http://stackoverflow.com/q/77156207
tags question: http://stackoverflow.com/q/77129551
tags question: http://stackoverflow.com/q/77073753
tags question: http://stackoverflow.com/q/77116145
tags question: http://stackoverflow.com/q/77093640
tags question: http://stackoverflow.com/q/77206230
tags question: http://stackoverflow.com/q/77097667
tags question: http://stackoverflow.com/q/77168568
tags question: http://stackoverflow.com/q/77175561
tags question: http://stackoverflow.com/q/77161193
tags question: http://stackoverflow.com/q/77091104
tags question: http://stackoverflow.com/q/77150890
tags question: http://stackoverflow.com/q/77155984
tags question: http://stackoverflow.com/q/77155856
tags question: http://stackoverflow.com/q/77147995
tags question: http://stackoverflow.com/q/77219027
tags question: http://stackoverflow.com/q/77077148
tags question: http://stackoverflow.com/q/77115424
tags question: http://stackoverflow.com/q/77168985
tags question: http://stackoverflow.com/q/77228934
tags question: http://stackoverflow.com/q/77100369
tags question: http://stackoverflow.com/q/77115728
tags question: http://stackoverflow.com/q/77182395
tags question: http://stackoverflow.com/q/77119800
tags question: http://stackoverflow.com/q/77221657
tags question: http://stackoverflow.com/q/77066681
tags question: http://stackoverflow.com/q/77206840
tags question: http://stackoverflow.com/q/77234964
tags question: http://stackoverflow.com/q/77105337
tags question: http://stackoverflow.com/q/77151783
tags question: http://stackoverflow.com/q/77196757
tags question: http://stackoverflow.com/q/77186525
tags question: http://stackoverflow.com/q/77121137
tags question: http://stackoverflow.com/q/77167668
tags question: http://stackoverflow.com/q/77131643
tags question: http://stackoverflow.com/q/77198424
tags question: http://stackoverflow.com/q/77205100
tags question: http://stackoverflow.com/q/77221746
tags question: http://stackoverflow.com/q/77164795
tags question: http://stackoverflow.com/q/77217545
tags question: http://stackoverflow.com/q/77179926
type: Tag
tags question: http://stackoverflow.com/q/77093455
tags question: http://stackoverflow.com/q/77164011
tags question: http://stackoverflow.com/q/77138490
tags question: http://stackoverflow.com/q/77072924
tags question: http://stackoverflow.com/q/77211174
tags question: http://stackoverflow.com/q/77094619
tags question: http://stackoverflow.com/q/77223892
tags question: http://stackoverflow.com/q/77168276
tags question: http://stackoverflow.com/q/77225259
tags question: http://stackoverflow.com/q/77070009
tags question: http://stackoverflow.com/q/77101884
tags question: http://stackoverflow.com/q/77152755
tags question: http://stackoverflow.com/q/77160885
tags question: http://stackoverflow.com/q/77187410
tags question: http://stackoverflow.com/q/77156921
tags question: http://stackoverflow.com/q/77150797
tags question: http://stackoverflow.com/q/77134491
tags question: http://stackoverflow.com/q/77065047
tags question: http://stackoverflow.com/q/77141904
tags question: http://stackoverflow.com/q/77205227
tags question: http://stackoverflow.com/q/77077249
tags question: http://stackoverflow.com/q/77209867
tags question: http://stackoverflow.com/q/77161382
tags question: http://stackoverflow.com/q/77131035
tags question: http://stackoverflow.com/q/77189065
tags question: http://stackoverflow.com/q/77078238
tags question: http://stackoverflow.com/q/77165982

http://stackoverflow.com/a/77082083
score: -1
has body: local player = game.Players.LocalPlayer local Running = player:WaitForChild("Running") -- local Text = script.Parent:WaitForChild("Time") Text.Text="0.00" Text.Visible=true local tab={ [true]=function() Text.TextColor3=Color3.fromRGB(232,232,232) while(wait(.125)and Running.Value)do Text.Text+=(.125)..[[ ]] end end, [false]=function() Text.TextColor3=Color3.fromRGB(255,47,92) Text.Text='0.00' end } Running.Changed:Connect(function(v) tab[v]() end)tab[Running.Value]()
answers question: http://stackoverflow.com/q/77077249
type: Answer
downvote count: 1
upvote count: 0

http://stackoverflow.com/a/77101049
answers question: http://stackoverflow.com/q/77100369
score: 4
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: You can use vim.fn.input() to get the input and store it in a Lua variable. Then get the current cursor position in the current buffer with vim.api.nvim_win_get_cursor(0). Finally, set the text in the current buffer at the current cursor position using vim.api.nvim_buf_set_text(). Here is a complete mapping: vim.keymap.set("i", "<C-r>", function() local user_input = vim.fn.input("Enter input: ") local row, col = unpack(vim.api.nvim_win_get_cursor(0)) vim.api.nvim_buf_set_text(0, row - 1, col, row - 1, col, { "_{" .. user_input .. "}" }) end) There's also the option to use vim.api.nvim_feedkeys() to insert the text into the buffer.
accepted answer of: http://stackoverflow.com/q/77100369
upvote count: 4

http://stackoverflow.com/comment/135904891
type: AnswerComment
has text: @IHML, You can approve the answer if it works for you.
comment on: http://stackoverflow.com/a/77073363
type: Comment
score: 0

http://stackoverflow.com/comment/136067863
type: Comment
comment on: http://stackoverflow.com/a/77175650
score: 0
type: AnswerComment
has text: 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).

http://stackoverflow.com/q/77101884
has body: I have created a Quarto extension to remove all occurrences of ".html" from the links. The Lua script is as follows: function Link(el) local str = el.target local result = str:gsub("(.-)%.html(.-)", "%1%2") el.target = result return el end 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. 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 ".html." 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. filters: - lightbox - quarto - strip-dot-html-off Any ideas?
tagged with: lua
type: Question
has title: Quarto extension works in example but not in my project
tagged with: quarto
accepted answer: http://stackoverflow.com/a/77102075
has answer: http://stackoverflow.com/a/77102075
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/135927801
comment on: http://stackoverflow.com/q/77099924
has text: Updated the question to elaborate the problem a bit more.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/135880932
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77078238
has text: 0.1 does not have an exact binary representation.
type: Comment

roblox
tags question: http://stackoverflow.com/q/77205100
tags question: http://stackoverflow.com/q/77094619
tags question: http://stackoverflow.com/q/77168276
type: Tag
tags question: http://stackoverflow.com/q/77152755
tags question: http://stackoverflow.com/q/77167668
tags question: http://stackoverflow.com/q/77205227
tags question: http://stackoverflow.com/q/77161382
tags question: http://stackoverflow.com/q/77131035
tags question: http://stackoverflow.com/q/77209895
tag name: roblox
tags question: http://stackoverflow.com/q/77209042
tags question: http://stackoverflow.com/q/77134491
tags question: http://stackoverflow.com/q/77073753
tags question: http://stackoverflow.com/q/77077249
tags question: http://stackoverflow.com/q/77168568
tags question: http://stackoverflow.com/q/77077148
tags question: http://stackoverflow.com/q/77228934
tags question: http://stackoverflow.com/q/77077778
tags question: http://stackoverflow.com/q/77206840
tags question: http://stackoverflow.com/q/77196757
tags question: http://stackoverflow.com/q/77198424
tags question: http://stackoverflow.com/q/77327059
tags question: http://stackoverflow.com/q/77377725
tags question: http://stackoverflow.com/q/77355213
tags question: http://stackoverflow.com/q/77377056
tags question: http://stackoverflow.com/q/77391686
tags question: http://stackoverflow.com/q/77355929
tags question: http://stackoverflow.com/q/77356875
tags question: http://stackoverflow.com/q/77413427
tags question: http://stackoverflow.com/q/77298079
tags question: http://stackoverflow.com/q/77320254
tags question: http://stackoverflow.com/q/77484441
tags question: http://stackoverflow.com/q/77477233
tags question: http://stackoverflow.com/q/77511329
tags question: http://stackoverflow.com/q/77581354
tags question: http://stackoverflow.com/q/77521327
tags question: http://stackoverflow.com/q/77551269
tags question: http://stackoverflow.com/q/77464667
tags question: http://stackoverflow.com/q/77464631
tags question: http://stackoverflow.com/q/77594510
tags question: http://stackoverflow.com/q/77534396
tags question: http://stackoverflow.com/q/77539622
tags question: http://stackoverflow.com/q/77513429
tags question: http://stackoverflow.com/q/77585062
tags question: http://stackoverflow.com/q/77436024
tags question: http://stackoverflow.com/q/77497743
tags question: http://stackoverflow.com/q/77442333
tags question: http://stackoverflow.com/q/77473680
tags question: http://stackoverflow.com/q/77440589
tags question: http://stackoverflow.com/q/77515602
tags question: http://stackoverflow.com/q/77467266
tags question: http://stackoverflow.com/q/77512688
tags question: http://stackoverflow.com/q/77443399
tags question: http://stackoverflow.com/q/77748092
tags question: http://stackoverflow.com/q/77733769
tags question: http://stackoverflow.com/q/77748468
tags question: http://stackoverflow.com/q/77659051
tags question: http://stackoverflow.com/q/77700378
tags question: http://stackoverflow.com/q/77669809
tags question: http://stackoverflow.com/q/77743878
tags question: http://stackoverflow.com/q/77772817
tags question: http://stackoverflow.com/q/77726860
tags question: http://stackoverflow.com/q/77714746
tags question: http://stackoverflow.com/q/77709322
tags question: http://stackoverflow.com/q/77745823
tags question: http://stackoverflow.com/q/77662875
tags question: http://stackoverflow.com/q/77784019
tags question: http://stackoverflow.com/q/77736920
tags question: http://stackoverflow.com/q/77790950
tags question: http://stackoverflow.com/q/77789112
tags question: http://stackoverflow.com/q/77916441
tags question: http://stackoverflow.com/q/77790831
tags question: http://stackoverflow.com/q/77866808
tags question: http://stackoverflow.com/q/77788967
tags question: http://stackoverflow.com/q/77880937
tags question: http://stackoverflow.com/q/77864170
tags question: http://stackoverflow.com/q/77848964
tags question: http://stackoverflow.com/q/77809496
tags question: http://stackoverflow.com/q/77853630

http://stackoverflow.com/comment/136116096
type: QuestionComment
has text: In other words, I understood it correctly, and there is no alternative to the explicit self? I'd be okay with that, I am/was just curious.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77209867

http://stackoverflow.com/comment/136022996
type: AnswerComment
has text: Replace the last `Sleep(50)` with `Sleep(900)`
type: Comment
comment on: http://stackoverflow.com/a/77157460
score: 0

http://stackoverflow.com/q/77121137
has title: How to add an empty table to an existing table in Lua using its C-API?
has comment: http://stackoverflow.com/comment/135955541
type: Question
has body: The core detail of my problem is: I don't know how to do it. I encountered the problem I'm trying to solve by wanting to add a table to an existing table in Lua. 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. I tried the following, among other things: lua_getglobal(L, "OuterTable"); lua_createtable(L, 0,0); lua_pushliteral(L, "InnerTable"); lua_settable(L,-2); I expected that "InnerTable" would be added to "OuterTable" after considering the accepted answer of this question: How to create table in table in Lua 5.1 using C-API? Which also used lua_settable to add a table to a table, albeit a newly created one. I have also looked through Programming In Lua, the color table example, but I was not able to solve it with that one, either. Minimum reproducible example: test.lua OuterTable = { ExampleInnerTable = {} } 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) #include <lua5.3/lua.h> #include <lua5.3/lualib.h> #include <lua5.3/lauxlib.h> int main(int argc, char *argv[]) { lua_State* L; L = luaL_newstate(); luaL_openlibs(L); luaL_dofile(L, "test.lua"); lua_getglobal(L, "OuterTable"); int c = lua_gettop(L); lua_newtable(L); lua_pushliteral(L, "InnerTable"); lua_settable(L,c); return 0; } Basically, I want to add another table to OuterTable, one like ExampleInnerTable Desired result OuterTable = { ExampleInnerTable = {} ,InnerTable = {} }
has comment: http://stackoverflow.com/comment/135955793
has comment: http://stackoverflow.com/comment/135959656
type: UnansweredQuestion
tagged with: lua-api
tagged with: lua
has comment: http://stackoverflow.com/comment/135955648
tagged with: lua-table
score: 0
has comment: http://stackoverflow.com/comment/135955764
linked to: http://stackoverflow.com/q/37854422
answer count: 0

http://stackoverflow.com/comment/135915346
type: AnswerComment
comment on: http://stackoverflow.com/a/77093869
type: Comment
score: 0
has text: `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`.

http://stackoverflow.com/q/77168276
tagged with: roblox
has answer: http://stackoverflow.com/a/77179275
answer count: 1
type: AnsweredQuestion
score: 0
tagged with: user-interface
has body: 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 i tried moving the code or setting true to false... but nothing worked, i will addd the code below local open = true script.Parent.MouseButton1Click:Connect(function() if open == true then open = false script.Parent.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0.278, 0,0.319, 0), "InOut", "Quad", 0.5, true) else open = true script.Parent.Parent.Parent.MainFrame:TweenPosition(UDim2.new(0.278, 0,1, 0), "InOut", "Quad", 0.5, true) end end)
has title: problem with a user interface in roblox studio
accepted answer: http://stackoverflow.com/a/77179275
type: Question
tagged with: lua

http://stackoverflow.com/comment/136120281
has text: @MonsieurMerso Ahh, my bad. Here is the link: https://pastebin.com/9LEVG4VJ. I hope it's the log that you mean.
score: 0
comment on: http://stackoverflow.com/q/77210020
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77091104
favorite count: 0
has comment: http://stackoverflow.com/comment/135903341
score: -2
has body: Trying to build a table that looks up effects depending on integer results. Some of the results are in a range, like 1 to 5, but ultimately there's a bunch of em. http://lua-users.org/wiki/SwitchStatement Showcases some of it, but 'conveniently' did not see it necessary to mention anything about the C api. So, how would I access the fields of a table/array with numerical indices from the C api? At 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. Tables = {} Tables.Effects = { [1] = "effect 1" .... } 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 lua_getglobal lua_getfield lua_pushnumber and the like Perhaps this is simple enough to just hand out a spoonfeed? The lua state is initialized. The file is error free and loaded via luaL_dofile, etc. 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 lua_getfield. Actually, goint to use a helper proxy function that then indexes the table via Lua itself. Edit: After trying a suggestion from the comments to use lua_geti I failed with the following: void accessTables(lua_State* L, int value) { lua_getglobal(L, "Tables.Effects"); lua_geti(L, -1,value); if (lua_pcall(L, 0, 0, 0) != 0) { // it actually is an array of functions, so calling them should be fine std::cout << "error running function `f':" << lua_tostring(L,-1) << '\n'; } } But even though the value passed is a valid index, I get the following error: | PANIC: unprotected error in call to Lua API (attempt to index a nil value)
has title: Lua switch like statement with case fallthroughs, accessible via C api
type: AnsweredQuestion
tagged with: arrays
upvote count: 1
answer count: 1
downvote count: 3
type: Question
tagged with: lua-api
accepted answer: http://stackoverflow.com/a/77095515
tagged with: http://stackoverflow.com/tag/c
tagged with: lua
has comment: http://stackoverflow.com/comment/135910444
has comment: http://stackoverflow.com/comment/135903227
has comment: http://stackoverflow.com/comment/135905959
has answer: http://stackoverflow.com/a/77095515

http://stackoverflow.com/q/77093640
has answer: http://stackoverflow.com/a/77093869
tagged with: logitech-gaming-software
upvote count: 1
has title: What does the error "bad argument to 'OutputLogMessage' (number expected, got nil)" mean?
answer count: 1
score: 0
favorite count: 0
type: Question
downvote count: 1
tagged with: lua
tagged with: lazy-evaluation
type: UnansweredQuestion
has body: I get an error stating: [string "LuaVM"]:163: bad argument #3 to 'OutputLogMessage' (number expected, got nil) Line Number:1 LOADED [string "LuaVM"]:163: bad argument #3 to 'OutputLogMessage' (number expected, got nil) Line Number:1 What does the error mean and what do I need to fix? function mode_change(event, arg) ---one_ NO RECOIL if (event == "G_PRESSED" and arg == 1) then one_ = not one_ two_ = false three_ = false four_ = false five_ = false six_ = false seven_ = false eight_ = false nine_ = false ten_ = false eleven_ = false twelve_ = false elseif (event == "G_PRESSED" and arg == 2) then two_ = not two_ one_ = false three_ = false four_ = false five_ = false six_ = false seven_ = false eight_ = false nine_ = false ten_ = false eleven_ = false twelve_ = false elseif (event == "G_PRESSED" and arg == 3) then three_ = not three_ one_ = false two_ = false four_ = false five_ = false six_ = false seven_ = false eight_ = false nine_ = false ten_ = false eleven_ = false twelve_ = false elseif (event == "G_PRESSED" and arg == 4) then four_ = not four_ one_ = false two_ = false three_ = false five_ = false six_ = false seven_ = false eight_ = false nine_ = false ten_ = false eleven_ = false twelve_ = false elseif (event == "G_PRESSED" and arg == 5) then five_ = not five_ one_ = false two_ = false three_ = false four_ = false six_ = false seven_ = false eight_ = false nine_ = false ten_ = false eleven_ = false twelve_ = false elseif (event == "G_PRESSED" and arg == 6) then six_ = not six_ one_ = false two_ = false three_ = false four_ = false five_ = false seven_ = false eight_ = false nine_ = false ten_ = false eleven_ = false twelve_ = false elseif (event == "G_PRESSED" and arg == 7) then seven_ = not seven_ one_ = false two_ = false three_ = false four_ = false five_ = false six_ = false eight_ = false nine_ = false ten_ = false eleven_ = false twelve_ = false elseif (event == "G_PRESSED" and arg == 8) then eight_ = not eight_ one_ = false two_ = false three_ = false…

http://stackoverflow.com/a/77100753
type: AcceptedAnswer
type: Answer
has body: 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. removeInventoryFrames()
accepted answer of: http://stackoverflow.com/q/77094619
score: 0
answers question: http://stackoverflow.com/q/77094619

http://stackoverflow.com/q/77152755
type: UnansweredQuestion
answer count: 1
tagged with: rotation
score: 0
type: Question
tagged with: keycode
tagged with: lua
has body: 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: local spinning = script.Parent local state = true local function stopAndGo() state = not state end game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessedEvent) if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.Space then stopAndGo() end end) while true do if state then spinning.CFrame = spinning.CFrame * CFrame.fromEulerAnglesXYZ(255, 0, 0) end wait(0.03) end 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.
has answer: http://stackoverflow.com/a/77153111
tagged with: roblox
has title: The part keeps rotating even when l press space bar

scrapy
tag name: scrapy
tags question: http://stackoverflow.com/q/77105337
type: Tag
tags question: http://stackoverflow.com/q/78638625

http://stackoverflow.com/q/77116145
accepted answer: http://stackoverflow.com/a/77116188
has comment: http://stackoverflow.com/comment/135948479
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/77116188
favorite count: 0
type: AnsweredQuestion
has body: I need to determine if a string is in the format I want. What I want is number|number|string,such as 1|2|abc. I tried this if string.match( my_str,"[%d]|[1-2]|.") then print("yes") end But I also got yes for a1|2|abc, which is not what I want. How to write regular expressions to ensure that the first few digits can only be numbers?
has title: How to prohibit letter input, only allow numbers in Lua?
type: Question
downvote count: 0
tagged with: lua
tagged with: lua-patterns
score: 1

http://stackoverflow.com/comment/136115726
score: 0
comment on: http://stackoverflow.com/q/77210020
type: Comment
has text: I meant contents of the lsp log, PATH to the log you can see in the LspInfo dialog
type: QuestionComment

http://stackoverflow.com/q/77209042
type: Question
tagged with: lua
has body: 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 local frame = script.Parent.Parent local currentText = &quot;&quot; frame.Visible = false local function showText (text, delayBetweenChanges) frame.Visible = true for letter in string.split(text,&quot;&quot;) do local currentText = (currentText .. letter) script.Parent.Text = currentText wait(delayBetweenChanges) end end i thought it would add the next character to the already existing string and then display the final string but it showed a number correlating to the position of that character in the string
score: 0
has title: how can i convert a string to a list to index using a for loop in lua?
accepted answer: http://stackoverflow.com/a/77209692
tagged with: string
has answer: http://stackoverflow.com/a/77209692
type: AnsweredQuestion
answer count: 1
tagged with: roblox

coc.nvim
type: Tag
tags question: http://stackoverflow.com/q/77223892
tag name: coc.nvim

http://stackoverflow.com/a/77200244
score: 0
has body: You can specify a table key/index dynamically using brackets, e.g.: players[playerName] = ... In your case, you are trying to modify what is called the global environment, which you can access with _G. 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. Make a separate table for your players, and put them there like in my code block and access them as e.g., players.someSpecificName.health, or more dynamically players[playerName].health. Beware nil players.
type: Answer
answers question: http://stackoverflow.com/q/77196757

http://stackoverflow.com/comment/135973246
type: Comment
comment on: http://stackoverflow.com/q/77129551
score: 0
type: QuestionComment
has text: 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?

nodemcu
tags question: http://stackoverflow.com/q/77156921
type: Tag
tag name: nodemcu
tags question: http://stackoverflow.com/q/79165559
tags question: http://stackoverflow.com/q/79354895

http://stackoverflow.com/q/77217545
type: Question
tagged with: plugins
has comment: http://stackoverflow.com/comment/136153377
has body: In OS X, I load the fzf.vim plugin using the command call minpac#add('junegunn/fzf.vim') without any subsequent configuration. The Find, Buffer, etc., commands are not executed because Neovim can't find the fzf functions. Fzf has been installed with Brew and is working correctly in the Fish shell. I'm seeking assistance to properly configure the plugin using Lua. Thank you for any contributions.
tagged with: lua
tagged with: vim-fzf
accepted answer: http://stackoverflow.com/a/77232122
has comment: http://stackoverflow.com/comment/136154991
has answer: http://stackoverflow.com/a/77232122
has comment: http://stackoverflow.com/comment/136153299
tagged with: neovim
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/136155124
favorite count: 0
has comment: http://stackoverflow.com/comment/136136057
downvote count: 1
type: AnsweredQuestion
has title: Fzf.vim does not work due to fzf missing programs
score: 0

http://stackoverflow.com/q/77182395
has title: lua Failed finding Lua header files. You may need to install them or configure LUA_INCDIR
tagged with: luarocks
tagged with: lua
has comment: http://stackoverflow.com/comment/136073303
has answer: http://stackoverflow.com/a/78269956
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78759864
has comment: http://stackoverflow.com/comment/136068294
answer count: 2
score: 0
has body: i am a newby in lua and installed the version 5.4.2 und luarocks in the version 3.9.2 in windows. I added the two tools into the $PATH by system variables. But i tried to install a library with luarocks and got this error: luarocks install lua-cjson Warning: Lua 5.4 interpreter not found at C:\Program Files\luarock Modules may not install with the correct configurations. You may want to configure the path prefix to your build of Lua 5.4 using luarocks config --local lua_dir <your-lua-prefix> Installing https://luarocks.org/lua-cjson-2.1.0.10-1.src.rock Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR. i tried this with another error: luarocks config lua_dir "C:\Program Files\lua-5.4.2" Wrote lua_interpreter = "lua.exe" variables.LUA_BINDIR = "C:\\Program Files\\lua-5.4.2" variables.LUA_DIR = "C:\\Program Files\\lua-5.4.2" variables.LUA_LIBDIR = "C:\\Program Files\\lua-5.4.2" to C:/Users/me/AppData/Roaming/luarocks/config-5.4.lua C:\Users\me>luarocks install lua-cjson Installing https://luarocks.org/lua-cjson-2.1.0.10-1.src.rock Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR. C:\Users\me>luarocks config --local lua_dir C:\Program Files\lua-5.4.2 C:\Users\me>luarocks config LUA_INCDIR "C:\Program Files\lua-5.4.2" Wrote LUA_INCDIR = "C:\\Program Files\\lua-5.4.2" to C:/Users/me/AppData/Roaming/luarocks/config-5.4.lua C:\Users\me>luarocks install lua-cjson Installing https://luarocks.org/lua-cjson-2.1.0.10-1.src.rock Error: Failed finding Lua header files. You may need to install them or configure LUA_INCDIR. luarocks return: C:\Users\me>luarocks ... Variables: Variables from the "variables" table of the configuration file can be overridden with VAR=VALUE assignments. Configuration: Lua: Version : 5.4 Interpreter: C:\Program Files\lua-5.4.2/lua.exe (ok) LUA_DIR : C:\Program Files\lua-5.4.2 (ok) LUA_BINDIR : C:\Program Files\lua-5.4.2 (ok) LUA_INCDIR : C:\Program Files\lua-5.4.2 (no…
type: Question

http://stackoverflow.com/a/77553699
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/136734582
has comment: http://stackoverflow.com/comment/136746725
answers question: http://stackoverflow.com/q/77223892
has body: Cross-posted with https://github.com/tpope/vim-repeat/issues/92#issuecomment-1826910664 In your example: vim.keymap.set("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true}) vim.keymap.set("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true}) You can do something like: local t = function(keycode) return vim.api.nvim_replace_termcodes(keycode, true, true, true) end vim.keymap.set("n", "[g", function() vim.api.nvim_feedkeys(t '<Plug>(coc-diagnostic-prev)', "n", false) vim.fn["repeat#set"](t '<Plug>(coc-diagnostic-prev)') end, {silent = true}) or local t = function(keycode) return vim.api.nvim_replace_termcodes(keycode, true, true, true) end vim.keymap.set("n", "[g", function() vim.fn["repeat#set"](t '<Plug>(coc-diagnostic-prev)') return '<Plug>(coc-diagnostic-prev)' end, { silent = true, expr = true, remap = true }) and similar for ]g. You may want to make some helper function to reduce repeating similar lines. The use of feedkeys is quite hacky and brittle here (although you can use expr to avoid feedkeys), so below I would suggest some ways to automatically create an internal wrapper mapping that makes things repeatable. A general recipe & usage for neovim (Lua) You can use the following wrapper to conveniently wrap a rhs to be passed to vim.keymap.set: ---Register a global internal keymap that wraps `rhs` to be repeatable. ---@param mode string|table keymap mode, see vim.keymap.set() ---@param lhs string lhs of the internal keymap to be created, should be in the form `<Plug>(...)` ---@param rhs string|function rhs of the keymap, see vim.keymap.set() ---@return string The name of a registered internal `<Plug>(name)` keymap. Make sure you use { remap = true }. local make_repeatable_keymap = function (mode, lhs, rhs) vim.validate { mode = { mode, { 'string', 'table' } }, rhs = { rhs, { 'string', 'function' }, lhs = { name = 'string' } } } if not vim.startswith(lhs, "<Plug>") then error("`lhs` should start with `<Plug>`, given: " .. lhs) end vim.keymap.set(mo…

http://stackoverflow.com/comment/136114284
score: 0
type: AnswerComment
has text: move "humanoid.WalkSpeed += shoting" after while loop
type: Comment
comment on: http://stackoverflow.com/a/77207097

http://stackoverflow.com/q/77160885
answer count: 0
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/136027419
tagged with: lua
downvote count: 0
tagged with: c++
has comment: http://stackoverflow.com/comment/136027334
type: UnansweredQuestion
score: 1
favorite count: 0
has title: isolate Lua scripts in C++
has body: I'm trying to integrate Lua into my program via LuaJIT. Here's the requirement: scripts are obligated to define specific functions (such as on_update(), 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. I've considered several approaches to achieve this: Using separate lua_State* instances for each script. Pros: Easily isolates each script. Cons: Seems to introduce unnecessary overhead. Isolating scripts with lua_setfenv: lua_newtable(L); int env = lua_gettop(L); luaL_loadfile(L, "my_script.lua"); lua_pushvalue(L, env); lua_setfenv(L, -2); lua_call(L, 0, LUA_MULTRET); int ref = luaL_ref(L, LUA_REGISTRYINDEX); I believe this approach provides proper isolation for the scripts. Simply loading and referencing the script: luaL_dofile(L, "script.lua"); int ref = luaL_ref(L, LUA_REGISTRYINDEX); Cons: The major downside is the potential for global variables to introduce elusive bugs, particularly when scripts are authored by multiple contributors. I've been unable to find detailed information or best practices for this. Can anyone provide insights or recommend the best approach?

luvit
type: Tag
tag name: luvit
tags question: http://stackoverflow.com/q/77164795
tags question: http://stackoverflow.com/q/78375359

http://stackoverflow.com/comment/135863729
has text: @Aki i answered my own question, q&a-style, i kind of know
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77066681

http://stackoverflow.com/comment/135955648
comment on: http://stackoverflow.com/q/77121137
score: 0
has text: 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.
type: Comment
type: QuestionComment

string
type: Tag
tags question: http://stackoverflow.com/q/77187410
tag name: string
tags question: http://stackoverflow.com/q/77209042
tags question: http://stackoverflow.com/q/77277130
tags question: http://stackoverflow.com/q/77549930
tags question: http://stackoverflow.com/q/77838212
tags question: http://stackoverflow.com/q/77810553
tags question: http://stackoverflow.com/q/77959155
tags question: http://stackoverflow.com/q/78221180
tags question: http://stackoverflow.com/q/78292293
tags question: http://stackoverflow.com/q/78404978
tags question: http://stackoverflow.com/q/78386191
tags question: http://stackoverflow.com/q/78472564
tags question: http://stackoverflow.com/q/78557695
tags question: http://stackoverflow.com/q/78659386
tags question: http://stackoverflow.com/q/78638506
tags question: http://stackoverflow.com/q/78624992
tags question: http://stackoverflow.com/q/78791470
tags question: http://stackoverflow.com/q/78783308
tags question: http://stackoverflow.com/q/79328249
tags question: http://stackoverflow.com/q/79465076

http://stackoverflow.com/comment/136170891
comment on: http://stackoverflow.com/q/77211174
has text: 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).
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136047981
has text: Just store it in a local file.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77170295

http://stackoverflow.com/comment/136121407
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77210020
score: 0
has text: 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.

http://stackoverflow.com/a/77156763
answers question: http://stackoverflow.com/q/77155984
has comment: http://stackoverflow.com/comment/136020051
has comment: http://stackoverflow.com/comment/136019724
has comment: http://stackoverflow.com/comment/136020360
has body: outside the OnPlayerTakeDamage function the player Injuries or players Injuries[ply] array is nil Before worrying about playerInjuries[ply], make sure that playerInjuries isn't nil in test() by printing it. I suspect playerInjuries is never nil in your program, though you may have some code you didn't share that sets it to nil. Make sure test() is getting called at all, and only by the one spot you shared. Once you made sure playerInjuries is never nil inside test, you can add for k, v in pairs(playerInjuries) do print(k, v) end to print the keys and values in it.
has comment: http://stackoverflow.com/comment/136019772
score: 0
type: Answer

hammerspoon
tags question: http://stackoverflow.com/q/77078238
tag name: hammerspoon
type: Tag
tags question: http://stackoverflow.com/q/77757772
tags question: http://stackoverflow.com/q/78628036
tags question: http://stackoverflow.com/q/79059982

http://stackoverflow.com/comment/136434947
comment on: http://stackoverflow.com/a/77324317
type: Comment
type: AnswerComment
has text: 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).
score: 0

http://stackoverflow.com/comment/136115285
type: Comment
has text: Lol, I am grateful, but also curious.
comment on: http://stackoverflow.com/q/77209867
score: 0
type: QuestionComment

http://stackoverflow.com/q/77206840
score: 0
tagged with: roblox
type: Question
tagged with: lua
type: UnansweredQuestion
has body: So , this is babblo , say hi to him enter image description here 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 local PrimaryPart = workspace:WaitForChild("Pet").PrimaryPart PrimaryPart.Position = workspace:FindFirstChild("PetTeleportationPart1").Position Whats This Tab , well i am just gonna post the code here again : local PrimaryPart = workspace:WaitForChild("Pet").PrimaryPart PrimaryPart.Position = workspace:FindFirstChild("PetTeleportationPart1").Position
has title: Attempting nil with CFrame
has answer: http://stackoverflow.com/a/77260907
answer count: 1

http://stackoverflow.com/comment/136115288
has text: 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?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77210020
type: QuestionComment

http://stackoverflow.com/q/77225259
has title: How do you change Neovim's directory to the directory within a terminal session? Can this be done using a key map?
score: 2
type: UnansweredQuestion
favorite count: 0
upvote count: 2
tagged with: neovim
answer count: 0
has body: I work within Neovim's own terminal session; in fact, my development work is done completely inside of Neovide. However, I have to use :cd to change Neovim's directory to match the directory within the terminal session; I'd like for this to be automated. I've tried the following, but nothing works so far; the directory just gets changed to the home directory each time. I tried to use vim.fn.getreg("+") to read the + register where the copied value is stored and then I tried to pass this string value to the vim.fn.chdir function, but for some reason, this does not work. Note that the function vim.fn.getreg seems to return a string value with extra characters at the start and end. local tnoremap = function(lhs, rhs) vim.api.nvim_set_keymap("t", lhs, rhs, { noremap = true }) end tnoremap("<C-d>", 'pwd|pbcopy<CR><C-\\><C-n>:lua vim.fn.chdir(string.lower(string.sub(vim.fn.getreg("+"), 1, string.len(vim.fn.getreg("+"))-1)))<CR>') tnoremap('<C-d>', 'pwd|pbcopy<CR><C-\\><C-n>:cd <C-r><C-o>+<CR>')
type: Question
downvote count: 0
tagged with: lua

http://stackoverflow.com/comment/136016896
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77153794
has text: Is `__newindex = false` a fast-and-dirty way to implement read-only?
score: 0

http://stackoverflow.com/comment/135885797
has text: 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).
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77078238

http://stackoverflow.com/comment/135982608
type: Comment
comment on: http://stackoverflow.com/q/77129551
score: 0
type: QuestionComment
has text: 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.

http://stackoverflow.com/a/78077052
type: Answer
has body: There is VS Code extension NodeMCU-Tools (marketplace.visualstudio.com). You can use it instead of ESPlorer.
answers question: http://stackoverflow.com/q/77156921
score: 0

http://stackoverflow.com/comment/136070692
type: AnswerComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/77180499
score: 1

ingress-controller
tag name: ingress-controller
type: Tag
tags question: http://stackoverflow.com/q/77141904

cmp
type: Tag
tag name: cmp
tags question: http://stackoverflow.com/q/77165982

http://stackoverflow.com/q/77205227
tagged with: while-loop
has answer: http://stackoverflow.com/a/77207097
accepted answer: http://stackoverflow.com/a/77207097
has title: How do I prevent ONE "while" process to run twice at the same time?
downvote count: 1
type: Question
favorite count: 0
has body: The problem's that when I double click quickly, the weapon runs one "while" 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. It also, somehow, ignores the InputEnded function (which states that the while proccess yields when the left click is released), which would obviously prevent this "while" stacking as you can't double click without releasing the left mouse button first, obviously. I link the proccesses of the code below. conn = UIS.InputBegan:Connect(function(input, gameProcessedEvent) if input.UserInputType == Enum.UserInputType.MouseButton1 then humanoid.WalkSpeed -= shoting toolDebounce = true -- the boolean that must be true for the while process to run while toolDebounce do local startPosition = tool.Part.Position local endPosition = mouse.Hit.Position remoteEvent:FireServer(tool, startPosition, endPosition) task.wait (debounceTime) end end end) conn2 = UIS.InputEnded:Connect(function(input, gameProcessedEvent) if input.UserInputType == Enum.UserInputType.MouseButton1 then 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 humanoid.WalkSpeed += shoting end end) Any help is aprecciated and will be tried. I tried adding an "if not" 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.
upvote count: 0
has comment: http://stackoverflow.com/comment/136107209
tagged with: lua
answer count: 1
tagged with: roblox
type: AnsweredQuestion
score: -1
tagged with: input

http://stackoverflow.com/q/77186525
answer count: 1
has body: I would like to round a number according to the following pattern e.g 1246 to 1250 e.g 1234 to 1230 As far as I know in java there is math.round(1245,10) to do that. How can I do that in lua? I tried it with math.floor an ceil.
type: UnansweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/77186782
has comment: http://stackoverflow.com/comment/136073024
linked to: http://stackoverflow.com/q/18313171
has title: Math.round(number, 10) in lua
duplicate of: http://stackoverflow.com/q/18313171
upvote count: 0
tagged with: lua
type: Question
tagged with: math.round
score: -1
downvote count: 1

scripting
tag name: scripting
type: Tag
tags question: http://stackoverflow.com/q/77099924
tags question: http://stackoverflow.com/q/77355213
tags question: http://stackoverflow.com/q/77809496
tags question: http://stackoverflow.com/q/77963271
tags question: http://stackoverflow.com/q/78143358
tags question: http://stackoverflow.com/q/78215348
tags question: http://stackoverflow.com/q/78233831
tags question: http://stackoverflow.com/q/78444284
tags question: http://stackoverflow.com/q/78317719
tags question: http://stackoverflow.com/q/78567841
tags question: http://stackoverflow.com/q/78501561
tags question: http://stackoverflow.com/q/78758535
tags question: http://stackoverflow.com/q/78883172
tags question: http://stackoverflow.com/q/78830610
tags question: http://stackoverflow.com/q/78949402
tags question: http://stackoverflow.com/q/79025911
tags question: http://stackoverflow.com/q/79408191

http://stackoverflow.com/comment/135955541
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77121137
has text: Could you please provide a minimal reproducible example, e.g. a C file I can feed my compiler which doesn't work if executed?
type: Comment

http://stackoverflow.com/comment/136117922
type: AnswerComment
comment on: http://stackoverflow.com/a/77209938
type: Comment
score: 1
has text: Rather than just providing the solution, take the time and explain what is wrong too

http://stackoverflow.com/comment/135923369
comment on: http://stackoverflow.com/q/77099924
type: Comment
has text: 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.
type: QuestionComment
score: 0

prettier
type: Tag
tag name: prettier
tags question: http://stackoverflow.com/q/77115424

http://stackoverflow.com/q/77175561
downvote count: 0
tagged with: lua
type: Question
tagged with: argument-unpacking
score: 4
has title: How to "pack" a variable amount of outputs from a function in Lua?
accepted answer: http://stackoverflow.com/a/77175650
tagged with: iterable-unpacking
answer count: 1
has answer: http://stackoverflow.com/a/77175650
favorite count: 0
has body: 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? function my_function() -- whatever end outputs_list = my_function() The above example doesn't work because outputs_list gets only the first output of the function, and all the others are discarded. I want outputs_list to contain all the outputs of the function so I can retrieve them later. I think this is equivalent in python to doing *outputs_list = my_function()
type: AnsweredQuestion
upvote count: 4

http://stackoverflow.com/comment/135948479
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77116145
type: Comment
has text: Do you want to match *numbers* (e.g. 123) or *digits* (e.g. 9)?

http://stackoverflow.com/q/77134491
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77156278
type: Question
tagged with: lua
accepted answer: http://stackoverflow.com/a/77156278
has body: 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. Here is my local script for throwing local userInputService = game:GetService("UserInputService") local playersService = game:GetService("Players") local tool = script.Parent.Parent local humanoid = playersService.LocalPlayer.Character:WaitForChild("Humanoid") local workspace = game:GetService("Workspace") local isEquipped = false local mouse = playersService.LocalPlayer:GetMouse() local function createToolCopy() local toolCopy = tool:Clone() toolCopy.Parent = workspace local throwDirection = (mouse.Hit.p - toolCopy.Handle.Position).unit local throwForce = 100 toolCopy.Handle.Velocity = throwDirection * throwForce isEquipped = false tool:Destroy() end tool.Equipped:Connect( function() isEquipped = true end) tool.Unequipped:Connect(function() isEquipped = false end) userInputService.InputBegan:Connect(function(input, gameProcessedEvent) if isEquipped and not gameProcessedEvent then if input.UserInputType == Enum.UserInputType.MouseButton1 then createToolCopy() end end end) This is my global script for for picking up the cup local clickDetector = script.Parent local tool = clickDetector.Parent if clickDetector then clickDetector.MaxActivationDistance = 10 clickDetector.MouseClick:Connect(function(playerWhoClicked: Player) print("Player clicked the clickDetector") tool.Parent = playerWhoClicked.Backpack end) else warn("clickDetector not found in the object.") end I also provide for a general understanding of the situation, this is struct of cup: ├─ clickDetector/ │ ├─ GlobalScriptForPickUp │ ├─ LocalScriptForThrowing ├─ ModelOfCup ├─ Handle/ │ ├─ TouchInterest │ ├─ WeldConstraint I wanted it to be like this: the player picks up the cup -> picks it up -> right mouse button -> the cup in the inventory is cloned into the workspace -> flies -> disappears from the inv…
tagged with: roblox
has title: Unable to pick up cloned object in Roblox Lua. How to fix?
answer count: 1

ingress-nginx
tag name: ingress-nginx
type: Tag
tags question: http://stackoverflow.com/q/77141904

module
tag name: module
tags question: http://stackoverflow.com/q/77153081
type: Tag
tags question: http://stackoverflow.com/q/77240666
tags question: http://stackoverflow.com/q/78407863
tags question: http://stackoverflow.com/q/78318512
tags question: http://stackoverflow.com/q/78779863
tags question: http://stackoverflow.com/q/79191945
tags question: http://stackoverflow.com/q/79402036

glsl
tags question: http://stackoverflow.com/q/77168985
type: Tag
tag name: glsl

http://stackoverflow.com/q/77147995
upvote count: 10
has answer: http://stackoverflow.com/a/77153991
tagged with: neovim
downvote count: 0
accepted answer: http://stackoverflow.com/a/77153991
type: AnsweredQuestion
answer count: 1
has body: I am using lsp-zero & mason to install LSPs, formatters and linters. However, I am not sure how the formatters work and how can I configure them. For example, the formatter for yml files seems not to be working even though that I've installed yamlls and yamlfmt. On the other hand, Golang's formatter seems to be working just fine, when I save a *.go file, it will be automatically formatted. How would you setup the YAML formatter in this case? Here is a snippet of my configuration: lsp.lua local lsp = require("lsp-zero") lsp.preset("recommended") -- Fix Undefined global 'vim' lsp.nvim_workspace() local cmp = require('cmp') local cmp_select = {behavior = cmp.SelectBehavior.Select} local cmp_mappings = lsp.defaults.cmp_mappings({ ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), ['<CR>'] = cmp.mapping.confirm({ select = true }), ["<C-Space>"] = cmp.mapping.complete(), }) cmp_mappings['<Tab>'] = nil cmp_mappings['<S-Tab>'] = nil lsp.setup_nvim_cmp({ mapping = cmp_mappings }) lsp.set_preferences({ suggest_lsp_servers = false, sign_icons = { error = 'E', warn = 'W', hint = 'H', info = 'I' } }) lsp.on_attach(function(client, bufnr) local opts = {buffer = bufnr, remap = false} vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts) vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts) vim.keymap.set("i", "<C-h>", function() vim.lsp.bu…
has title: Setting up formatters in Neovim with mason & lsp-zero
score: 10
favorite count: 0
type: Question
tagged with: lua

http://stackoverflow.com/comment/135975167
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77131643
has text: 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.
score: 0

http://stackoverflow.com/a/77186801
score: 0
answers question: http://stackoverflow.com/q/77168568
type: Answer
has body: local Players,part,tab=game:GetService"Players",script.Parent,{} local function onPlayerAdded(player) table.insert(tab,player.Name) table.insert(tab,{}) end;Players.PlayerAdded:Connect(onPlayerAdded) for _,v in ipairs(Players:GetPlayers())do onPlayerAdded(v)end part.Touched:Connect(function(part) local player=Players:GetPlayerFromCharacter(part.Parent) if player then local tab=tab[table.find(tab,player.Name)+1] local v=table.find(tab,part) table.insert(tab,part) player.PlayerGui["First Person"].Enabled=true end end) part.TouchEnded:Connect(function(part) local player=Players:GetPlayerFromCharacter(part.Parent) if player then local tab=tab[table.find(tab,player.Name)+1] table.remove(tab,table.find(tab,part)) wait(.1) if #tab==0 then player.PlayerGui["First Person"].Enabled=false end end end) Players.PlayerRemoving:Connect(function(player) local i=table.find(tab,player.Name) table.remove(tab,i) table.remove(tab,i) end)

http://stackoverflow.com/a/77211865
accepted answer of: http://stackoverflow.com/q/77209867
has body: No syntactic sugar is available for function definitions within table constructors. This includes function name (args) body end for name = function (args) body end, and by extension the colon syntax. You must use an explicit first function parameter (it does not need to be named self, but that is good practice). As you have noted, this will work, as colon syntax for function calls is a separate form of syntactic sugar. A call v:name(args) is syntactic sugar for v.name(v,args), except that v is evaluated only once. Lua 5.4: §3.4.9 - Table Constructors §3.4.10 – Function Calls §3.4.11 - Function Definitions
answers question: http://stackoverflow.com/q/77209867
score: 3
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/77235443
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/77234964
answers question: http://stackoverflow.com/q/77234964
has body: The reason is simple, table.unpack does not recognize n, its default length is #t. You should use its 3rd argument to indicate the length: local t = {n=3, [1]=1, [2]='s'} printArgs(table.unpack(t, 1, t.n)) And you can redefine table.unpack to make it more elegant: local unpack = table.unpack function table.unpack(t, i, j) return unpack(t, i, j or t.n) end printArgs(table.unpack{n=3, [1]=1, [2]='s'})

http://stackoverflow.com/comment/136199695
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77247495
has text: thank youuu soo muchh, i understand it now ^v^ bro, have a nice day

http://stackoverflow.com/a/77162382
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77161193
has comment: http://stackoverflow.com/comment/136030010
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77161193
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/136029972
has body: When treating a file as binary, you can certainly replace fixed length data at a particular file offset: local file = assert(io.open('data', 'w+b')) -- write three unsigned longs file:write(string.pack('LLL', 11, 22, 33)):flush() -- offset by the size of one unsigned long file:seek('set', string.packsize 'L') -- overwrite the second unsigned long file:write(string.pack('L', 42)):flush() -- rewind file:seek('set') local a, b, c = string.unpack('LLL', file:read(string.packsize 'LLL')) file:close() assert(os.remove 'data') print(a, b, c) -- 11, 42, 33 This is quite common, but leaves your file open to data corruption if any given write operation fails. Given read, browse, and edit a large text file though, the typical text file contains variable length (usually lines of) data. Trying to directly replace a section of text with a smaller amount of data will lead to stale data remaining in the file (the tail of the previous data). Overwriting a section of text with a larger amount of data leads to data loss, when you overwrite the data that followed the original data. 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., Windows, when [over]writing a newline (LF)). 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. If we presume file:read and file:write (ultimately fread and fwrite) to be O(n), then everything mentioned is O(n).
has comment: http://stackoverflow.com/comment/136029855

linux
tags question: http://stackoverflow.com/q/77115424
tag name: linux
type: Tag
tags question: http://stackoverflow.com/q/78062261
tags question: http://stackoverflow.com/q/78414522
tags question: http://stackoverflow.com/q/78954455
tags question: http://stackoverflow.com/q/79139400
tags question: http://stackoverflow.com/q/79194247

garrys-mod
type: Tag
tag name: garrys-mod
tags question: http://stackoverflow.com/q/77155984
tags question: http://stackoverflow.com/q/77824918
tags question: http://stackoverflow.com/q/78544712
tags question: http://stackoverflow.com/q/78610713
tags question: http://stackoverflow.com/q/78717783
tags question: http://stackoverflow.com/q/78760581
tags question: http://stackoverflow.com/q/78822833
tags question: http://stackoverflow.com/q/78919595
tags question: http://stackoverflow.com/q/79285284

http://stackoverflow.com/a/77186782
has body: Transform your value to match your scale (e.g., divide by 10), round it (floor + 0.5), transform back. function round(value, scale) return math.floor(value / scale + 0.5) * scale end
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/77186525
score: 3
downvote count: 0

libreoffice-calc
type: Tag
tags question: http://stackoverflow.com/q/77150165
tag name: libreoffice-calc
tags question: http://stackoverflow.com/q/77179926

http://stackoverflow.com/q/77105337
tagged with: scrapy
score: 0
type: Question
has body: *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. 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. def start_requests(self): login_url = "URL" yield SplashRequest( login_url, splash_headers={ # used for initializing zyte splash "Authorization": basic_auth_header(self.settings["APIKEY"], "") }, callback=self.start_scraping, endpoint="execute", cache_args=["lua_source"], args={ "wait": random.uniform(2.1, 3.4), "lua_source": self.LUA_LOGIN_SOURCE, "url": login_url, "ua": self.random_user_agent, }, meta={ "max_retry_times": 0, }, ) Then, I mistakenly added exit() without the requirement/status code and it threw an unhandled in Deferred error. Then, start_scraping ran again, and this time it was logged in and working fine. 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. 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 Here is the QUICK AND DIRTY check/retry function: def start_scraping(self, response): if response.xpath("/html/body/h1//text()").extract_first() != "Forbidden": while self.login_counter < 4: self.login_counter += 1 if self.login_counter == 1: self.LUA_LOGIN_SOURCE # if the login function fails on attempt 3, # then try wi…
tagged with: python
tagged with: lua
tagged with: scrapy-splash
has answer: http://stackoverflow.com/a/77171477
has title: How do you clear scrapy splash cache after running in a container
accepted answer: http://stackoverflow.com/a/77171477
answer count: 1
type: AnsweredQuestion

plugins
tags question: http://stackoverflow.com/q/77217545
type: Tag
tag name: plugins
tags question: http://stackoverflow.com/q/77584516
tags question: http://stackoverflow.com/q/77769954
tags question: http://stackoverflow.com/q/78053349
tags question: http://stackoverflow.com/q/78290698
tags question: http://stackoverflow.com/q/78361071
tags question: http://stackoverflow.com/q/78308549
tags question: http://stackoverflow.com/q/78449716
tags question: http://stackoverflow.com/q/78882864

http://stackoverflow.com/a/77220104
score: 1
has body: Sleep expects integer amount of milliseconds. Try Sleep(math.floor(gaussianRandom(800, 200)))
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77219027
upvote count: 1
answers question: http://stackoverflow.com/q/77219027
downvote count: 0

http://stackoverflow.com/a/77096550
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/135916590
accepted answer of: http://stackoverflow.com/q/77093455
answers question: http://stackoverflow.com/q/77093455
score: 0
has body: Lua table syntax isn't JSON. As a Lua table, this would be tab = {key1 = 123, key2 = 43, key3 = 367, key4 = 2} To find the key corresponding to the highest value, simply loop over the table: local max_key for key, value in pairs(tab) do if max_key == nil or value &gt; tab[max_key] then max_key = key end end This can be rewritten to be slightly more elegant using next: local max_key = next(tab) for key, value in next, tab, max_key do if value &gt; tab[max_key] then max_key = key end end For performance, you might want to keep the corresponding max. value in a local variable: local max_key, max_value = next(tab) for key, value in next, tab, max_key do if value &gt; max_value then max_key, max_value = key, value end end

http://stackoverflow.com/q/77100369
tagged with: neovim
score: 4
has body: In Vim, an input mode map can use <c-r>=input() to fetch user input and insert it at the cursor. How is this done in Neovim? Specific Vimscript example: imap <buffer> <unique> ;_ <c-r>="_{".input("sub:")."}"<cr> What is the Neovim+Lua equivalent?
type: Question
tagged with: lua
has answer: http://stackoverflow.com/a/77101049
upvote count: 4
has title: How to incorporate user input in an input-mode Lua keymap in Neovim?
accepted answer: http://stackoverflow.com/a/77101049
tagged with: input
downvote count: 0
answer count: 1
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/q/77205100
type: UnansweredQuestion
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/79347409
tagged with: roblox
type: Question
has body: 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 "BuyBlock" they get an attribute added for that part. Using this code: local list = game.Workspace.Store.GPU.BuyBlocks:GetDescendants() while true do for index=1, #list do if list[index] then list[index].Touched:Connect(function() Touched(list[index]) end) end end wait(1) end Essentially, the code iterates through each "BuyBlock" 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: local player = game.Players.LocalPlayer local function Touched(part) -- called whenever one of the parts are touched player:SetAttribute("GPU", part) end 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.
has title: Unable to find parts in workspace with localscript
has comment: http://stackoverflow.com/comment/136133883
has answer: http://stackoverflow.com/a/77324317
tagged with: lua

game-development
tag name: game-development
tags question: http://stackoverflow.com/q/77131035
type: Tag
tags question: http://stackoverflow.com/q/77327059
tags question: http://stackoverflow.com/q/77355213
tags question: http://stackoverflow.com/q/77709322
tags question: http://stackoverflow.com/q/77901201
tags question: http://stackoverflow.com/q/77930867
tags question: http://stackoverflow.com/q/78275372
tags question: http://stackoverflow.com/q/78249339
tags question: http://stackoverflow.com/q/78217605
tags question: http://stackoverflow.com/q/78379717
tags question: http://stackoverflow.com/q/78310793
tags question: http://stackoverflow.com/q/78411075
tags question: http://stackoverflow.com/q/78539465
tags question: http://stackoverflow.com/q/78501561
tags question: http://stackoverflow.com/q/78595890
tags question: http://stackoverflow.com/q/78661251
tags question: http://stackoverflow.com/q/78846464
tags question: http://stackoverflow.com/q/78850469
tags question: http://stackoverflow.com/q/78832294
tags question: http://stackoverflow.com/q/79316557
tags question: http://stackoverflow.com/q/79473868
tags question: http://stackoverflow.com/q/79535091
tags question: http://stackoverflow.com/q/79544001

http://stackoverflow.com/a/79347409
has comment: http://stackoverflow.com/comment/139926041
answers question: http://stackoverflow.com/q/77205100
has body: You can do this: local part = workspace.Part or workspace:WaitForChild("Part") local function touched(gpu) local gpuValue = game.Players.LocalPlayer:FindFirstChild("GPUValue") if not gpuValue then gpuValue = Instance.new("ObjectValue", game.Players.LocalPlayer) gpuValue.Name = "GPUValue" end gpuValue.Value = gpu end part.Touched:Connect(touched)
score: 0
type: Answer

http://stackoverflow.com/comment/136012081
comment on: http://stackoverflow.com/q/77150890
has text: @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.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/77234964
answer count: 1
has answer: http://stackoverflow.com/a/77235443
accepted answer: http://stackoverflow.com/a/77235443
type: Question
has title: table.unpack to variadic function?
downvote count: 0
tagged with: lua
score: 2
has body: Consider this test function to print arg count and type (reduction to MCVE of something else): function printArgs(...) local args = table.pack(...) local str = args.n .. ' args:' for i=1,args.n do str = str..' '..type(args[i]) end print(str) end and a few basic examples: printArgs(1, 's', nil) -- 3 args: number string nil printArgs(nil) -- 1 args: nil 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 table.unpack: printArgs(table.unpack{n=2, [1]=1, [2]='s'}) -- 2 args: number string so far so good, but the following tests do not produce the expected results (should produce the same result as the first two tests): printArgs(table.unpack{n=3, [1]=1, [2]='s'}) -- 2 args: number string printArgs(table.unpack{n=1}) -- 0 args: Why? How to fix?
favorite count: 0
upvote count: 2
type: AnsweredQuestion

user-interface
tag name: user-interface
tags question: http://stackoverflow.com/q/77168276
type: Tag
tags question: http://stackoverflow.com/q/78202258
tags question: http://stackoverflow.com/q/78531655
tags question: http://stackoverflow.com/q/78781305
tags question: http://stackoverflow.com/q/79152919

nginx
tags question: http://stackoverflow.com/q/77141904
tag name: nginx
tags question: http://stackoverflow.com/q/77150890
tags question: http://stackoverflow.com/q/77151783
type: Tag
tags question: http://stackoverflow.com/q/77270819
tags question: http://stackoverflow.com/q/77312058
tags question: http://stackoverflow.com/q/77257804
tags question: http://stackoverflow.com/q/77567066
tags question: http://stackoverflow.com/q/78225022
tags question: http://stackoverflow.com/q/78363120
tags question: http://stackoverflow.com/q/78480464
tags question: http://stackoverflow.com/q/78453790
tags question: http://stackoverflow.com/q/78678801
tags question: http://stackoverflow.com/q/78727370
tags question: http://stackoverflow.com/q/78677462
tags question: http://stackoverflow.com/q/78778829
tags question: http://stackoverflow.com/q/78909274
tags question: http://stackoverflow.com/q/79124307
tags question: http://stackoverflow.com/q/79370237
tags question: http://stackoverflow.com/q/79474052
tags question: http://stackoverflow.com/q/79516773

http://stackoverflow.com/a/77153111
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77152755
has body: spawn(function() while true do if state then spinning.CFrame = spinning.CFrame * CFrame.fromEulerAnglesXYZ(255, 0, 0) end wait(0.03) end end)

neovim
tags question: http://stackoverflow.com/q/77170295
tag name: neovim
tags question: http://stackoverflow.com/q/77217545
tags question: http://stackoverflow.com/q/77210020
tags question: http://stackoverflow.com/q/77223892
tags question: http://stackoverflow.com/q/77225259
type: Tag
tags question: http://stackoverflow.com/q/77097667
tags question: http://stackoverflow.com/q/77165982
tags question: http://stackoverflow.com/q/77120892
tags question: http://stackoverflow.com/q/77147995
tags question: http://stackoverflow.com/q/77115424
tags question: http://stackoverflow.com/q/77100369
tags question: http://stackoverflow.com/q/77311853
tags question: http://stackoverflow.com/q/77332794
tags question: http://stackoverflow.com/q/77405690
tags question: http://stackoverflow.com/q/77287266
tags question: http://stackoverflow.com/q/77255648
tags question: http://stackoverflow.com/q/77283313
tags question: http://stackoverflow.com/q/77517930
tags question: http://stackoverflow.com/q/77437533
tags question: http://stackoverflow.com/q/77495184
tags question: http://stackoverflow.com/q/77539961
tags question: http://stackoverflow.com/q/77549895
tags question: http://stackoverflow.com/q/77441092
tags question: http://stackoverflow.com/q/77490875
tags question: http://stackoverflow.com/q/77527148
tags question: http://stackoverflow.com/q/77769954
tags question: http://stackoverflow.com/q/77697425
tags question: http://stackoverflow.com/q/77734506
tags question: http://stackoverflow.com/q/77671751
tags question: http://stackoverflow.com/q/77666088
tags question: http://stackoverflow.com/q/77888576
tags question: http://stackoverflow.com/q/77886971
tags question: http://stackoverflow.com/q/77829116
tags question: http://stackoverflow.com/q/77951468
tags question: http://stackoverflow.com/q/77906120
tags question: http://stackoverflow.com/q/77850861
tags question: http://stackoverflow.com/q/77913819
tags question: http://stackoverflow.com/q/77933538
tags question: http://stackoverflow.com/q/77792860
tags question: http://stackoverflow.com/q/77927924
tags question: http://stackoverflow.com/q/78050459
tags question: http://stackoverflow.com/q/78104676
tags question: http://stackoverflow.com/q/77991625
tags question: http://stackoverflow.com/q/78090720
tags question: http://stackoverflow.com/q/78108133
tags question: http://stackoverflow.com/q/78129944
tags question: http://stackoverflow.com/q/78136904
tags question: http://stackoverflow.com/q/78137732
tags question: http://stackoverflow.com/q/78006322
tags question: http://stackoverflow.com/q/77973700
tags question: http://stackoverflow.com/q/78188829
tags question: http://stackoverflow.com/q/78263055
tags question: http://stackoverflow.com/q/78202387
tags question: http://stackoverflow.com/q/78177017
tags question: http://stackoverflow.com/q/78150730
tags question: http://stackoverflow.com/q/78196346
tags question: http://stackoverflow.com/q/78173715
tags question: http://stackoverflow.com/q/78235556
tags question: http://stackoverflow.com/q/78294508
tags question: http://stackoverflow.com/q/78298729
tags question: http://stackoverflow.com/q/78243000
tags question: http://stackoverflow.com/q/78290698
tags question: http://stackoverflow.com/q/78305561
tags question: http://stackoverflow.com/q/78301093
tags question: http://stackoverflow.com/q/78341564
tags question: http://stackoverflow.com/q/78349390
tags question: http://stackoverflow.com/q/78319200
tags question: http://stackoverflow.com/q/78308549
tags question: http://stackoverflow.com/q/78325836
tags question: http://stackoverflow.com/q/78375359
tags question: http://stackoverflow.com/q/78330939
tags question: http://stackoverflow.com/q/78370029
tags question: http://stackoverflow.com/q/78361071
tags question: http://stackoverflow.com/q/78318512
tags question: http://stackoverflow.com/q/78318964
tags question: http://stackoverflow.com/q/78391628
tags question: http://stackoverflow.com/q/78433872
tags question: http://stackoverflow.com/q/78361215

http://stackoverflow.com/q/77129551
tagged with: fluentd
score: 0
tagged with: fluent-bit
has comment: http://stackoverflow.com/comment/135973246
type: Question
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/135982608
has body: 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: [0] memory: [1694350030.133389853, {"Mem.total"=>2006712, "Mem.used"=>1872936, "Mem.free"=>133776, "Swap.total"=>2744316, "Swap.used"=>718668, "Swap.free"=>2025648}] When using the syslog output plugin, the syslog_message_key must be declared for it to successfully send the message. Now, when I set the syslog_message_key to something like Mem.total, I successfully start seeing "2006712" on my remote syslog server. However, I would like to send the entire payload, as in everything inside the {} to the remote syslog server. Currently, I tried the Nest filter plugin to nest everything under a single Memstats key. When I do this, the stdout looks as expected: [0] mem.local: [1694367396.133191260, {"Memstats"=>{"Mem.total"=>2006712, "Mem.used"=>1899256, "Mem.free"=>107456, "Swap.total"=>2744316, "Swap.used"=>737692, "Swap.free"=>2006624}}], so it does successfully add the Memstats key. 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. Observed Outputs: //Using Mem.total as syslog_message_key: <date> <IP> 1 2023-09-10T19:14:01.132671Z - - - - - 2006712 //Using the Memstats with Nest Filter as syslog_message_key OR using no key (not setting anything): <date> <IP> 1 2023-09-10T19:14:33.133314Z - - - - - //Using logger command to send a simple test nested JSON to the syslog-ng server: <date> <IP> 1 2023-09-10T14:01:33.708649-04:00 UbuntuVM vboxuser1 - - [timeQuality tzKnown="1" isSynced="0"] {"Memstats": {"test":"hi", "test2: "hello"}} I have also tried using the record_modifier and modify…
has title: How to send entire JSON payload to syslog through fluent bit
answer count: 0
tagged with: lua
tagged with: syslog
has comment: http://stackoverflow.com/comment/135982559
type: UnansweredQuestion

http://stackoverflow.com/q/77065047
answer count: 0
tagged with: lua
has title: Timers session value extracted with Lua
tagged with: haproxy
type: UnansweredQuestion
score: 1
has body: In documentation about Timing events 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.
favorite count: 0
type: Question
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/136016988
comment on: http://stackoverflow.com/a/77153794
type: Comment
score: 0
type: AnswerComment
has text: 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.

http://stackoverflow.com/a/77179275
answers question: http://stackoverflow.com/q/77168276
has body: How are you showing the GUI to the player? 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. If you did it yourself, you might forget that the ScreenGui is enabled and shows upon being cloned to the player's PlayerGui folder. This also means subsequent frames that have their .Visibile property turned on, will also automatically be shown. All in all, it means that the GUI is set to show itself first thing it's parented. To solve this you might want your localscript to also control the appropiate properties of the ScreenGui and frames you want to show. E.g. local mainFrame = script.Parent.Parent.Parent.MainFrame local open = true script.Parent.MouseButton1Click:Connect(function() if open == true then open = false mainFrame:TweenPosition(UDim2.new(0.278, 0,0.319, 0), "InOut", "Quad", 0.5, true) task.wait(0.5) mainFrame.Visible = false else open = true mainFrame.Visible = true mainFrame:TweenPosition(UDim2.new(0.278, 0,1, 0), "InOut", "Quad", 0.5, true) end end) 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: ... mainFrame.Position = UDim2.new(0.278, 0,0.319, 0) ... -- the rest of the code ...
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77168276
score: 1
upvote count: 1

http://stackoverflow.com/q/77161382
tagged with: lua
tagged with: roblox
answer count: 1
has body: I'm using Roblox Studio and the only language I'm familiar with is Java. I created 2 buttons called "open" and "close", and a frame including images and text called "menu". 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.
score: 0
type: Question
has answer: http://stackoverflow.com/a/77183659
has title: Slide In and Out Gui Using Buttons Doesn't Work
type: UnansweredQuestion

http://stackoverflow.com/q/77155984
has answer: http://stackoverflow.com/a/77156763
answer count: 1
type: UnansweredQuestion
tagged with: arrays
score: 0
has comment: http://stackoverflow.com/comment/136041551
has body: playerInjuries = {} function OnPlayerTakeDamage(ply, dmginfo) if ply:IsPlayer() and dmginfo:IsDamageType(DMG_BULLET) then local hitgroup = ply:LastHitGroup() local injuryType = "" local injuryDescription = "" if hitgroup == HITGROUP_LEFTARM then local randomNum = RandomNumber(1, 100) if randomNum >= 75 then injuryType = injuries["Arm Links"][1] elseif randomNum <= 75 and randomNum >= 85 then injuryType = injuries["Arm Links"][2] elseif randomNum <= 85 and randomNum >= 95 then injuryType = injuries["Arm Links"][3] else injuryType = injuries["Arm Links"][4] end elseif hitgroup == HITGROUP_RIGHTARM then local randomNum = RandomNumber(1, 100) if randomNum >= 75 then injuryType = injuries["Arm Rechts"][1] elseif randomNum <= 75 and randomNum >= 85 then injuryType = injuries["Arm Rechts"][2] elseif randomNum <= 85 and randomNum >= 95 then injuryType = injuries["Arm Rechts"][3] else injuryType = injuries["Arm Rechts"][4] end elseif hitgroup == HITGROUP_LEFTLEG then local randomNum = RandomNumber(1, 100) if randomNum >= 75 then injuryType = injuries["Bein Links"][1] elseif randomNum <= 75 and randomNum >= 85 then injuryType = injuries["Bein Links"][2] elseif randomNum <= 85 and randomNum >= 95 then injuryType = injuries["Bein Links"][3] else injuryType = injuries["Bein Links"][4] end elseif hitgroup == HITGROUP_RIGHTLEG then local randomNum = RandomNumber(1, 100) if randomNum >= 75 then injuryType = injuries["Bein Rechts"][1] elseif randomNum <= 75 and randomNum >= 85 then injuryType = injuries["Bein Rechts"][2] elseif randomNum <= 85 and randomNum >= 95 then injuryType = injuries["Bein Rechts"][3] else injuryType = injuries["Bein Rechts"][4] end elseif hitgroup == HITGROUP_CHEST or hitgroup == HITGROUP_GENERIC then elseif hitgroup == HITGROUP_HEAD then end if injuryType ~= "" then if not playerInjuries[ply] then playerInjuries[ply] = {} end table.insert(playerInjuries[ply], injuryType) test(ply, injuryType) end end end function test(ply, injuryType) ply:ChatPrint(injuryTyp…
has title: Initialize Lua array in a function and use it outside. I do not get it
type: Question
tagged with: garrys-mod
tagged with: lua

http://stackoverflow.com/comment/136029972
score: 0
comment on: http://stackoverflow.com/a/77162382
type: Comment
type: AnswerComment
has text: 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.

http://stackoverflow.com/q/77138490
tagged with: lua
has comment: http://stackoverflow.com/comment/136000318
type: UnansweredQuestion
has body: 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. 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?
tagged with: encoding
has title: .lua files seem to have been corrupted
score: 0
has comment: http://stackoverflow.com/comment/136000608
type: Question
answer count: 0
tagged with: character-encoding

http://stackoverflow.com/q/77223892
answer count: 1
favorite count: 0
tagged with: coc.nvim
has answer: http://stackoverflow.com/a/77553699
type: Question
downvote count: 0
has body: I use coc.nvim with the proposed default configuration that set (in a lua file) : -- Use `[g` and `]g` to navigate diagnostics -- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true}) keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true}) I would like to know is there is a way to make these motion repeteable with ".". I see that the tpope's plugin vim-repeat seems to allow it. Indeed, it says that: Adding support to a plugin is generally as simple as the following command at the end of your map functions. silent! call repeat#set("\<Plug>MyWonderfulMap", v:count) But I have no idea how to actually put this line of code with the "keyset" command. Do you have an idea of how to do it? Thanks for reading (and helping) me!
tagged with: lua
type: UnansweredQuestion
score: 1
tagged with: neovim-plugin
has title: Repeat with "." a motion plugin command mapped in lua throught keyset?
tagged with: neovim
upvote count: 1

http://stackoverflow.com/q/77155856
has title: I need to compare %01[1 02813]$ which is the output from my weighing scale with TCP IP Connection Protocol
has comment: http://stackoverflow.com/comment/136018501
has body: When i connect to 192.168.1.10:1001 port and send command %01R$$ then i get some value i.e. %01[1 02813]$ which i then splice and get it into one single variable Call Actual Weight . (Please Refer the photo 1 & 2 Attached below) i am getting error "Attempt to compare Number with String" What is the way forward please help as it is a on going project for robotics sorting using weighing scale. Thank you. I tried Getting it into another variable which take a number as input and tried converting but no success so far. This is the program which was generated in the backend: 2 Files Generated : global.lua Pre_Data = '' Post_Data = '' Weight = 0 Data_Char = 0 Actual_Weight = 0 WEIGHT_WEIGHT_WEIGHT = 0 function Get_Weight() resultOpen1,socket1 = TCPCreate(false, '192.168.1.10', 1001) if resultOpen1 == 0 then print("Create TCP Client Success!") else print("Create TCP Client failed, code:", resultOpen1) end resultOpen1 = TCPStart(socket1, 0) if resultOpen1 == 0 then print("Connect TCP Server Success!") else print("Connect TCP Server failed, code:", 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 = Data_Char + 1 Sleep(50) end print(Actual_Weight) end Get_Weight( ) WEIGHT_WEIGHT_WEIGHT = Actual_Weight Sync() if WEIGHT_WEIGHT_WEIGHT>280 then MovJ((P1)) else MovJ((P2)) end src0.lua Pre_Data = '' Post_Data = '' Weight = 0 Data_Char = 0 Actual_Weight = 0 WEIGHT_WEIGHT_WEIGHT = 0 function Get_Weight() resultOpen1,socket1 = TCPCreate(false, '192.168.1.10', 1001) if resultOpen1 == 0 then print("Create TCP Client Success!") else print("Create TCP Client failed, code:", resultOpen1) end resultOpen1 = TCPStart(socket1, 0) if resultOpen1 == 0 t…
score: 0
type: Question
has comment: http://stackoverflow.com/comment/136018239
tagged with: python
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/136018277
type: UnansweredQuestion

http://stackoverflow.com/comment/136115578
type: QuestionComment
has text: Yes, you must use an explicit `self` in the second case.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/77209867

http://stackoverflow.com/comment/136018501
has text: The backend can also be coded in python hence the tag
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77155856

http://stackoverflow.com/comment/136073303
score: 0
comment on: http://stackoverflow.com/q/77182395
type: QuestionComment
has text: 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?
type: Comment

math.round
tag name: math.round
tags question: http://stackoverflow.com/q/77186525
type: Tag

file
tags question: http://stackoverflow.com/q/77189752
tag name: file
tags question: http://stackoverflow.com/q/77161193
type: Tag
tags question: http://stackoverflow.com/q/77659298
tags question: http://stackoverflow.com/q/78659386
tags question: http://stackoverflow.com/q/78647470
tags question: http://stackoverflow.com/q/79328249

http://stackoverflow.com/a/77187467
answers question: http://stackoverflow.com/q/77187410
score: 4
type: Answer
downvote count: 0
upvote count: 4
has comment: http://stackoverflow.com/comment/136085173
has body: The good old string interpolation in Lua. You can do this pretty conveniently using string.gsub: local vars = { title = "Test Song", author = "Tormy", date = "2022-10-15", project = "Test Project", } local template = "The title of this song is $title. $title was composed by $author in $date, when he have created the $project" local interpolated = template:gsub("%$(%w+)", vars) print(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 Note: The pattern is %$(%w+): A dollar sign (escaped because it is a magic character), followed by a captured word (one or more alphanumeric characters). gsub 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. Regarding your edit: If you don't have the variables up-front but rather need to pass the $... to an API function, you can pass a function to gsub: local interpolated = template:gsub("%$%w+", API) This will call the API function for each variable in the template string, replacing it with the return value of the API function. If your API function is slow and benefits from being batched or similar, then you might want to first collect the "wildcards" into a table using gmatch as you already seem to have figured out.
has comment: http://stackoverflow.com/comment/136078195
has comment: http://stackoverflow.com/comment/136076307

lua-c++-connection
tags question: http://stackoverflow.com/q/77221746
tag name: lua-c++-connection
type: Tag
tags question: http://stackoverflow.com/q/77249976
tags question: http://stackoverflow.com/q/78076526
tags question: http://stackoverflow.com/q/78160089
tags question: http://stackoverflow.com/q/79283384

http://stackoverflow.com/q/77189752
tagged with: love2d
has comment: http://stackoverflow.com/comment/136082137
tagged with: file
answer count: 1
score: 0
has body: 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: ... utils |json.lua <-- library I use for encoding and decoding |JSONHandler.lua |parameters.json conf.lua main.lua ... I get my error in JSONHandler.lua where I have: local json = require "utils/json" Handler = { filename = "utils/parameters.json", params = {}, ... } function Handler:init() local o = {} setmetatable(o, self) self.__index = self local file = io.open(self.filename, "r") local content = file:read("a") ... My file ends up being nil I tried many different relative paths for filename but nothing worked so I'm wondering how .love files handle paths, how should I track to my parameters.json?
type: AnsweredQuestion
tagged with: path
tagged with: io
tagged with: lua
type: Question
has title: Can't read file in Lua after I moved the .love file elsewhere
has answer: http://stackoverflow.com/a/77199844
accepted answer: http://stackoverflow.com/a/77199844
has comment: http://stackoverflow.com/comment/136082436

http://stackoverflow.com/q/77164795
has body: This is an example lua script that can be ran with luvit: local discordia = require('discordia') local client = discordia.Client() client:on('ready', function() print('Logged in as '.. client.user.username) end) client:on('messageCreate', function(message) if message.content == '!ping' then message.channel:send('Pong!') end end) client:run('') I am wondering how I can compile this lua script into an exe with all packages ( discordia for example ) included in the exe build I tried using RTC which compiles normal lua into exe, not luvit . RTC: https://github.com/samyeyo/rtc
has title: How do I compile a lua luvit script into an exe while including packages
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78455076
score: 0
type: Question
tagged with: lua
tagged with: luvit

http://stackoverflow.com/comment/136036160
has text: 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.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77165982

http://stackoverflow.com/comment/135955793
has text: 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".
score: 0
comment on: http://stackoverflow.com/q/77121137
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/135861277
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/77066682
type: AnswerComment
score: 3

http://stackoverflow.com/comment/136153377
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77217545
has text: 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).
type: Comment

mediawiki
type: Tag
tags question: http://stackoverflow.com/q/77131643
tag name: mediawiki
tags question: http://stackoverflow.com/q/77383213
tags question: http://stackoverflow.com/q/78805862
tags question: http://stackoverflow.com/q/78827670
tags question: http://stackoverflow.com/q/79532226

http://stackoverflow.com/comment/136562679
score: 0
has text: 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
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77150797

http://stackoverflow.com/q/77077148
has body: My table: local Cache = { SurvivalGameFramework = { parent = game.ServerStorage } } As you can probably tell, this table is not an empty value or "nil" but according to ROBLOX studio, Cache[1] is nil, and I've tried literally everything to figure out what is wrong with this engine. print(Cache[1]) will return nil and so will Cache.SurvivalGameFramework[1].
type: Question
tagged with: lua
tagged with: lua-table
tagged with: roblox
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77077240
has title: Table value returns nil when it should not be
score: 0

python
type: Tag
tags question: http://stackoverflow.com/q/77105337
tag name: python
tags question: http://stackoverflow.com/q/77155856
tags question: http://stackoverflow.com/q/77441092
tags question: http://stackoverflow.com/q/78041511
tags question: http://stackoverflow.com/q/78616651
tags question: http://stackoverflow.com/q/78699403
tags question: http://stackoverflow.com/q/78712098
tags question: http://stackoverflow.com/q/78866660
tags question: http://stackoverflow.com/q/78951239
tags question: http://stackoverflow.com/q/78938722
tags question: http://stackoverflow.com/q/78985612

http://stackoverflow.com/comment/135983392
type: QuestionComment
has text: 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 ?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77131643

http://stackoverflow.com/q/77167668
tagged with: game-engine
tagged with: lua
tagged with: physics
has title: Roblox anchoring for a part instance not working
has body: 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. local tool = script.Parent local char = tool.Parent.Parent.PlayerGui local acid tool.Activated:Connect(function() local part = Instance.new("Part") part.Parent = workspace part.Name = "Bomb" part.Shape = Enum.PartType.Ball part.Size = Vector3.new(2,2,2) part.Position = tool.Handle.Position part.BrickColor = BrickColor.new("Black") local flashcount = 0 local function flash() local part = part part.BrickColor = BrickColor.new("Really red") wait(0.99) part.BrickColor = BrickColor.new("Black") end while wait(1) do flash() flashcount += 1 if flashcount == 4 then local sound = Instance.new("Sound") sound.SoundId = "rbxassetid://6823153536" sound.RollOffMaxDistance = 100 sound.Parent = part sound:Play() local explosion = Instance.new("Explosion") explosion.Parent = workspace explosion.Position = part.Position explosion.Hit:Connect(function(parti) parti.Anchored = false end) acid = Instance.new("Part") acid.Position = part.Position acid.Parent = workspace acid.Size = Vector3.new(1, 5, 5) acid.Anchored = true break end end wait(4) part:Destroy() wait(4) end) I also tried isolating this from it but it didn't work. I need to anchor it for an bomb tool in my game.
tagged with: debugging
accepted answer: http://stackoverflow.com/a/77169282
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/77169282
score: 0
type: Question
tagged with: roblox

http://stackoverflow.com/q/77211174
type: Question
has answer: http://stackoverflow.com/a/77423449
tagged with: lua
has title: Mod Factorio - an attempt to turn off the music while the game is running
has comment: http://stackoverflow.com/comment/136170891
has body: I'm trying to write a mod that adds music to the game. Just add music is obtained through the data.lua file here is the code (data.lua): require("music.gameplay.gameplay") require("music.rock.rock") require("music.starcraft.starcraft") these are albums - each has a file that adds music via "data:extend" 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) I created a button in the "settings.lua" file here is the code (settings.lua): data:extend({ { type = "string-setting", name = "my-mod-always-difficult", setting_type = "runtime-global", default_value = "yes", allowed_values = {"yes", "no"} } }) And from this moment the problems begin. I tried to add music when starting the game in the same "data.lua" file with the condition. if settings.global["my-mod-always-difficult"].value == "yes" then require("music.randFT.gameplay.gameplay") require("music.randFT.rock.rock") require("music.randFT.starcraft.starcraft") end returns an error: attempt to index field 'global' (a nil value) then I decided to delete the tracks during the map launch in the "control.lua" file: here is the code (settings.lua): local function removeAddedMusic() for i, sound in ipairs(data.raw["ambient-sound"]) do if sound.name ~= "Terran_1" then table.remove(data.raw["ambient-sound"], i) end end end script.on_init(removeAddedMusic) tried to delete all but one music - "Terran_1" another mistake: factorio attempt to index global 'data' (a nil value) I understand that I use to "data" and "global" at the moment when they have the value "nil" but how to do otherwise, I don't understand I tried to do a couple more actions, but the same trouble, the same mistakes.
answer count: 1
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/136506299
comment on: http://stackoverflow.com/a/77405015
score: 0
type: AnswerComment
has text: 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).
type: Comment

http://stackoverflow.com/comment/136068294
comment on: http://stackoverflow.com/q/77182395
type: QuestionComment
score: 1
has text: 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).
type: Comment

http://stackoverflow.com/comment/136029855
type: AnswerComment
has text: 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.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77162382

http://stackoverflow.com/comment/136118905
comment on: http://stackoverflow.com/a/77183659
score: 0
type: AnswerComment
has text: You need to put the location inside the UDmi2.new() for example: UDmi2.new(0.5,0,0.5,0)
type: Comment

http://stackoverflow.com/a/77946704
score: 0
type: Answer
has body: Ran into the same issue. tried null-ls but moved away from it doe to its archiving. I now use vim-prettier add it to packer using this. but switch out yarn for whatever you use. use { 'prettier/vim-prettier', run = 'yarn install', ft = { 'javascript', 'typescript', 'css', 'less', 'scss', 'graphql', 'markdown', 'vue', 'html' } } what I want to do now is change the key binding to &lt;leader&gt;f if a prettierrc file is present and default to the buff format if not.
answers question: http://stackoverflow.com/q/77115424

refresh
type: Tag
tag name: refresh
tags question: http://stackoverflow.com/q/77097667

http://stackoverflow.com/q/77153081
answer count: 2
tagged with: azerothcore
type: Question
upvote count: 1
tagged with: module
favorite count: 0
downvote count: 0
score: 1
has body: 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. i am using this azerothcore version: AzerothCore rev. 96a5224d927f+ 2023-04-22 07:25:31 +0700 (npcbots_3.3.5 branch) (Win64, Release, Static) This is my script, it is stored in the lua_scripts folder with other lua scripts that seem to work: -- Function to check if an item is grey (common) function IsGreyItem(item) local itemQuality = item:GetQuality() return itemQuality == 0 -- 0 represents poor quality (common) end -- Hook into the loot drop event globally function OnLoot(event, player, creature) local loot = creature:GetLoot() if not loot then return end for i = loot:GetSize(), 1, -1 do local item = loot:GetItem(i) if item and IsGreyItem(item) then -- Grey item found, remove it from the loot loot:RemoveItem(i) end end end -- Register the loot event handler globally RegisterPlayerEvent(27) -- Register the loot event (ID 27) globally AddEvent("OnCreatureLoot", OnLoot) maybe someone has an idea why it doesn't work :) i killed some low level mobs to check if they still drop grey items and they do.
tagged with: lua
has answer: http://stackoverflow.com/a/77405015
type: UnansweredQuestion
has title: Azerothcore lua script doesnt work or load
has answer: http://stackoverflow.com/a/77153140

http://stackoverflow.com/a/78464858
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/138357161
downvote count: 0
answers question: http://stackoverflow.com/q/77210020
score: 1
has body: Try to reinstall the lsp language. It works for me on WSL2 on windows.

http://stackoverflow.com/a/77180499
upvote count: 1
has comment: http://stackoverflow.com/comment/136070500
has comment: http://stackoverflow.com/comment/136070692
has comment: http://stackoverflow.com/comment/136070608
has body: If I were writing this in BASIC, I would do it like this: _worksheet = oSheets.getByIndex(0) oCursor = _worksheet.createCursor() oCursor.gotoEndOfUsedArea(False) oCursor.gotoStartOfUsedArea(True) nCountCells = oCursor.getRows().getCount() * oCursor.getColumns().getCount() Can you translate this into LUA?
downvote count: 0
answers question: http://stackoverflow.com/q/77179926
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/136069943

http://stackoverflow.com/q/77187410
has title: Lua: get all words starting with a specific character ("$")?
has body: I'm writing a script in Lua. 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 do not knowing upfront which wildcard the string has in it. Example: please suppose the following wildcards having their values: $title = Test Song $author = Tormy $date = 2022-10-15 $project = Test Project 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 "$": "The title of this song is $title. $title was composed by $author in $date, when he have created the $project" I know how to make a string substitution (and I know how to do it). What I'm not able to do is to get all the words starting with "$" I was able to get the just the "$" out of the sentence (so I could count it and know how many wildcards the string has) I could get all what there is before the character "$" and/or after it. But not just the wildcard itself. NOTE: the .gsub suggested in the comments is not the solution I'm asking. The issue is: to detect one by one, and to send them to an API (which is a function ..let's call it API() just to be comfortable in the understanding) that returns the value. This is the problem I can't figure out how to solve it. Only when I have one-by-one I can collect them into an array (table, in Lua) and apply the .gsub
has answer: http://stackoverflow.com/a/77189342
has answer: http://stackoverflow.com/a/77187467
score: 2
tagged with: string
upvote count: 2
type: AnsweredQuestion
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/77187467
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/77189342
tagged with: lua
tagged with: lua-patterns

http://stackoverflow.com/comment/136136057
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77217545
type: Comment
has text: `call minpac#update()`

http://stackoverflow.com/comment/136074503
type: AnswerComment
comment on: http://stackoverflow.com/a/77186853
has text: Of course, it was also JohnSUN in the other post who suggested to try `1` in Lua, which is the solution shown here.
type: Comment
score: 0

http://stackoverflow.com/a/77077240
type: Answer
score: 0
has body: Cache[1] being nil is correct: The only key used in your Cache table is SurvivalGameFramework. Cache.SurvivalGameFramework in turn only has a parent key, so Cache.SurvivalGameFramework[1] is nil as well. Cache.SurvivalGameFramework.parent on the other hand would be game.ServerStorage. A table t = {42} or t = {[1] = 42} would have t[1] == 42. A table t2 = {k = 42} or t2 = {["k"] = 42} has t2.k == 42 and t2["k"] == 42. Absent keys have nil values in Lua, so t2[1] is nil.
answers question: http://stackoverflow.com/q/77077148

latex
tags question: http://stackoverflow.com/q/77119800
type: Tag
tag name: latex
tags question: http://stackoverflow.com/q/77649718
tags question: http://stackoverflow.com/q/78058185
tags question: http://stackoverflow.com/q/78495314
tags question: http://stackoverflow.com/q/78567123
tags question: http://stackoverflow.com/q/78481889
tags question: http://stackoverflow.com/q/78575468
tags question: http://stackoverflow.com/q/79508464

azerothcore
tag name: azerothcore
tags question: http://stackoverflow.com/q/77153081
type: Tag
tags question: http://stackoverflow.com/q/77888368

http://stackoverflow.com/a/77153794
score: 1
accepted answer of: http://stackoverflow.com/q/77148511
has body: A new keyword requires either a preproccesor or modifying the language's grammar directly. An approximation of this syntax can already be easily achieved without leaving the confines of the language by writing an iterator - a function that when provided to the generic for continuously supplies values for the loop variables, until the first value it returns is nil. (More specifically, you usually write a function that creates (returns) an iterator. pairs and ipairs are examples of this.) next is a function that when provided a table and a key, returns the next key and its associated value. You can extend this with metatables and the __call 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). All this means that the syntax for value in collection 'filter' do print(value) end is very achievable. The full example, with a very basic iterator: -- This is a live, proxied view into an existing table local function View(t) local methods = {} local function match(value, filter) return type(value) == 'string' and value:match(filter) end function methods:filter(filter) local key, value return function (_) repeat key, value = next(t, key) until value == nil or match(value, filter) return value, key end end return setmetatable({}, { __index = methods, __metatable = false, __call = methods.filter }) end local foo = View { 'c', 'a', 'b', 'a', 'c', 'd' } -- :filter via __call for value in foo '[ab]' do print(value) end print('-------') -- explicitly for value in foo:filter '[cd]' do print(value) end print('-------') -- additional index variable -- this is the inverse of the more typical `pairs` construct for value, key in foo '[ad]' do print(key) end a b a ------- c c d ------- 2 4 6
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/136016896
has comment: http://stackoverflow.com/comment/136016988
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/77148511
downvote count: 0

http://stackoverflow.com/q/77170295
type: UnansweredQuestion
tagged with: security
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/136047981
tagged with: lua
has comment: http://stackoverflow.com/comment/136096515
has body: The sonarlint.nvim should offer in the setup call a possibility provide connection properties to a remote server a.k.a connected mode. SonarLint's Connected Mode connects SonarLint to your SonarQube project and provides additional benefits you won't get by using SonarLint or SonarQube alone. For the connected mode an API token is required which could lead following syntax: require('sonarlint').setup({ -- … connected_mode = { ['https://sonarcloud.io'] = { token = "my super secret token", -- … other stuff } } }) Now, I'm wondering what is a good and secure 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 chezmoi, but is there a native integration with a secure store such as secret-tool within the Neovim Lua API?
favorite count: 0
has title: Is there a standardized approach of retrievening credentials for Neovim Lua plugins
answer count: 0
tagged with: neovim
type: Question
upvote count: 1

http://stackoverflow.com/q/77219027
type: Question
has title: Clicker script only clicking once (Logitech Lua Scripting)
tagged with: lua
tagged with: logitech-gaming-software
accepted answer: http://stackoverflow.com/a/77220104
answer count: 1
type: AnsweredQuestion
has body: 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. local currentTime = GetRunningTime() math.randomseed(currentTime) function gaussianRandom(mean, stddev) local u1 = math.random() local u2 = math.random() local z0 = math.sqrt(-2.0 * math.log(u1)) * math.cos(2.0 * math.pi * u2) return mean + z0 * stddev end function OnEvent(event, arg) while IsMouseButtonPressed(4) do PressAndReleaseMouseButton(1) Sleep(gaussianRandom(800, 200)) end end However it only clicks once. If I instead use this code: min = 500 max = 1000 local currentTime = GetRunningTime() math.randomseed(currentTime) function OnEvent(event, arg) while IsMouseButtonPressed(4) do PressAndReleaseMouseButton(1) Sleep(math.random(min,max)) end end 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.
has answer: http://stackoverflow.com/a/77220104
score: 0

http://stackoverflow.com/q/77168568
has answer: http://stackoverflow.com/a/77186801
type: UnansweredQuestion
has body: 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? For example, I want that when I step on the block called "PartOne" the enabled of a script in starterGui called "First Person" 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 Sorry if this is written wrong but I'm using Google Translate because I don't know English. I was trying to make a script run by touching a block.
upvote count: 0
tagged with: lua
tagged with: roblox
answer count: 1
has comment: http://stackoverflow.com/comment/136052527
has title: How do I make a script activate an enabled when stepping on a block? (Roblox)
type: Question
favorite count: 0
score: -3
downvote count: 3

io
tags question: http://stackoverflow.com/q/77189752
type: Tag
tag name: io

http://stackoverflow.com/q/77115728
has title: CMake not finding lua in github action
has comment: http://stackoverflow.com/comment/135946302
tagged with: lua
has body: 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 https://github.com/marketplace/actions/install-lua-luajit to get lua so that my program finds it and links to it. So my .github/workflows/myAction.yml file looks like this: name: compile on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: leafo/gh-actions-lua@v10 with: luaVersion: "5.1.5" - uses: leafo/gh-actions-luarocks@v4 - name: checkLuaExistence run: lua -v - name: makeBuildDir run: cmake -E make_directory build - name: useCmake run: cmake -B build -S . - name: compile run: cmake --build build and my CMakeLists.txt file looks like this: cmake_minimum_required (VERSION 3.5) project (myLuaTest) find_package (Lua REQUIRED) Unfortunately, the job fails during the step useCmake with error Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR). That means that lua is installed, because the step checkLuaExistence works fine. How do I change it so that cmake finds lua?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135946393
tagged with: cmake
score: 0
tagged with: github-actions
answer count: 0
type: Question

gpu-instancing
tags question: http://stackoverflow.com/q/77168985
tag name: gpu-instancing
type: Tag

http://stackoverflow.com/comment/136107209
comment on: http://stackoverflow.com/q/77205227
has text: Please [don't post images of code/error/textual content](https://meta.stackoverflow.com/q/285551). Paste them here as text.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/136010832
has text: How many rate-limiting keys do you have?
comment on: http://stackoverflow.com/q/77151783
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/135942514
has text: Learn about RTOS-es
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77099924

http://stackoverflow.com/q/77206230
tagged with: lua
has body: I don't understand why this happens. function findVar() local i = string.find(equation, "%a") var = string.sub(equation, i, i) while true do i = string.find(equation, "%a", i + 1) if i == nil then break end check = string.sub(equation, i, i) if not var == check then quit("Error. Multiple variables.", true) end end end 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. I have tried changing the check variable to global.
has comment: http://stackoverflow.com/comment/136108415
type: AnsweredQuestion
upvote count: 1
answer count: 1
favorite count: 0
has title: Why doesn't == return false here?
type: Question
score: 1
has answer: http://stackoverflow.com/a/77206367
downvote count: 0
accepted answer: http://stackoverflow.com/a/77206367

http://stackoverflow.com/a/77102075
has comment: http://stackoverflow.com/comment/135922526
score: 1
accepted answer of: http://stackoverflow.com/q/77101884
has comment: http://stackoverflow.com/comment/135922525
downvote count: 0
answers question: http://stackoverflow.com/q/77101884
has body: I don't see anything wrong with the string replacement code, as executing ("foo-bar.html-some-more"):gsub("(.-)%.html(.-)", "%1%2") returns foo-bar-some-more 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 .htm extension instead of .html). I'd check if the code works outside of your environment in a regular Lua interpreter and also check if you get the expected result if you set the result value manually to whatever result you expect from gsub (just to make sure that the rest of the processing happens as you envision it).
type: AcceptedAnswer
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/135946692

syslog
type: Tag
tag name: syslog
tags question: http://stackoverflow.com/q/77129551

http://stackoverflow.com/q/77221657
score: 2
tagged with: lua
answer count: 1
favorite count: 0
has body: 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 "attempt to index a nil value". Is there a way to "catch" this error beforehand in order to check if specific table items exist, e.g. local hello = {} local v = hello.this.is.a.test Is there a simple way to check if the item hello.this.is.a.test exists without manually checking each sub-table in the hierarchy?
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77221949
has title: Is there a way to check if an arbitrary table item exists?
type: Question
has answer: http://stackoverflow.com/a/77221949
downvote count: 0

http://stackoverflow.com/q/77165982
tagged with: lua
has body: this is my lua config for cmp: require('lspconfig')['jdtls'].setup { root_dir = function(fname) return vim.fn.getcwd() end, cmd = { 'jdtls', '-vmargs', '-Dorg.eclipse.jdt.ls.taskTags=', '-Dorg.eclipse.jdt.ls.taskPriorities=' }, } but still I keep seeing the markers on //TODO I tried doing lots and lots of configurations, even using "settings" files in the source of my project
tagged with: cmp
tagged with: neovim
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136036160
has title: disable task tag [TODO] jdtls [nvim, cmp, lua]
score: 0
type: Question
has answer: http://stackoverflow.com/a/78475104
tagged with: liskov-substitution-principle

http://stackoverflow.com/q/77119800
upvote count: 2
has comment: http://stackoverflow.com/comment/135960593
tagged with: unicode
has comment: http://stackoverflow.com/comment/135961879
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/135960013
has title: Unicode characters writen as questions marks by LuaTeX
answer count: 0
has comment: http://stackoverflow.com/comment/135959628
has body: This Lua script defined in a tex file: \begin{luacode*} function run_octave_script(octavescript) local command = os.getenv("HOME") " " .. octavescript local outputfile = io.popen(command) local outputtext = outputfile:read("*all") outputfile:close() for line in outputtext:gmatch("[^\n]+") do tex.print(line) tex.print("") end end \end{luacode*} captures the text output of an Octave script and copies it in a text box: \newenvironment{scriptbox}{ \begin{tcolorbox} \fontsize{16pt}{22pt} \fontspec{DejaVu Sans Mono} }{ \end{tcolorbox} } \newcommand{\runscript}[1]{\directlua{run_octave_script("#1")}} when called like this: \begin{scriptbox} \runscript{myscript(1,2);} \end{scriptbox} The output might contain Unicode symbols, like the "Em Quad" character (U+2001) or "element of" (U+2208), and the Lua script writes them as "???", 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). This is an example of the output to the TeX file: {(a,a), (c,a), (c,c)}???∪???{(a,c), (b,c), (c,a)} where two Em Quad symbols have been replaced by question marks. The DejaVu Sans Mono font is available for the Lua 5.4.4 compiler: $ luaotfload-tool --find="DejaVu Sans Mono" luaotfload | resolve : Font "DejaVu Sans Mono" found! luaotfload | resolve : Resolved file name "/usr/share/texlive/texmf-dist/fonts/truetype/public/dejavu/DejaVuSansMono.ttf" and contains these symbols. The system is also using UTF-8: $ locale charmap | grep -qi 'utf-\+8' && echo "Uses UTF-8 encoding.." Uses UTF-8 encoding.. 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.
tagged with: octave
downvote count: 0
tagged with: latex
score: 2
tagged with: lua
type: UnansweredQuestion

keycode
type: Tag
tags question: http://stackoverflow.com/q/77152755
tag name: keycode

http://stackoverflow.com/q/77209895
tagged with: lua
has body: local TweenService = game:GetService("TweenService") local part = workspace["road"] local information = TweenInfo.new(1) local Target = {transparency == 1} local Tween = TweenService:create (part, information, Target) wait(5) Tween:play() I'm getting the error "Unable to cast to Dictionary". How to fix this?
type: UnansweredQuestion
score: 0
answer count: 1
type: Question
has answer: http://stackoverflow.com/a/77209938
tagged with: roblox
has title: I'm trying to make a script that will make a part fade out. Please tell me what's wrong here?

http://stackoverflow.com/comment/135920684
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77099924

http://stackoverflow.com/a/77207097
has comment: http://stackoverflow.com/comment/136114284
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/136111286
accepted answer of: http://stackoverflow.com/q/77205227
answers question: http://stackoverflow.com/q/77205227
has body: local debounce=false conn = UIS.InputBegan:Connect(function(input, gameProcessedEvent) if input.UserInputType == Enum.UserInputType.MouseButton1 then if debounce then return end debounce=true humanoid.WalkSpeed -= shoting toolDebounce = true -- the boolean that must be true for the while process to run while toolDebounce do local startPosition = tool.Part.Position local endPosition = mouse.Hit.Position remoteEvent:FireServer(tool, startPosition, endPosition) task.wait (debounceTime) end humanoid.WalkSpeed += shoting debounce=false end end) conn2 = UIS.InputEnded:Connect(function(input, gameProcessedEvent) if input.UserInputType == Enum.UserInputType.MouseButton1 then 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 end end)

c++
tags question: http://stackoverflow.com/q/77221746
type: Tag
tag name: c++
tags question: http://stackoverflow.com/q/77160885
tags question: http://stackoverflow.com/q/77404263
tags question: http://stackoverflow.com/q/77325669
tags question: http://stackoverflow.com/q/77403589
tags question: http://stackoverflow.com/q/77249976
tags question: http://stackoverflow.com/q/77252080
tags question: http://stackoverflow.com/q/77395261
tags question: http://stackoverflow.com/q/77422104
tags question: http://stackoverflow.com/q/77544656
tags question: http://stackoverflow.com/q/77734716
tags question: http://stackoverflow.com/q/77696861
tags question: http://stackoverflow.com/q/78087883
tags question: http://stackoverflow.com/q/78430148
tags question: http://stackoverflow.com/q/78567807
tags question: http://stackoverflow.com/q/78740442
tags question: http://stackoverflow.com/q/78766168
tags question: http://stackoverflow.com/q/78774815
tags question: http://stackoverflow.com/q/79021129
tags question: http://stackoverflow.com/q/78983963
tags question: http://stackoverflow.com/q/78974545
tags question: http://stackoverflow.com/q/79238198
tags question: http://stackoverflow.com/q/79284034
tags question: http://stackoverflow.com/q/79261190
tags question: http://stackoverflow.com/q/79398648
tags question: http://stackoverflow.com/q/79535091
tags question: http://stackoverflow.com/q/79525645

http://stackoverflow.com/q/77161193
upvote count: 2
has answer: http://stackoverflow.com/a/77162382
score: 2
has comment: http://stackoverflow.com/comment/136029948
has title: Will editing a file always have O(N) time complexity?
tagged with: file
favorite count: 0
type: AnsweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/136028075
has body: 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. 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. For writing I'm currently: opening "tempFile" in append mode appending bytes [0, N) to the temp file appending the buffer appending [N + pageSize, fileSize] doing os.rename ("tempFile", "fileName") 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?
tagged with: time-complexity
type: Question
downvote count: 0
tagged with: lua
accepted answer: http://stackoverflow.com/a/77162382
tagged with: optimization
has comment: http://stackoverflow.com/comment/136029959

http://stackoverflow.com/comment/136000608
comment on: http://stackoverflow.com/q/77138490
type: Comment
score: 0
type: QuestionComment
has text: Compiling source into bytecode is different from applying some character encoding. But the result is similar: you see gibberish instead of readable text :-)

http://stackoverflow.com/q/77077778
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135880136
score: 0
has body: 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. 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. Thank 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.
has answer: http://stackoverflow.com/a/77083484
has comment: http://stackoverflow.com/comment/135880325
has title: Can't figure out how to make a combat system on Lua in Roblox Studio
type: Question
tagged with: roblox
tagged with: lua

http://stackoverflow.com/comment/136022645
comment on: http://stackoverflow.com/a/77156299
type: Comment
score: 0
type: AnswerComment
has text: I have to increment and get a counter atomically due to concurrency.

http://stackoverflow.com/q/77156207
tagged with: lua
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77157460
answer count: 1
score: 0
type: Question
has body: Can I know the script that repeats mouse clicks in a specific location? MoveMouseTo(62487,39895) PressMouseButton(1) sleep(1) I am a beginner. Results value created by searching, but an error occurs. MoveMouseTo(62487,39895) PressMouseButton(1) sleep(1)
has title: Can I know the script that repeats mouse clicks in a specific location?

debugging
tags question: http://stackoverflow.com/q/77072924
tags question: http://stackoverflow.com/q/77167668
type: Tag
tag name: debugging
tags question: http://stackoverflow.com/q/77495184
tags question: http://stackoverflow.com/q/77719576
tags question: http://stackoverflow.com/q/77815499
tags question: http://stackoverflow.com/q/78076526
tags question: http://stackoverflow.com/q/78273784
tags question: http://stackoverflow.com/q/78367547
tags question: http://stackoverflow.com/q/78361071
tags question: http://stackoverflow.com/q/78470963
tags question: http://stackoverflow.com/q/78950971

http://stackoverflow.com/q/77078238
tagged with: hammerspoon
type: Question
linked to: http://stackoverflow.com/q/588004
score: 0
duplicate of: http://stackoverflow.com/q/588004
has comment: http://stackoverflow.com/comment/135880940
tagged with: lua
has comment: http://stackoverflow.com/comment/135880932
has comment: http://stackoverflow.com/comment/135885797
linked to: http://stackoverflow.com/q/18005146
has body: I tried to use the hamerspoon package to write a timer as follows. local function startTimer() local totalSeconds = 5 local i = 0 local function onTimeout() i = i + .1 local stopTimer = i == totalSeconds -- THIS BOOLEAN COMPARISSON RETURNS WRONG RESULT print('stopTimer:', stopTimer) print(i, totalSeconds, type(i), type(totalSeconds), 5 == 5.0) if stopTimer then timer:stop() end end local timer = hs.timer.new(.1, onTimeout) timer:start() end As you can see in the output below stopTimer variable in above function is always false even for a comparisson of 5 == 5.0 The types of both variables are numbers Simply printing 5 == 5.0 seems to show the correct result stopTimer variable should be false when i is 5
has title: Lua number comparison returns wrong result
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135880812
answer count: 0

http://stackoverflow.com/q/77150797
tagged with: redis
has body: I need to fetch all key/value pairs that match a certain key prefix. This needs to be done in parallel (eg. using threads). My idea is to scan over all keys matching a prefix and filter only those whose (hash(key) % partition_size) == partition_id, where partition_size is the number of parallel processes and partition_id is a number between 0..partition_size-1 which is assigned to each process. What does Redis command or script look like? Is there a non-script way of doing so?
has title: Fetch Redis key/value pairs in parallel
answer count: 1
score: 0
tagged with: redis-scan
has comment: http://stackoverflow.com/comment/136562679
has answer: http://stackoverflow.com/a/77157462
type: Question
tagged with: lua
type: UnansweredQuestion

http://stackoverflow.com/comment/135914494
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77097667
type: Comment
has text: What do you mean by "refresh"?

http://stackoverflow.com/q/77150165
tagged with: libreoffice
has comment: http://stackoverflow.com/comment/136011859
tagged with: lua
tagged with: com
type: UnansweredQuestion
has body: 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: local _LibreOfffice = luacom.CreateObject("com.sun.star.ServiceManager") local desktop = _LibreOfffice:createInstance("com.sun.star.frame.Desktop") self._workbook = desktop:loadComponentFromURL("private:factory/scalc", "_blank", 0, {}) local sheet_count = self._workbook:getSheets():getCount() for i = sheet_count - 1, 0, -1 do local sheet = self._workbook:getSheets():getByIndex(i) --remove, but how? end
linked to: http://stackoverflow.com/q/70426708
has comment: http://stackoverflow.com/comment/136016654
score: 0
linked to: http://stackoverflow.com/q/71447528
type: Question
tagged with: libreoffice-calc
has title: Removing a sheet from a LibreOfficeCalc document
answer count: 0

http://stackoverflow.com/comment/136030010
type: AnswerComment
has text: Right. I'll add a caveat.
comment on: http://stackoverflow.com/a/77162382
score: 1
type: Comment

http://stackoverflow.com/q/77148511
score: 0
has comment: http://stackoverflow.com/comment/136005527
has answer: http://stackoverflow.com/a/77153794
accepted answer: http://stackoverflow.com/a/77153794
has body: I am trying to implement a custom iterator which works like table.foreach in Lua, but in more "syntax friendly" manner. I came across following construction (not sure if it's done purely in Lua or some kind of C "hack" in the Lua source code. -- creature is a collection of Creature objects -- "ps" is used as a filter variable foreach creature cre "ps" do if cre.name ~= $name then -- code... end end I tried to play around with table.foreach, ipairs 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?
type: Question
has comment: http://stackoverflow.com/comment/136005208
tagged with: lua
tagged with: lua-table
has title: Custom foreach implementation in Lua
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/77072924
upvote count: 1
score: 1
has body: here is my error Expected objects to be the same. Passed in: (table) { [1] = 1 [2] = 2 [3] = 3 [4] = 4 } Expected: (nil) here is my code some one can help me please local function between(a, b) local table = {} while not a == 5 do local a = 1 table[a] = a local a = a + 1 end print(table) end return between l have tried to use for loop can someone help me please
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135871308
has title: Why my Lua table is error when l use while loop
downvote count: 0
tagged with: debugging
has comment: http://stackoverflow.com/comment/135871792
tagged with: lua
answer count: 1
has answer: http://stackoverflow.com/a/77073363
type: Question
favorite count: 0

http://stackoverflow.com/a/77160422
accepted answer of: http://stackoverflow.com/q/77150890
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/77150890
has body: The simplest and most efficient solution that I found for this use case is nginx-extras which comes with already added extra nginx modules and it have echo module as well, which I was looking. You can find more available modules of your need by clicking the link.

http://stackoverflow.com/q/77070009
tagged with: lua
has body: 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 "image.png" or try to download it, then it takes me to this link which is invalid https://cdn.discordapp.com/attachments/1086674608368931027/1149816147466780672/image.png. 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 Screenshot of the Discord channel This is the image that I try to send (before I uploaded it it was .png now it is .jpg I dont know why) function base64_encode(data) local b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' return ((data:gsub('.', function(x) local r, b = '', x:byte() for i = 8, 1, -1 do r = r .. (b % 2 ^ i - b % 2 ^ (i - 1) > 0 and '1' or '0') end return r end) .. '0000'):gsub('%d%d%d?%d?%d?%d?', function(x) if #x < 6 then return '' end local c = 0 for i = 1, 6 do c = c + (x:sub(i, i) == '1' and 2 ^ (6 - i) or 0) end return b64chars:sub(c + 1, c + 1) end) .. (#data % 3 == 1 and '==' or #data % 3 == 2 and '=' or '')) end function sendDiscordWebhook(webhookUrl, message, imageFilePath) local boundary = "----------------------------" .. os.time() local headers = { ["Content-Type"] = "multipart/form-data; boundary=" .. boundary } local body = {} table.insert(body, "--" .. boundary) table.insert(body, 'Content-Disposition: form-data; name="content"\r\n\r\n' .. message) local imageFileData if imageFilePath then local file = io.open(imageFilePath, "rb") if file then imageFileData = file:read("*all") file:close() local fileName = imageFilePath:match("^.+[\\/](.+)$") local fileExtension = fileName:match("%.([^%.]+)$") local contentType = "image/" .. fileExtension table.insert(body, "--" .. boundary) table.insert(body, 'Content-Disposition: form-data; name="file[0]"; filename="' .. fileName .. '"') table.insert(body, 'Content-Type: ' .. contentType) table.insert(bod…
has answer: http://stackoverflow.com/a/77070612
has title: Lua Discord webhook bugged image dont display
tagged with: post
tagged with: discord
type: UnansweredQuestion
tagged with: fivem
answer count: 2
has answer: http://stackoverflow.com/a/77687979
tagged with: webhooks
score: 0
type: Question

http://stackoverflow.com/q/77093455
has answer: http://stackoverflow.com/a/77096550
accepted answer: http://stackoverflow.com/a/77096550
tagged with: lua
tagged with: dictionary
has body: I've seen this question a few times for python but I am looking for how to do it in Lua. I have a dictionary that looks like: myValues = { "key1":123, "key2":43, "key3":367, "key4":2 } 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?
answer count: 1
tagged with: math
linked to: http://stackoverflow.com/q/64365533
has title: Getting key with maximum value in dictionary? -In lua specifically
type: AnsweredQuestion
score: 0
tagged with: max
type: Question

http://stackoverflow.com/comment/135880940
type: QuestionComment
has text: See also https://stackoverflow.com/q/18005146/107090
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77078238

http://stackoverflow.com/comment/136029948
type: Comment
score: 0
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77161193

http://stackoverflow.com/comment/135961879
type: Comment
has text: @ESkri that did the trick, solved!
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77119800

http://stackoverflow.com/a/78455076
score: 0
answers question: http://stackoverflow.com/q/77164795
type: Answer
has body: To build luvit app into executable, you can use lit make. appdir should contain main.lua &amp; package.lua, you can generate it with lit init

http://stackoverflow.com/comment/135921571
has text: The book *Programming in Lua* is a good starting point. [Here is the chapter on tables.](https://www.lua.org/pil/2.5.html)
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77093869

http://stackoverflow.com/q/77151783
type: Question
tagged with: lua
tagged with: rate-limiting
has comment: http://stackoverflow.com/comment/136011221
has answer: http://stackoverflow.com/a/77156299
has comment: http://stackoverflow.com/comment/136010832
answer count: 1
type: UnansweredQuestion
tagged with: nginx
has title: TTL for AtomicLong in Apache Ignite
tagged with: ignite
has body: Is it possible to add TTL for AtomicLong in Apache Ignite or for any atomic objects? 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.
score: 0

http://stackoverflow.com/a/77070612
type: Answer
score: -1
answers question: http://stackoverflow.com/q/77070009
downvote count: 1
has body: 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: function sendDiscordWebhook(webhookUrl, message, imageFilePath) local boundary = "---------------------------" .. os.time() local headers = { ["Content-Type"] = "multipart/form-data; boundary=" .. boundary } local body = {} table.insert(body, "--" .. boundary) table.insert(body, 'Content-Disposition: form-data; name="content"\r\n\r\n' .. message) if imageFilePath then local fileName = imageFilePath:match("^.+[\\/](.+)$") local fileExtension = fileName:match("%.([^%.]+)$") local contentType = "image/" .. fileExtension table.insert(body, "--" .. boundary) table.insert(body, 'Content-Disposition: form-data; name="file"; filename="' .. fileName .. '"') table.insert(body, 'Content-Type: ' .. contentType) table.insert(body, "") local imageFileData local file = io.open(imageFilePath, "rb") if file then imageFileData = file:read("*all") file:close() table.insert(body, imageFileData) else print("Failed to open the image file: " .. imageFilePath) return end end table.insert(body, "--" .. boundary .. "--") local requestBody = table.concat(body, "\r\n") PerformHttpRequest(webhookUrl, function(err, text, headers) if err == 200 then print("Message sent successfully!") else print("Failed to send message. Error code: " .. err) end end, 'POST', requestBody, headers)
has comment: http://stackoverflow.com/comment/135868600
upvote count: 0

http://stackoverflow.com/q/77150890
type: Question
tagged with: webserver
tagged with: nginx-config
tagged with: ubuntu
has title: how to add delay in Nginx response
has body: 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. I tried to find help online and came to know that, this echo module can help: https://github.com/openresty/echo-nginx-module But this module does not support nginx 1.17.0 or above and my nginx version is above the supported version. 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.
accepted answer: http://stackoverflow.com/a/77160422
tagged with: lua
has comment: http://stackoverflow.com/comment/136012081
tagged with: nginx
has answer: http://stackoverflow.com/a/77160422
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136011148
answer count: 1
score: 0

http://stackoverflow.com/q/77077249
type: UnansweredQuestion
has title: How can I change the Roblox (Lua) timer to display 3 decimals, and not more?
has body: 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: local player = game.Players.LocalPlayer local Running = player:WaitForChild("Running") -- local Text = script.Parent:WaitForChild("Time") local Time = 0.00 while wait() do if Running.Value == true then Text.TextColor3 = Color3.fromRGB(232,232,232) Text.Visible = true Text.Text = Time wait(0.125) Time = Time + 0.125 else if Running.Value == false then Text.TextColor3 = Color3.fromRGB(255,47,92) Time = 0.00 end end end 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?
answer count: 2
has answer: http://stackoverflow.com/a/77082083
score: 0
has answer: http://stackoverflow.com/a/77078012
tagged with: lua
type: Question
tagged with: roblox
linked to: http://stackoverflow.com/q/1811884

http://stackoverflow.com/q/77097667
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/135914494
tagged with: lunarvim
has body: 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.
has comment: http://stackoverflow.com/comment/135914848
score: 1
upvote count: 1
answer count: 1
type: UnansweredQuestion
tagged with: refresh
tagged with: neovim
has title: How to refresh LunarVim after Git pull or Git checkout?
favorite count: 0
has comment: http://stackoverflow.com/comment/136237768
has comment: http://stackoverflow.com/comment/135915632
downvote count: 0
has answer: http://stackoverflow.com/a/77286278

lua-api
tags question: http://stackoverflow.com/q/77091104
tag name: lua-api
tags question: http://stackoverflow.com/q/77121137
tags question: http://stackoverflow.com/q/77221746
type: Tag
tags question: http://stackoverflow.com/q/77312520
tags question: http://stackoverflow.com/q/77249976
tags question: http://stackoverflow.com/q/77930478

http://stackoverflow.com/a/77687979
type: Answer
answers question: http://stackoverflow.com/q/77070009
has body: 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. Solution We just need to take your base64 image data url and filter out the unneeded gibberish. This should remove the data:image/png;base64... part. -- Unsure about your data string variable name so I made one up local commaAt = imageDataString:find(",") local formattedImageString = imageDataString:sub(commaAt + 1) Then add this to set the encoding language to parse base64 so that we don't need to use any decoders. table.insert(body, 'Content-Disposition: form-data; name="file"; filename="' .. fileName .. '"') table.insert(body, 'Content-Type: ' .. contentType) -- Insert this line to your code table.insert(body, 'Content-Transfer-Encoding: base64') table.insert(body, "") table.insert(body, formattedImageString) 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. Cheers!
score: 0

http://stackoverflow.com/a/77174470
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77164011
answers question: http://stackoverflow.com/q/77164011
score: 0
has body: It looks like that I've solved it: Lua code to make parabola rasterization, the output is a list of integers as {x1, y1, x2, y2 ...} function getParabolaPoints (a, xMax) local x, y = 0, 0 local points = {x, y} while x &lt; xMax do local dx, dy = 0, 0 if ((y+1)/a)^0.5 - x - 0.5 &gt; 0 then dx = 1 end if a*(x+1)^2 - y - 0.5 &gt;= 0 then dy = 1 end x = x + dx y = y + dy table.insert (points, x) table.insert (points, y) end return points end

scrapy-splash
type: Tag
tags question: http://stackoverflow.com/q/77105337
tag name: scrapy-splash
tags question: http://stackoverflow.com/q/78638625

http://stackoverflow.com/comment/135914848
score: 0
comment on: http://stackoverflow.com/q/77097667
type: QuestionComment
has text: So, when you git clone, some files change and usualy it is a problem
type: Comment

http://stackoverflow.com/comment/136116430
type: AnswerComment
has text: Or just `for letter in text:gmatch"."` if you want to iterate over characters.
type: Comment
comment on: http://stackoverflow.com/a/77209692
score: 0

http://stackoverflow.com/q/77131643
has title: How to fix Luasandbox extension error Mediawiki
has comment: http://stackoverflow.com/comment/135983392
answer count: 0
tagged with: scribunto
score: 0
tagged with: cpanel
type: Question
has comment: http://stackoverflow.com/comment/135987002
tagged with: lua
has comment: http://stackoverflow.com/comment/135974956
tagged with: mediawiki
has body: 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: wfLoadExtension( 'Scribunto' ); $wgScribuntoDefaultEngine = 'luasandbox'; // Use LuaSandbox as the default engine 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: [ZQkYSxr_nfXN6YUDbjbzjQAAkTM] /index.php?title=Module:For&amp;action=submit Scribunto_LuaInterpreterNotFoundError: The luasandbox extension is not present, this engine cannot be used. Backtrace: from /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(44) #0 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaSandbox/LuaSandboxInterpreter.php(61): MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxInterpreter::checkLuaSandboxVersion() #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) #2 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(131): MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxEngine-&gt;newInterpreter() #3 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaEngine.php(235): Scribunto_LuaEngine-&gt;load() #4 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(41): Scribunto_LuaEngine-&gt;getInterpreter() #5 /home3/funkinch/public_html/extensions/Scribunto/includes/engines/LuaCommon/LuaModule.php(28): Scribunto_LuaModule-&gt;getInitChunk() #6 /home3/funkinch/public_html/extensions/Scribunto/includes/ScribuntoEngineBase.php(201): Scribunto_LuaModule-&gt…
has comment: http://stackoverflow.com/comment/135975167
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/135982247

http://stackoverflow.com/q/77066681
tagged with: lua
has answer: http://stackoverflow.com/a/77066682
tagged with: lua-table
type: Question
has body: Let's say I have this code: local testtbl = {"foo", "bar", "baz"} How do I get the index of an element? For example: print(indexOf(testtbl, "bar")) -- 2
linked to: http://stackoverflow.com/q/38282234
duplicate of: http://stackoverflow.com/q/38282234
has title: How do I find the index of an element in a table in Lua?
has comment: http://stackoverflow.com/comment/135863729
answer count: 1
score: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77066682
has comment: http://stackoverflow.com/comment/135863856

http://stackoverflow.com/comment/135982247
comment on: http://stackoverflow.com/q/77131643
score: 0
type: QuestionComment
has text: You need to have luasandbox PHP extension enabled, so that `php -i | grep 'luasandbox'` shows it. So, you need to have access to your PHP configuration.
type: Comment

http://stackoverflow.com/q/77221746
tagged with: lua
has body: 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. here's how the Lua state is set up lua_pushlightuserdata(luaState, this); lua_setglobal(luaState, "LUA_HOST"); lua_newtable(luaState); int circleTblIdx = lua_gettop(luaState); lua_pushvalue(luaState, circleTblIdx); lua_setglobal(luaState, "Circle"); lua_pushcfunction(luaState, wrap_createCircle); lua_setfield(luaState, -2, "new"); lua_pushcfunction(luaState, wrap_setCircleRadius); lua_setfield(luaState, -2, "setRadius"); lua_pushcfunction(luaState, wrap_destroyCircle); lua_setfield(luaState, -2, "destroy"); luaL_newmetatable(luaState, "CircleMetaTable"); lua_pushstring(luaState, "__index"); lua_pushvalue(luaState, circleTblIdx); lua_settable(luaState, -3); here's the functions int wrap_createCircle(lua_State* luaState){ if (lua_gettop(luaState) != 1) return -1; float radius = lua_tonumber(luaState, 1); CircleShape* circle = (CircleShape*)lua_newuserdata(luaState, sizeof(CircleShape)); new (circle) CircleShape(radius); luaL_getmetatable(luaState, "CircleMetaTable"); lua_setmetatable(luaState, -2); //putting the circle into a list called draw objects lua_getglobal(luaState, "LUA_HOST"); Render* host = static_cast<Render*>(lua_touserdata(luaState, -1)); host->drawObjects.push_back(circle); lua_pop(luaState, 1); return 1; } //this works fine, no need to change int wrap_setCircleRadius(lua_State* luaState){ if (lua_gettop(luaState) != 2) return -1; CircleShape* circle = static_cast<CircleShape*>(lua_touserdata(luaState, 1)); float radius = lua_tonumber(luaState, 2); circle->setRadius(radius); return 0; } int wrap_destroyCircle(lua_State* luaState){ if (lua_gettop(luaState) != 1) return -1; CircleShape* circle = static_cast<CircleShape*>(lua_touserdata(luaState, 1)); // TODO: remove the pointer fr…
tagged with: lua-api
has title: (Lua C API in C++) creating a destroy function for metatable object
tagged with: c++
upvote count: 1
type: UnansweredQuestion
score: 1
tagged with: lua-c++-connection
answer count: 1
has answer: http://stackoverflow.com/a/77222284
favorite count: 0
type: Question
downvote count: 0

http://stackoverflow.com/comment/136051284
comment on: http://stackoverflow.com/q/77164011
score: 0
type: QuestionComment
has text: 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.
type: Comment

haproxy
type: Tag
tags question: http://stackoverflow.com/q/77065047
tag name: haproxy
tags question: http://stackoverflow.com/q/78339620
tags question: http://stackoverflow.com/q/78572397
tags question: http://stackoverflow.com/q/78826653
tags question: http://stackoverflow.com/q/79089890
tags question: http://stackoverflow.com/q/79394748

http://stackoverflow.com/a/77324317
has body: If you want to use a separate function then make sure to use WaitForChild to reference it before using it in an argument. Probably not the best way to go around it, but it works. greenPart = game.Workspace:WaitForChild("Green Part") local function Touched(part) player:SetAttribute("GPU", part) end Touched(greenPart)
has comment: http://stackoverflow.com/comment/136434947
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/77205100
downvote count: 0

http://stackoverflow.com/comment/136027419
has text: @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
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77160885

liskov-substitution-principle
type: Tag
tags question: http://stackoverflow.com/q/77165982
tag name: liskov-substitution-principle
tags question: http://stackoverflow.com/q/78433138

http://stackoverflow.com/q/77228934
has title: Stage value isnt adding up when players are touching the part
has answer: http://stackoverflow.com/a/77247495
answer count: 1
score: 0
has body: So this is in roblox studio so uhh.. Im kinda new so... idrk how to fix this here's the code. imma explain tha code so uhh.. players should touch the checkpoints which is in workspace.Checkpoints when they touch those the Stage.Value should add + 1 then when they reach 30, they'll touch a part that will move them in the winner leaderboard that would add up too.. so uhh it seems like nothing is happening and no errors are found in the console local Checkpoints = workspace.Checkpoints game.Players.PlayerAdded:Connect(function(plr) local leaderstats = Instance.new("Folder", plr) leaderstats.Name = "leaderstats" local Stage = Instance.new("IntValue", leaderstats) Stage.Name = "Stage" Stage.Value = nil local Wins = Instance.new("IntValue") local WinnerArea = workspace.Checkpoints.WinSpawn Wins.Name = "Wins" Wins.Parent = leaderstats Wins.Value = 0 WinnerArea.Touched:Connect(function(hit) if tonumber(Stage.Value) == 30 then Wins.Value = Wins.Value + 1 Stage.Value = 0 end end) local lastCheckpointName = "" -- Store the name of the last touched checkpoint for _, checkpoint in pairs(Checkpoints:GetChildren()) do checkpoint.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local char = hit.Parent -- Ensure the player is the owner of the character if char.Parent == plr.Character then if tonumber(checkpoint.Name) == Stage.Value then lastCheckpointName = checkpoint.Name -- Store the name of the last touched checkpoint Stage.Value = Stage.Value + 1 elseif checkpoint.Name == "MainObbySpawn" then Stage.Value = 0 lastCheckpointName = checkpoint.Name -- Store the name of the last touched checkpoint end end end end) end plr.CharacterAdded:Connect(function(char) wait() local checkpointToMoveTo = Checkpoints:FindFirstChild(lastCheckpointName) if checkpointToMoveTo then char:MoveTo(checkpointToMoveTo.Position) elseif Checkpoints:FindFirstChild("MainObbySpawn") then char:MoveTo(Checkpoints:FindFirstChild("MainObbySpawn").Position) end end) end) so i tried fixing …
type: AnsweredQuestion
tagged with: roblox
type: Question
accepted answer: http://stackoverflow.com/a/77247495
tagged with: lua

http://stackoverflow.com/comment/135916590
type: Comment
type: AnswerComment
has text: This completely did the job and as you say, in an elegant and efficient manner. Thank you!
score: 0
comment on: http://stackoverflow.com/a/77096550

fluent-bit
type: Tag
tag name: fluent-bit
tags question: http://stackoverflow.com/q/77129551
tags question: http://stackoverflow.com/q/77292433
tags question: http://stackoverflow.com/q/79039651

http://stackoverflow.com/a/77286278
answers question: http://stackoverflow.com/q/77097667
has body: vim.o.autoread = true vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI', 'FocusGained' }, { command = "if mode() != 'c' | checktime | endif", pattern = { '*' }, }) You can create autocmd like this and it will change buffer if file changed in disk like git pull
score: 0
type: Answer

http://stackoverflow.com/a/77078012
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77077249
downvote count: 0
type: Answer
has body: When you display the time, use the string.format function to format the number : Text.Text = string.format("%.3f", Time) In this example, %f is used to display a floating point number, and %.3f limits the precision of that number to just 3 decimal points. For more information, see this answer : https://stackoverflow.com/a/1811889/2860267

luarocks
type: Tag
tags question: http://stackoverflow.com/q/77182395
tag name: luarocks
tags question: http://stackoverflow.com/q/77265289
tags question: http://stackoverflow.com/q/78658586
tags question: http://stackoverflow.com/q/78858627
tags question: http://stackoverflow.com/q/79191945
tags question: http://stackoverflow.com/q/79502556

http://stackoverflow.com/comment/136018277
comment on: http://stackoverflow.com/q/77155856
type: Comment
has text: Why is this tagged for Python? I see no Python code
score: 0
type: QuestionComment

http://stackoverflow.com/a/77095515
has body: 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. Thus: void accessTables(lua_State* L, int value) { lua_getglobal(L, "Tables"); lua_getfield(L,-1, "Effects"); // the manual step lua_geti(L, -1,value); //now it pushes the function onto the stack if (lua_pcall(L, 0, 0, 0) != 0) { //call it std::cout << "error running function `f':" << lua_tostring(L,-1) << '\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 //without the poppage, the stack grew by two entries each time I called it. } Did the trick
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77091104
answers question: http://stackoverflow.com/q/77091104

http://stackoverflow.com/a/77157363
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77156921
has body: Try io lib instead. do local file = io.open("unnamed1.lua", "w") file:writeprint("Test") file:close() end node.compile("unnamed1.lua")

http://stackoverflow.com/q/77196757
answer count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/77200244
tagged with: roblox
type: Question
upvote count: 1
tagged with: lua
has title: Is there a way to create a function that creates a new variable with the name of one of the parameters?
downvote count: 0
has body: 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. I made a basic outline that I wanted to expand upon but made this for testing purposes local function Info(playerInfo,health,energy,speed,attack,physicalDefense,magicalDefense) playerInfo = { health = health, energy = energy, speed = speed, attack = attack, physicalDefense = physicalDefense, magicalDefense = magicalDefense, } return playerInfo end Info(playerName,[rest of the stats]) Is there a way to make it so that if i used the argument "playerName" for playerInfo the table is given the identifier "playerName" 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.

http://stackoverflow.com/comment/136022655
type: Comment
comment on: http://stackoverflow.com/a/77157460
has text: Is there a way to keep clicking at 1-second intervals?
score: 0
type: AnswerComment

http://stackoverflow.com/a/77169282
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77167668
answers question: http://stackoverflow.com/q/77167668
has body: Your order of code seems to affect the results you actually expected. 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. To avoid such a situation, you would move the line explosion.Parent = part down to under the event listener. The same for your acid part, you'd only parent after you've set all the properties, including setting Anchored to true. 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. Consider reading the following article to learn more about how Roblox' task schedule prioritizes running your code.
score: 0

http://stackoverflow.com/comment/135903227
type: QuestionComment
comment on: http://stackoverflow.com/q/77091104
has text: In Lua 5.3+ you have `lua_geti` for integer indices. In Lua 5.2- you should use `lua_pushnumber + lua_gettable`
score: 2
type: Comment

post
tag name: post
tags question: http://stackoverflow.com/q/77070009
type: Tag

http://stackoverflow.com/comment/136108415
score: 2
comment on: http://stackoverflow.com/q/77206230
type: Comment
type: QuestionComment
has text: 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`?

http://stackoverflow.com/q/77198424
favorite count: 0
answer count: 0
upvote count: 2
type: Question
has body: When I press Left ctrl and then press shift walking, give speed even when I'm squatting 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) local UIS = game:GetService('UserInputService'); local key = Enum.KeyCode.LeftShift local ctrl = Enum.KeyCode.LeftControl local pl = game.Players.LocalPlayer; local char = script.Parent or pl.CharacterAdded:Wait(); local hum = char:WaitForChild('Humanoid'); local Move = 'rbxassetid://14908666655' local Idle = 'rbxassetid://14908644962' local Crouching = false; local Holding = false; local HoldCrouching = false; local function ResetAnimation(boolean) if boolean then script.CrouchAnimation.AnimationId = Move else script.CrouchAnimation.AnimationId = Idle end end local function ChangeState(boolean) if boolean then hum.WalkSpeed = 8 hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) local Anim = hum:LoadAnimation(script.CrouchAnimation) Anim:Play() else hum.WalkSpeed = 16 hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, true) for _,i in ipairs(hum.Animator:GetPlayingAnimationTracks()) do if i and i.Name == 'CrouchAnimation' then i:Stop() end end end end script:WaitForChild('CrouchAnimation').Changed:Connect(function() if Crouching then for _,i in ipairs(hum.Animator:GetPlayingAnimationTracks()) do if i and i.Name == 'CrouchAnimation' then i:Stop() end end local Anim = hum:LoadAnimation(script.CrouchAnimation) Anim:Play() else for _,i in ipairs(hum.Animator:GetPlayingAnimationTracks()) do if i and i.Name == 'CrouchAnimation' then i:Stop() end end end end) UIS.InputBegan:Connect(function(Input, proc) if proc then return; end if Input then if Input.KeyCode == ctrl then if not Crouching then Crouching = true; ChangeState(true) elseif Crouching and not Holding then Crouching = false; ChangeState(false) end end end end) UIS.InputEnded:Connect(function(Input, proc) if proc then return; end if Input then if Input.KeyCode…
has title: Crouch animation bug
type: UnansweredQuestion
score: 2
tagged with: roblox
downvote count: 0
tagged with: lua

http://stackoverflow.com/a/77189342
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77187410
answers question: http://stackoverflow.com/q/77187410
has body: I found the way, based also on the suggestion I got, but this is what I need: local template = "The title of this song is $title. $title was composed by $author in $date, when he have created the $project" for wildcard in string.gmatch(template,"%$(%w+)") do wildcard_ = '$'..wildcard val = API(wildcard_) -- or also API('$'..wildcard_) ... ... ... end

fivem
tags question: http://stackoverflow.com/q/77070009
type: Tag
tag name: fivem
tags question: http://stackoverflow.com/q/77341061
tags question: http://stackoverflow.com/q/77320606
tags question: http://stackoverflow.com/q/77329678
tags question: http://stackoverflow.com/q/77587456
tags question: http://stackoverflow.com/q/77603503
tags question: http://stackoverflow.com/q/77800090
tags question: http://stackoverflow.com/q/77892559
tags question: http://stackoverflow.com/q/77945609
tags question: http://stackoverflow.com/q/78111131
tags question: http://stackoverflow.com/q/78251628
tags question: http://stackoverflow.com/q/78367547
tags question: http://stackoverflow.com/q/78379717
tags question: http://stackoverflow.com/q/78468822
tags question: http://stackoverflow.com/q/78617004
tags question: http://stackoverflow.com/q/78598788
tags question: http://stackoverflow.com/q/78717540
tags question: http://stackoverflow.com/q/78629303
tags question: http://stackoverflow.com/q/79291948

http://stackoverflow.com/a/77083484
score: 0
type: Answer
has body: You can use my code if u can read it :P --Server Script local re=Instance.new("RemoteEvent",game.ReplicatedStorage) -- all abilities(except the ultimate)are not on cooldown at start of the game local ability_cds={ ["basicAttack"]=1, ["r"]=15, -- Skill1 (binded to button r with 15s cooldown) ["t"]=60 -- Ultimate ability } local ultcd=60 -- ultimate ability default cooldown local function ultcd_update(player,cd) re:FireClient(player,"t",5) end local ability={ ["basicAttack"]=function(player,combo) local hint=workspace:FindFirstChild"Message"or Instance.new("Hint",workspace) hint.Text="basicAttack x"..combo end, ["r"]=function(player,combo) -- Skill1 (binded to button r with 15s cooldown) end, ["t"]=function(player) --Ultimate ability(charging cd by kill not implemented) ultcd_update(player,5) -- use to decrease ultimate cooldown by 5seconds(example) end } local maxcombo=5 local function useAbility(ability_name,player,combo) ability[ability_name](player,combo) end local ability_combo,ability_cds2={},{} re.OnServerEvent:Connect(function(player,ability) if not ability or type(ability)~="string"then player:Kick()end local cd=ability_cds[ability] if not cd then player:Kick()end ability_cds2[player.Name]=ability_cds2[player.Name]or table.clone(ability_cds) local ability_cds=ability_cds2[player.Name] cd=ability_cds[ability] -- ultimate charging mechanism override: --(ult. cooldown will not decrease every second) if ability=="t"and cd==0 then ability_cds[ability]=ultcd useAbility("t",player,0) end -- if cd==0 then return end ability_cds[ability]=0 ability_combo[player.Name]=ability_combo[player.Name]or {} ability_combo[player.Name][ability]=ability_combo[player.Name][ability]or 0 if not(ability_combo[player.Name][ability]+1&gt;maxcombo) then ability_combo[player.Name][ability]+=1 else ability_combo[player.Name][ability]=1 end delay(cd,function() ability_cds[ability]=cd local combo=ability_combo[player.Name][ability] delay(cd,function() if combo==ability_combo[player.Name…
answers question: http://stackoverflow.com/q/77077778

http://stackoverflow.com/a/77157462
answers question: http://stackoverflow.com/q/77150797
score: 0
type: Answer
has body: You should look at the search capability of Redis Stack for this. You would use the FT.CREATE command to create a search index over part of the keyspace containing either Redis Hashes or Redis Stack JSON documents, then use the FT.SEARCH command to search for matches with a more SQL like syntax. This would allow you do to things like this (demo with hashes, you could also use JSON): Create some data: > hset data:1 value 1 data hello (integer) 2 > hset data:2 value 2 data world (integer) 2 > hset data:3 value 3 data how (integer) 2 > hset data:4 value 4 data are (integer) 2 > hset data:5 value 5 data you (integer) 2 Create an index over the data, here I'm indexing value as a number but you could also index data as a tag or full-text. > ft.create idx:data on hash prefix 1 data: schema value numeric sortable "OK" Search will now keep track of all changes to keys with prefix data: whose type is Hash. Now, I can do some searches and get data back. Everything where value is less then 3: > ft.search idx:data "@value:[-inf 2]" 1) "2" 2) "data:1" 3) 1) "value" 2) "1" 3) "data" 4) "hello" 4) "data:2" 5) 1) "value" 2) "2" 3) "data" 4) "world" Search that returns all indexed items: > ft.search idx:data "*" 1) "5" 2) "data:1" 3) 1) "value" 2) "1" 3) "data" 4) "hello" 4) "data:4" 5) 1) "value" 2) "4" 3) "data" 4) "are" 6) "data:3" 7) 1) "value" 2) "3" 3) "data" 4) "how" 8) "data:2" 9) 1) "value" 2) "2" 3) "data" 4) "world" 10) "data:5" 11) 1) "value" 2) "5" 3) "data" 4) "you" By default you'll get the first 10 and can paginate using LIMIT... let's get 2: > ft.search idx:data "*" LIMIT 0 2 1) "5" 2) "data:1" 3) 1) "value" 2) "1" 3) "data" 4) "hello" 4) "data:4" 5) 1) "value" 2) "4" 3) "data" 4) "are" If you only want certain parts of the data back use RETURN: > ft.search idx:data "*" LIMIT 0 2 RETURN 1 data 1) "5" 2) "data:1" 3) 1) "data" 2) "hello" 4) "data:4" 5) 1) "data" 2) "are" If you just want the keynames, use NOCONTENT: > ft.search idx:data "*" LIMIT 0 2 NOCONTENT 1) "5" 2…

http://stackoverflow.com/a/78475104
has body: According to the jdtls Java Compiler Options section you can set the value for java.settings.url to a settings file. require('lspconfig')['jdtls'].setup { root_dir = function(fname) return vim.fn.getcwd() end, cmd = { 'jdtls', '-vmargs', }, settings = { ['java.settings.url'] = '&lt;some path&gt;/settings.pref', } } Then, in the settings.pref add org.eclipse.jdt.core.compiler.taskTags= This worked for me. There might be a way to configure it without an additional file, but I couldn't figure it out.
type: Answer
answers question: http://stackoverflow.com/q/77165982
score: 0

http://stackoverflow.com/q/77094619
tagged with: roblox
tagged with: lua
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77100753
score: 0
has title: Roblox - Scripts not firing
has body: 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. game.StarterGui:SetCoreGuiEnabled(Enum. CoreGuiType. Backpack, false) local replicatedStorage = game.ReplicatedStorage local userInputService local toolFolder = replicatedStorage.ToolFolder local images = replicatedStorage.Images local uis = game:GetService("UserInputService") local player = game.Players.LocalPlayer local playergui = player.PlayerGui local inventory = playergui:WaitForChild("Inventory") local hotbar = inventory.Hotbar local inventoryFrame = inventory.Inventory local itemFrame = inventoryFrame.ScrollingFrame local hotbarTable = {} local inventoryTable = {} local insertedItems = {} local keyConversions = { [Enum.KeyCode.One] = 1, [Enum.KeyCode.Two] = 2, [Enum.KeyCode.Three] = 3, [Enum.KeyCode.Four] = 4, [Enum.KeyCode.Five] = 5, [Enum.KeyCode.Six] = 6, [Enum.KeyCode.Seven] = 7, [Enum.KeyCode.Eight] = 8, [Enum.KeyCode.Nine] = 9, [Enum.KeyCode.Zero] = 10, } local function pickSlot() for i, v in pairs(hotbarTable) do if v.Item == "None" then return i end end end local function addItem(item) local slot = pickSlot() if slot ~= nil then hotbarTable[slot].Item = item hotbarTable[slot].Count = 1 hotbarTable[slot].Image = images[item].Texture table.insert(insertedItems, item) elseif slot == nil then inventoryTable[item] = { Count = 1; Image = images[item].Texture } end end local function fillInventoryTables() for i = 1, 10 do hotbarTable[i] = { Item = "None"; Count = 0; Image = "None" } end for i, v in pairs(toolFolder:GetChildren()) do if #insertedItems > 0 then if table.find(insertedItems, v.Name) then for x, c in pairs(hotbarTable) do if c.Item == v.Name then c.Count += 1 end end else addItem(v.Name) end else addItem(v.Name) end end end local …
type: Question
has answer: http://stackoverflow.com/a/77100753
answer count: 1

http://stackoverflow.com/comment/136114779
score: 0
comment on: http://stackoverflow.com/q/77209867
type: QuestionComment
has text: Lua doesn't even have `++`, you should be grateful to be able to define functions in two ways.
type: Comment

http://stackoverflow.com/a/77156979
answers question: http://stackoverflow.com/q/77131035
score: 0
has body: You most likely have something capitalized that shouldn't be, or the other way around. I recommend temporarily sprinkling lots of print() statements around to see what all the values are, to easily tell where it's going wrong.
type: Answer

http://stackoverflow.com/comment/136073024
has text: 1246 -> 124.6 -> 125 -> 1250
comment on: http://stackoverflow.com/q/77186525
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136053734
type: AnswerComment
comment on: http://stackoverflow.com/a/77175650
score: 0
type: Comment
has text: 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` ?

logitech-gaming-software
type: Tag
tags question: http://stackoverflow.com/q/77219027
tag name: logitech-gaming-software
tags question: http://stackoverflow.com/q/77093640
tags question: http://stackoverflow.com/q/77381239
tags question: http://stackoverflow.com/q/77251948
tags question: http://stackoverflow.com/q/77572462
tags question: http://stackoverflow.com/q/77472284
tags question: http://stackoverflow.com/q/77536487
tags question: http://stackoverflow.com/q/77518115
tags question: http://stackoverflow.com/q/77765418
tags question: http://stackoverflow.com/q/77728192
tags question: http://stackoverflow.com/q/77837754
tags question: http://stackoverflow.com/q/77824896
tags question: http://stackoverflow.com/q/78143358
tags question: http://stackoverflow.com/q/78113574
tags question: http://stackoverflow.com/q/78247619
tags question: http://stackoverflow.com/q/78210282
tags question: http://stackoverflow.com/q/78246221
tags question: http://stackoverflow.com/q/78149365
tags question: http://stackoverflow.com/q/78503463
tags question: http://stackoverflow.com/q/78527511
tags question: http://stackoverflow.com/q/78715199
tags question: http://stackoverflow.com/q/78657809
tags question: http://stackoverflow.com/q/78766878
tags question: http://stackoverflow.com/q/78767378
tags question: http://stackoverflow.com/q/79010976
tags question: http://stackoverflow.com/q/79152996
tags question: http://stackoverflow.com/q/79393939
tags question: http://stackoverflow.com/q/79408191
tags question: http://stackoverflow.com/q/79491072

http://stackoverflow.com/a/77247495
has comment: http://stackoverflow.com/comment/136199695
has comment: http://stackoverflow.com/comment/136196909
accepted answer of: http://stackoverflow.com/q/77228934
has body: The problem with your code is you are trying to see if Workspace is plr.Character. You set char = hit.Parent then check if char.Parent == plr.Character - essentially checking if hit.Parent.Parent == plr.Charcter which it will not. I hope this helps!
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/77228934
downvote count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/136185403
score: 1

http://stackoverflow.com/a/77153991
downvote count: 0
score: 9
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77147995
type: Answer
answers question: http://stackoverflow.com/q/77147995
has body: Mason is a package manager that allows you to manage 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. 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 yamlfmt, you can create a file (e.g. ~/.config/nvim/lua/autocmds.lua) and add the following code: -- Create group to assign commands -- "clear = true" must be set to prevent loading an -- auto-command repeatedly every time a file is resourced local autocmd_group = vim.api.nvim_create_augroup("Custom auto-commands", { clear = true }) vim.api.nvim_create_autocmd({ "BufWritePost" }, { pattern = { "*.yaml", "*.yml" }, desc = "Auto-format YAML files after saving", callback = function() local fileName = vim.api.nvim_buf_get_name(0) vim.cmd(":!yamlfmt " .. fileName) end, group = autocmd_group, }) Then, ensure this file (autocmds.lua) is sourced every time you start Neovim by adding require("autocmds") to your ~/.config/nvim/init.lua file. Now, every time you write a buffer (BufWritePost) (i.e. save a file) ending with a .yaml or .yml extension, the callback will be made which gets the absolute path of the file loaded in the current buffer (nvim_buf_get_name(0)), and then executes a non-interactive terminal command that calls the YAML formatter on that file. To suppress the command's output, you add silent to the non-interactive terminal command: vim.cmd(":silent !yamlfmt " .. fileName) 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: vim.api.nvim_create_autocmd({ "BufWritePost" }, { pattern = { "*.py" }, desc = "Auto-format Python files after saving", callback = function() local fileName = vim.api.nvim_buf_get_name(0) vim.cmd(":silent !black --preview -…
upvote count: 9

http://stackoverflow.com/q/77120892
tagged with: neovim-plugin
answer count: 1
type: UnansweredQuestion
tagged with: neovim
score: 0
has answer: http://stackoverflow.com/a/77120893
has title: How can I load a NeoVim plugin with Packer conditionally from local or remote?
type: Question
tagged with: lua
has body: I am developing an experimental NeoVim plugin https://github.com/KaiWalter/azure-functions.nvim and want to load the local source code on the development system and load it remotely from repository on other machines. How can I achieve this?

http://stackoverflow.com/comment/136005527
comment on: http://stackoverflow.com/q/77148511
has text: @Oka I would say brief - hence this question, if it's doable to implement this foreach keyword with iterators/next.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/77221949
has comment: http://stackoverflow.com/comment/136137317
has comment: http://stackoverflow.com/comment/136143884
has comment: http://stackoverflow.com/comment/136153049
has body: I usually write myself a nifty little helper function for this called nilget (others may call this "delve"): local function nilget(value, ...) for i = 1, select("#", ...) do if value == nil then return nil end value = value[select(i, ...)] end return value end In your example, you could use this as nilget(hello, "this", "is", "a", "test"). If you want something more similar to the ?. operator many languages have for this, the closest construct you can get in Lua is (t or {}).k (which unfortunately, at least in PUC, seems to come at the runtime cost of allocating an empty table if t is falsey, so don't do this in performance-critical code). Your chain would be pretty verbose if written this way, though: (((((hello or {}).this or {}).is or {}).a or {}).test. There's also the option of modifying the metatable of nil using debug.setmetatable to just return nil on indexing. I am just including this for fun (and the sake of completeness); you should not do this in serious code: debug.setmetatable(nil, {__index = function() end}) After this, (nil).k will always be nil in your entire program (VM state), so your chain hello.this.is.a.test will evaluate without an error even if some items evaluate to nil.
score: 2
has comment: http://stackoverflow.com/comment/136137972
upvote count: 2
accepted answer of: http://stackoverflow.com/q/77221657
downvote count: 0
answers question: http://stackoverflow.com/q/77221657
has comment: http://stackoverflow.com/comment/136137298
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/136053750
comment on: http://stackoverflow.com/a/77175650
has text: @MateoVial Added a note about `select`.
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/a/77093869
has comment: http://stackoverflow.com/comment/135920732
has body: The printf-style OutputLogMessage requires that the arguments associated with the %d format specifier (and other numeric specifiers) be a number type (or be coercible to a number type - i.e., producing a non-nil value from tonumber). This function directly mirrors the string.format function, which can be easily tested: Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio > string.format('%d', 42) 42 > string.format('%d', '42') 42 > string.format('%d', nil) stdin:1: bad argument #2 to 'format' (number expected, got nil) stack traceback: [C]: in function 'string.format' stdin:1: in main chunk [C]: in ? > string.format('%d') stdin:1: bad argument #2 to 'format' (no value) stack traceback: [C]: in function 'string.format' stdin:1: in main chunk [C]: in ? During the "PROFILE_ACTIVATED" and "PROFILE_DEACTIVATED", OnEvent is passed a nil value as its second argument, and you are unconditionally passing it to OutputLogMessage as the argument associated with %d. You can guard against this in a few ways, including -- check that arg is truthy, choosing to display nothing if it is falsy (nil) if arg then OutputLogMessage("event = %s, arg = %d\n", event, arg) end or -- display a truthy arg, or a sentinel value otherwise OutputLogMessage("event = %s, arg = %d\n", event, arg or -1) As an aside, your mode_change is poor from a maintainability standpoint. Any time you find yourself enumerating variable names (lit. var_one, var_two, var_three, etc.) you should stop and ask yourself if there is not a more appropriate data structure to use. In Lua you have access to tables. Consider the following, condensed example where any time a G-button is pressed, keymap is reassigned to a new table, effectively setting all possible values of arg to nil, except for the current value of arg being set to the inverse of its previous value. (nil is falsy, equivalent to false for the purpose of conditional logic (if not x then, etc.).) Current values can be checked through indexing the table (i.e. keymap…
answers question: http://stackoverflow.com/q/77093640
has comment: http://stackoverflow.com/comment/135921571
has comment: http://stackoverflow.com/comment/135920154
has comment: http://stackoverflow.com/comment/135915519
has comment: http://stackoverflow.com/comment/135920119
has comment: http://stackoverflow.com/comment/135921004
has comment: http://stackoverflow.com/comment/135920731
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/135915346

http://stackoverflow.com/comment/136153049
comment on: http://stackoverflow.com/a/77221949
type: Comment
type: AnswerComment
has text: @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...
score: 0

http://stackoverflow.com/comment/136746725
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77553699
has text: 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).
type: AnswerComment

octave
tags question: http://stackoverflow.com/q/77119800
tag name: octave
type: Tag

http://stackoverflow.com/a/77175650
score: 5
has comment: http://stackoverflow.com/comment/136065733
answers question: http://stackoverflow.com/q/77175561
has comment: http://stackoverflow.com/comment/136067388
has body: In general, you can capture the values into a table local t = { foo() } but it may not be a sequence if the function returns nil values that create holes in the list. select may be used to choose where to begin capturing return values. -- capture the second return value and onwards local t = { select(2, foo()) } In Lua 5.2+, you also have access to table.pack(...), which Returns a new table with all arguments stored into keys 1, 2, etc. and with a field "n" with the total number of arguments. Note that the resulting table may not be a sequence, if some arguments are nil. The caveat about the resulting table not being a sequence means that looping over all the returned values may require a numeric for, instead of a generic one using ipairs. local function foo() return 'a', 'b', 'c', 'd', 'e' end local results = table.pack(foo()) for i = 1, results.n do print(results[i]) end a b c d e The opposite function is table.unpack. In Lua 5.1, you can polyfill table.pack as table.pack = function (...) local t = { ... } t.n = select('#', ...) return t end
has comment: http://stackoverflow.com/comment/136053734
has comment: http://stackoverflow.com/comment/136067863
accepted answer of: http://stackoverflow.com/q/77175561
downvote count: 0
type: AcceptedAnswer
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/136053750
has comment: http://stackoverflow.com/comment/136059865

arrays
tag name: arrays
tags question: http://stackoverflow.com/q/77091104
tags question: http://stackoverflow.com/q/77155984
type: Tag
tags question: http://stackoverflow.com/q/77252496
tags question: http://stackoverflow.com/q/77385301
tags question: http://stackoverflow.com/q/77325669
tags question: http://stackoverflow.com/q/77595211
tags question: http://stackoverflow.com/q/77639707
tags question: http://stackoverflow.com/q/78126689
tags question: http://stackoverflow.com/q/78262662
tags question: http://stackoverflow.com/q/78151700
tags question: http://stackoverflow.com/q/78221180
tags question: http://stackoverflow.com/q/78472564
tags question: http://stackoverflow.com/q/78890100
tags question: http://stackoverflow.com/q/78787625
tags question: http://stackoverflow.com/q/78931550
tags question: http://stackoverflow.com/q/78985612
tags question: http://stackoverflow.com/q/79024260
tags question: http://stackoverflow.com/q/79228105

encoding
type: Tag
tag name: encoding
tags question: http://stackoverflow.com/q/77138490

http://stackoverflow.com/comment/135920154
type: AnswerComment
score: 0
has text: So if I'm understanding this right, I should replace the line function onevent (event, arg) OutputLogMessage("event = %s, arg = %d\n", event, arg) To if arg then OutputLogMessage("event = %s, arg = %d\n", event, arg) end . Or OutputLogMessage("event = %s, arg = %d\n", event, arg or -1) after function onevent (event, arg) ?
type: Comment
comment on: http://stackoverflow.com/a/77093869

http://stackoverflow.com/comment/136011221
type: Comment
score: 0
type: QuestionComment
has text: Key for every second, if rate-limiting per second. Key for every minute, if rate-limiting per minute etc.
comment on: http://stackoverflow.com/q/77151783

logitech
tag name: logitech
tags question: http://stackoverflow.com/q/77189065
type: Tag
tags question: http://stackoverflow.com/q/77251948
tags question: http://stackoverflow.com/q/77518115
tags question: http://stackoverflow.com/q/77556950
tags question: http://stackoverflow.com/q/77472284
tags question: http://stackoverflow.com/q/77765418
tags question: http://stackoverflow.com/q/77728192
tags question: http://stackoverflow.com/q/77728982
tags question: http://stackoverflow.com/q/78215348
tags question: http://stackoverflow.com/q/78247619
tags question: http://stackoverflow.com/q/78246221
tags question: http://stackoverflow.com/q/78424147
tags question: http://stackoverflow.com/q/78715199
tags question: http://stackoverflow.com/q/78767378
tags question: http://stackoverflow.com/q/78894422
tags question: http://stackoverflow.com/q/79393939
tags question: http://stackoverflow.com/q/79408191
tags question: http://stackoverflow.com/q/79491072
tags question: http://stackoverflow.com/q/79478693

http://stackoverflow.com/comment/136011148
comment on: http://stackoverflow.com/q/77150890
type: Comment
has text: Explain why you need a delay? Dobyou want to mimic and actual api response? If so, this is the wrong way to do it.
score: 0
type: QuestionComment

max
tag name: max
type: Tag
tags question: http://stackoverflow.com/q/77093455

http://stackoverflow.com/comment/136027334
score: 0
type: QuestionComment
has text: 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)?
comment on: http://stackoverflow.com/q/77160885
type: Comment

http://stackoverflow.com/comment/136180485
score: 0
type: AnswerComment
has text: I did, I added my coordinates inside the parenthesis just like that. Also, it's not UDmi2 it's UDim2
comment on: http://stackoverflow.com/a/77183659
type: Comment

time-complexity
type: Tag
tag name: time-complexity
tags question: http://stackoverflow.com/q/77161193

http://stackoverflow.com/a/77157460
answers question: http://stackoverflow.com/q/77156207
has comment: http://stackoverflow.com/comment/136022996
type: Answer
has comment: http://stackoverflow.com/comment/136022655
has body: It repeats mouse click while mouse button 5 is pressed function OnEvent(event, arg) --OutputLogMessage("event = %s, arg = %s\n", event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then repeat MoveMouseTo(62487,39895) Sleep(50) PressMouseButton(1) Sleep(50) ReleaseMouseButton(1) Sleep(50) until not IsMouseButtonPressed(5) end end
score: 0

http://stackoverflow.com/comment/136028075
has text: 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).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77161193
type: Comment

http://stackoverflow.com/q/77179926
tagged with: lua
tagged with: com
tagged with: libreoffice
has answer: http://stackoverflow.com/a/77180499
answer count: 2
has answer: http://stackoverflow.com/a/77186853
has title: How to get number of cells in LibreOfficeCalc workspace using COM-object?
has body: 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: self._myLOCdoc = luacom.CreateObject("com.sun.star.ServiceManager") self._desktop = self._myLOCdoc:createInstance("com.sun.star.frame.Desktop") self._workbook = self._desktop:loadComponentFromURL("file:///" .. file_path, "_blank", 0, {ReadOnly = false}) self._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() But what to do next? If I were using MSExcel, I would do something like this: local user_range = self._worksheet.UsedRange --... local cell_cnt = user_range.Cells.count 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.
type: UnansweredQuestion
tagged with: libreoffice-calc
score: 0
type: Question

http://stackoverflow.com/comment/135915632
type: QuestionComment
comment on: http://stackoverflow.com/q/77097667
type: Comment
has text: 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?
score: 1

http://stackoverflow.com/comment/136019724
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/77156763
type: AnswerComment
score: 0

fluentd
tag name: fluentd
tags question: http://stackoverflow.com/q/77129551
type: Tag

http://stackoverflow.com/comment/136082137
comment on: http://stackoverflow.com/q/77189752
type: QuestionComment
score: 2
type: Comment
has text: Maybe try love.filesystem? Or you could use parameters.lua and a table for config instead.

http://stackoverflow.com/comment/136237768
comment on: http://stackoverflow.com/q/77097667
has text: Well, imagine using TMUX and you have split your window horizontally. I usually have lubarvim in upper half and terminal in a bottom part of a window. While Lunarvim is still open, I do `git pull` so the content of the files was changed. I was looking for some easy way to "refresh" all buffers in LunarVim to reflect the changes when git pull
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136016654
has text: 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)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77150165
score: 1

http://stackoverflow.com/comment/135920732
has text: 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)`.)
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77093869

optimization
tags question: http://stackoverflow.com/q/77161193
tag name: optimization
type: Tag
tags question: http://stackoverflow.com/q/77539566
tags question: http://stackoverflow.com/q/78392555

http://stackoverflow.com/comment/136137317
score: 3
type: AnswerComment
has text: `debug.setmetatable(nil, {__index = {}})` also works
comment on: http://stackoverflow.com/a/77221949
type: Comment

embedded
tag name: embedded
type: Tag
tags question: http://stackoverflow.com/q/77099924

http://stackoverflow.com/comment/136067388
has text: @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`.
comment on: http://stackoverflow.com/a/77175650
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/77189065
answer count: 1
has body: 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? This is the script: function OnEvent(event, arg) OutputLogMessage("event = %s, arg = %d\n", event, arg) if (event == "PROFILE_ACTIVATED") then EnablePrimaryMouseButtonEvents(true) elseif event == "PROFILE_DEACTIVATED" then ReleaseMouseButton(2) -- to prevent it from being stuck on end if (event == "MOUSE_BUTTON_PRESSED" and arg == 7) then recoil = not recoil end if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil) then if recoil then repeat Sleep(18) MoveMouseRelative(0,2) until not IsMouseButtonPressed(1) end end end I tried reinstalling Logitech Ghub several times including reboots, nothing changed. EDIT I added this at the top of my script, and it seems to have done the trick. EnablePrimaryMouseButtonEvents(true);
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77191876
tagged with: logitech
tagged with: lua
type: Question
has title: Ghub Lua script used to work, but all of a sudden stopped
accepted answer: http://stackoverflow.com/a/77191876

path
tags question: http://stackoverflow.com/q/77189752
type: Tag
tag name: path
tags question: http://stackoverflow.com/q/77810553
tags question: http://stackoverflow.com/q/78831855

http://stackoverflow.com/comment/136155124
type: Comment
score: 0
type: QuestionComment
has text: Yes, it is but ...
comment on: http://stackoverflow.com/q/77217545

kubernetes
type: Tag
tags question: http://stackoverflow.com/q/77141904
tag name: kubernetes
tags question: http://stackoverflow.com/q/77292433
tags question: http://stackoverflow.com/q/78366974
tags question: http://stackoverflow.com/q/78449716
tags question: http://stackoverflow.com/q/79039651

http://stackoverflow.com/comment/136153299
comment on: http://stackoverflow.com/q/77217545
has text: 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.
score: 0
type: QuestionComment
type: Comment

lua-patterns
tags question: http://stackoverflow.com/q/77116145
tags question: http://stackoverflow.com/q/77187410
type: Tag
tag name: lua-patterns
tags question: http://stackoverflow.com/q/77546645
tags question: http://stackoverflow.com/q/77899840
tags question: http://stackoverflow.com/q/77810553
tags question: http://stackoverflow.com/q/78243644
tags question: http://stackoverflow.com/q/78216065
tags question: http://stackoverflow.com/q/78319200
tags question: http://stackoverflow.com/q/78309427
tags question: http://stackoverflow.com/q/78490741
tags question: http://stackoverflow.com/q/78585507
tags question: http://stackoverflow.com/q/79356193
tags question: http://stackoverflow.com/q/79322739
tags question: http://stackoverflow.com/q/79478040

http://stackoverflow.com/a/77199844
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77189752
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/77189752
has body: It probably works when you do not move the .love file because it still has access to the original files from the working directory. Lua can not read content in zip files out of the box, but Love2d offers love.filesystem. It also has file wrappers, but if you just want to read the content prefer read: local content = love.filesystem.read(self.filename) Note that you can only read files in the love zip, in the working directory and in the save directory.
score: 1

http://stackoverflow.com/comment/135922526
type: Comment
score: 0
type: AnswerComment
has text: 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. Thank you, Paulo!
comment on: http://stackoverflow.com/a/77102075

http://stackoverflow.com/comment/136196909
score: 0
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/77247495
type: Comment

http://stackoverflow.com/comment/135920731
type: Comment
score: 0
has text: @HasanRaqib - Try `OutputLogMessage("event = %s, arg = %s\n", event, tostring(arg))`
type: AnswerComment
comment on: http://stackoverflow.com/a/77093869

http://stackoverflow.com/a/78000711
type: Answer
answers question: http://stackoverflow.com/q/77156921
has body: If you need to upload files to the ESP32 using the io-module use this branch of nodeMCU-Tools..serg3295 NodeMCU-Tool It took me hours of searching to find this. Its a command line tool, so not as easy to use as Chillipeppr or ESPlorer.
score: 0

http://stackoverflow.com/a/77120893
answers question: http://stackoverflow.com/q/77120892
score: 0
has body: I decided to use VIM API vim.fn.isdirectory to check whether the local directory is present. ... return require('packer').startup(function(use) use 'wbthomason/packer.nvim' -- My plugins here ... local user = os.getenv("USERNAME") local path = "/home/" .. user .. "/src/azure-functions.nvim" if vim.fn.isdirectory(path) ~= 0 then use { path, config = function() require("azure-functions").setup({}) end, } else use { "kaiwalter/azure-functions.nvim", config = function() require("azure-functions").setup({}) end, } end ... end) I was not able to achieve this with cond condition like use { path, opt = true, cond = function() return vim.fn.isdirectory(path) ~= 0, end, config = function() require("azure-functions").setup({}) end, } as the cond specification does not seem influence whether a package is installed or not.
type: Answer

http://stackoverflow.com/comment/136133883
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77205100
type: Comment

http://stackoverflow.com/a/77209938
has comment: http://stackoverflow.com/comment/136117922
answers question: http://stackoverflow.com/q/77209895
has body: local Target = {["Transparency"] = 1}
score: 0
type: Answer

http://stackoverflow.com/a/77116188
score: 0
has comment: http://stackoverflow.com/comment/135948475
has body: Thank @Nick, I use ^%d|[1-2]|.+$ works fine.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77116145
type: Answer
answers question: http://stackoverflow.com/q/77116145

http://stackoverflow.com/a/77183659
answers question: http://stackoverflow.com/q/77161382
score: 0
has body: You have use the dot &quot;.&quot; to get/set the properties of an UI element. In this case, buttonC = UDmi2.new() -- this sets the variable to UDmi2 position buttonC.Position = UDmi2.new() -- set the position of buttonC buttonO.Position = UDmi2.new(); Also, in line 19 you are missing the closing parenthesis.
has comment: http://stackoverflow.com/comment/136095458
has comment: http://stackoverflow.com/comment/136118905
has comment: http://stackoverflow.com/comment/136180485
type: Answer

http://stackoverflow.com/a/77209692
has body: local label=script.Parent local frame=label.Parent frame.Visible=false local function showText (text,delayBetweenChanges) frame.Visible=true label.Text="" for _,letter in ipairs(text:split"")do label.Text=label.Text..letter wait(delayBetweenChanges) end --frame.Visible=false end
score: 0
has comment: http://stackoverflow.com/comment/136116430
accepted answer of: http://stackoverflow.com/q/77209042
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/77209042

http://stackoverflow.com/comment/135921944
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/77099924
score: 1
type: QuestionComment

http://stackoverflow.com/comment/136052527
type: QuestionComment
has text: See https://create.roblox.com/docs/tutorials/scripting/basic-scripting/intro-to-scripting
score: 0
comment on: http://stackoverflow.com/q/77168568
type: Comment

com
tags question: http://stackoverflow.com/q/77179926
type: Tag
tag name: com
tags question: http://stackoverflow.com/q/77150165

http://stackoverflow.com/comment/135922329
type: Comment
score: 0
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77099924

unicode
tags question: http://stackoverflow.com/q/77119800
tag name: unicode
type: Tag
tags question: http://stackoverflow.com/q/78337661
tags question: http://stackoverflow.com/q/78309427

http://stackoverflow.com/a/77156278
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77134491
answers question: http://stackoverflow.com/q/77134491
downvote count: 0
type: AcceptedAnswer
type: Answer
score: 1
has body: This is a typical script that would have worked in Filtering Disabled. Though 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. 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. Consider using RemoteEvents to communicate between the client and server. 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)

http://stackoverflow.com/q/77156921
tagged with: nodemcu
score: 0
type: Question
tagged with: lua
answer count: 3
has title: Issue uploading Lua code to nodemcu on ESP32 due to missing file.open()
has answer: http://stackoverflow.com/a/77157363
has body: I'm trying to run nodemcu on an ESP32 (more memory than esp8266). I've build the firmware using the sources from https://github.com/nodemcu/nodemcu-firmware.git, the dev-esp32 branch. The build was done on a windows/WSL2/Ubuntu system. The firmware works, however I am having issues with uploading and saving lua files. I've tried various tools, for example http://chilipeppr.com/esp32. Functions like 'Heap' and 'Reset' work fine. However, uploading files fails. The console output is: file.open("unnamed1.lua", "w") file.writeline(print("Test")) file.writeline([[]]) file.close() node.compile("unnamed1.lua") > file.open("unnamed1.lua", "w") Lua error: stdin:1: attempt to call field 'open' (a nil value) stack traceback: stdin:1: in main chunk [C]: ? [C]: ? > file.writeline(print("Test")) Lua error: stdin:1: attempt to call field 'writeline' (a nil value) stack traceback: stdin:1: in main chunk [C]: ? [C]: ? > file.writeline([[]]) Lua error: stdin:1: attempt to call field 'writeline' (a nil value) stack traceback: stdin:1: in main chunk [C]: ? [C]: ? > file.close() Lua error: stdin:1: attempt to call field 'close' (a nil value) stack traceback: stdin:1: in main chunk [C]: ? [C]: ? > node.compile("unnamed1.lua") Lua error: stdin:1: cannot open unnamed1.lua: No such file or directory stack traceback: [C]: in function 'compile' stdin:1: in main chunk [C]: ? [C]: ? Apparently, ESP8266 nodemcu implements file.open() where ESP32 nodemcu doesn't (ESP32 seems to implement the Lua io lib instead). Am I having a build issue? I don't think so as https://nodemcu.readthedocs.io/en/dev-esp32/modules/file/ doesn't list file.open() Is there an issue with the upload tools failing to detect my ESP32? Upon reset, my firmware reports as: ''' NodeMCU ESP32 build unspecified powered by Lua 5.1.4 [5.1-doublefp] on IDF v4.4.3 ''' Any help is appreciated.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78000711
has answer: http://stackoverflow.com/a/78077052

http://stackoverflow.com/comment/136070608
type: AnswerComment
has text: 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 =(
comment on: http://stackoverflow.com/a/77180499
type: Comment
score: 0

http://stackoverflow.com/q/77115424
tagged with: prettier
tagged with: linux
score: 0
type: Question
tagged with: lua
has body: I am new to NeoVim ecosystem. I set up my config based from the ThePrimeage's video. After that I tried to install additional formatting using formatter.nvim package for NeoVim. This is how my formatter.lua file looks like: vim.cmd([[nnoremap <silent> <leader>fm :Format<CR>]]) local util = require("formatter.util") local function prettier() return { exe = "prettier", args = { "--write", "--config-precedence", "prefer-file", "--single-quote", "--no-bracket-spacing", "--prose-wrap", "always", "--arrow-parens", "always", "--trailing-comma", "all", "--no-semi", "--end-of-line", "lf", "--print-width", vim.bo.textwidth, "--stdin-filepath", vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), }, stdin = true, } end require("formatter").setup({ logging = true, log_level = vim.log.levels.WARN, filetype = { javascript = { prettier }, typescript = { prettier }, javascriptreact = { prettier }, typescriptreact = { prettier }, vue = { prettier }, ["javascript.jsx"] = { prettier }, ["typescript.tsx"] = { prettier }, markdown = { prettier }, css = { prettier }, json = { prettier }, jsonc = { prettier }, scss = { prettier }, less = { prettier }, yaml = { prettier }, graphql = { prettier }, html = { prettier }, reason = { function() return { exe = "refmt", stdin = true, } end, }, lua = { require("formatter.filetypes.lua").stylua, function() if util.get_current_buffer_file_name() == "special.lua" then return nil end return { exe = "stylua", args = { "--search-parent-directories", "--stdin-filepath", util.escape_path(util.get_current_buffer_file_path()), "--", "-", }, stdin = true, } end, }, go = { function() return { exe = "gofmt", args = { "-s", "-w", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) }, stdin = false, } end, }, c = { function() return { exe = "clang-format", args = { "-i", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0)) }, stdin = false, } end, }, rust = { function() return { exe = "rustfmt", args = { "--emit=stdout", "--edition=2018", vim.fn.fnameescape(vim.api.nvim_bu…
tagged with: ubuntu
has answer: http://stackoverflow.com/a/77946704
tagged with: neovim
answer count: 1
type: UnansweredQuestion
has title: 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?

ignite
tag name: ignite
tags question: http://stackoverflow.com/q/77151783
type: Tag

scribunto
tags question: http://stackoverflow.com/q/77131643
tag name: scribunto
type: Tag
tags question: http://stackoverflow.com/q/78805862

http://stackoverflow.com/comment/135948475
type: Comment
comment on: http://stackoverflow.com/a/77116188
type: AnswerComment
score: 0
has text: 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).

http://stackoverflow.com/tag/json
tag name: json
type: Tag
tags question: http://stackoverflow.com/q/77129551
tags question: http://stackoverflow.com/q/77240847
tags question: http://stackoverflow.com/q/77705072
tags question: http://stackoverflow.com/q/78317635
tags question: http://stackoverflow.com/q/78678246
tags question: http://stackoverflow.com/q/78717540
tags question: http://stackoverflow.com/q/79080682
tags question: http://stackoverflow.com/q/79328249

http://stackoverflow.com/a/77219943
type: AcceptedAnswer
type: Answer
score: 0
has body: So basically I just added a made a new model matrix from the existing one and manually set the position of it like so: mat4 TransModelMatrix = modelMatrix; TransModelMatrix[3][0] = InstData.x; TransModelMatrix[3][1] = InstData.y; TransModelMatrix[3][2] = InstData.z; mat4 ModelView = viewMatrix*-TransModelMatrix; ModelView[0][0] = 1; ModelView[0][1] = 0; ModelView[0][2] = 0; // Column 1: //ModelView[1][0] = 0; //ModelView[1][1] = 1; //ModelView[1][2] = 0; // Column 2: ModelView[2][0] = 0; ModelView[2][1] = 0; ModelView[2][2] = 1; relativeWorldPosition = projectionMatrix * -ModelView * (vertexPosition);
accepted answer of: http://stackoverflow.com/q/77168985
answers question: http://stackoverflow.com/q/77168985

http://stackoverflow.com/a/77109983
accepted answer of: http://stackoverflow.com/q/77099924
answers question: http://stackoverflow.com/q/77099924
type: AcceptedAnswer
type: Answer
upvote count: 1
has body: 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. 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. 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 "anything else" never blocks and runs quickly as necessary.
downvote count: 0
score: 1

http://stackoverflow.com/comment/135946302
score: 0
has text: 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`.
type: QuestionComment
comment on: http://stackoverflow.com/q/77115728
type: Comment

http://stackoverflow.com/comment/135880812
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77078238
has text: Replace `i = i + .1` with `i = math.floor((i + .1) * 10 + 0.5) / 10`
type: Comment

http://stackoverflow.com/comment/135922525
type: AnswerComment
comment on: http://stackoverflow.com/a/77102075
type: Comment
score: 0
has text: 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. The URLs are the ones that appear in the menu of a Quarto book. I 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.

http://stackoverflow.com/comment/135903341
score: 1
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/77091104
type: QuestionComment

cpanel
tags question: http://stackoverflow.com/q/77131643
tag name: cpanel
type: Tag

http://stackoverflow.com/a/78269956
has body: I had a similar issue but resolved it by finding the necessary "include" files from the include folder. I followed daurnimator's solution and it worked! As they said, you just need to point luarocks config variables.LUA_INCDIR: to where the files lauxlib.h, lua.h, ... , lualib.h are. However, we differ on how we installed Lua, so you might have to look elsewhere for your Includes. I downloaded mine from LuaBinaries. 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.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77182395

http://stackoverflow.com/comment/135959628
comment on: http://stackoverflow.com/q/77119800
has text: What exactly is the `command` in `io.popen()` ?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77232122
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/77217545
score: 1
accepted answer of: http://stackoverflow.com/q/77217545
upvote count: 1
has body: I hadn't realized that it was necessary to install fzf.vim as well.

http://stackoverflow.com/comment/135982559
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77129551
has text: 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

discord
tag name: discord
type: Tag
tags question: http://stackoverflow.com/q/77070009
tags question: http://stackoverflow.com/q/77587456

redis-scan
type: Tag
tag name: redis-scan
tags question: http://stackoverflow.com/q/77150797

while-loop
type: Tag
tags question: http://stackoverflow.com/q/77205227
tag name: while-loop
tags question: http://stackoverflow.com/q/79533393

http://stackoverflow.com/comment/135921004
type: Comment
has text: 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
comment on: http://stackoverflow.com/a/77093869
type: AnswerComment
score: 0

http://stackoverflow.com/comment/139926041
type: Comment
has text: 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).
comment on: http://stackoverflow.com/a/79347409
type: AnswerComment
score: 0

http://stackoverflow.com/a/77206367
has body: Like InSync stated, == is consistently returning false when comparing not var with check. ~= would be more suitable ie var ~= check. Brackets like not (var == check) could work too.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77206230
downvote count: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/77206230

http://stackoverflow.com/comment/135910444
score: 0
type: QuestionComment
type: Comment
has text: 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?
comment on: http://stackoverflow.com/q/77091104

http://stackoverflow.com/comment/135946692
score: 0
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/77102075
type: Comment

http://stackoverflow.com/q/77099924
accepted answer: http://stackoverflow.com/a/77109983
has comment: http://stackoverflow.com/comment/135923369
tagged with: stm32
has title: embedded eLua and C cooperative multitasking
has comment: http://stackoverflow.com/comment/135920684
has comment: http://stackoverflow.com/comment/135922329
tagged with: embedded
answer count: 1
has answer: http://stackoverflow.com/a/77109983
score: 0
has body: 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. 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. 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. 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. 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. 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. my question is basically if I can do something like this with eLua: int main() { initialize_everything(); load_script_from_memory(); while(1) { step_script(); step_other_logic(); if( has_new_script() ) { load_new_script(); } } } 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 a…
has comment: http://stackoverflow.com/comment/135927801
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/135942514
tagged with: lua
tagged with: scripting
has comment: http://stackoverflow.com/comment/135921944
type: Question

http://stackoverflow.com/a/77066682
score: 1
has comment: http://stackoverflow.com/comment/135861277
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77066681
answers question: http://stackoverflow.com/q/77066681
has body: You need to iterate over the table with ipairs, like so: function indexOf(tbl, value) for i, v in ipairs(tbl) do if v == value then return i end end end
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/135871308
has text: 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.
comment on: http://stackoverflow.com/q/77072924
type: Comment
score: 0
type: QuestionComment

rotation
type: Tag
tags question: http://stackoverflow.com/q/77152755
tag name: rotation

http://stackoverflow.com/a/77260907
answers question: http://stackoverflow.com/q/77206840
score: 0
has body: You probably need to WaitForChild(“PrimaryPart”) because if it tries to access it before it is loaded it will return nil thus your attempting nil with CFrame. Hope this helps!
type: Answer

http://stackoverflow.com/comment/136005208
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77148511
type: Comment
score: 1

http://stackoverflow.com/comment/136020360
type: Comment
comment on: http://stackoverflow.com/a/77156763
score: 0
type: AnswerComment
has text: @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". :)

http://stackoverflow.com/comment/135960013
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77119800
type: Comment
has text: @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.

http://stackoverflow.com/comment/136029959
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77161193
has text: 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).
type: Comment

http://stackoverflow.com/comment/136069943
type: Comment
comment on: http://stackoverflow.com/a/77180499
score: 0
type: AnswerComment
has text: Yes, I was able to translate it. But I got the number 1. And I expected 143.

http://stackoverflow.com/comment/136076307
score: 0
comment on: http://stackoverflow.com/a/77187467
has text: 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. As 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.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/135880325
type: QuestionComment
comment on: http://stackoverflow.com/q/77077778
has text: 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.
type: Comment
score: 0

http://stackoverflow.com/comment/135959656
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77121137
has text: Yes, SO can be used as a rubber duck :-)
score: 0

http://stackoverflow.com/comment/136078195
has text: @TormyVanCool it would have been useful to know that upfront, edited.
type: Comment
comment on: http://stackoverflow.com/a/77187467
type: AnswerComment
score: 0

http://stackoverflow.com/a/77222284
answers question: http://stackoverflow.com/q/77221746
downvote count: 0
score: 1
has body: Unlike C++ which has manual memory management, Lua is a garbage-collected language; you typically don't release memory by manually "destroying" 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 __gc metamethod appropriately. Now let's get back to your code: local circle = Circle.new(100) print(circle) -- prints: CircleMetaTable: PointerToCircle circle:destroy() -- destroy, this is where I want the circle to be set to nil print(circle) -- prints: userData: PointerToCircle (I want this to print nil) This is not possible. It is not possible to set a reference to nil from "under" the user (think about it: this would require Lua to have a "reverse lookup" 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 nil, Lua would have to change the values stored in a million places to nil). You can however set some internal data in your userdata to mark the circle as "destroyed", and you can write your __index 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). (*) 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 <close> annotation to release variables as they go out of scope using the __close metamethod; in older Lua versions you'd have to manually call :close().
type: Answer
upvote count: 1

http://stackoverflow.com/comment/135868600
type: Comment
has text: 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.
score: 0
comment on: http://stackoverflow.com/a/77070612
type: AnswerComment

love2d
tags question: http://stackoverflow.com/q/77189752
tags question: http://stackoverflow.com/q/77168985
tag name: love2d
type: Tag
tags question: http://stackoverflow.com/q/77252496
tags question: http://stackoverflow.com/q/77389377
tags question: http://stackoverflow.com/q/77711848
tags question: http://stackoverflow.com/q/77707868
tags question: http://stackoverflow.com/q/77930867
tags question: http://stackoverflow.com/q/77974071
tags question: http://stackoverflow.com/q/78208249
tags question: http://stackoverflow.com/q/78402894
tags question: http://stackoverflow.com/q/78390389
tags question: http://stackoverflow.com/q/78667335
tags question: http://stackoverflow.com/q/78595890
tags question: http://stackoverflow.com/q/78650171
tags question: http://stackoverflow.com/q/79218557
tags question: http://stackoverflow.com/q/79139400
tags question: http://stackoverflow.com/q/79112338
tags question: http://stackoverflow.com/q/79358608
tags question: http://stackoverflow.com/q/79246572
tags question: http://stackoverflow.com/q/79350389
tags question: http://stackoverflow.com/q/79455748
tags question: http://stackoverflow.com/q/79544735
tags question: http://stackoverflow.com/q/79460373
tags question: http://stackoverflow.com/q/79452139
tags question: http://stackoverflow.com/q/79544001

http://stackoverflow.com/comment/135905959
type: Comment
comment on: http://stackoverflow.com/q/77091104
has text: You are trying to read `_G["Tables.Effects"][value]` instead of `_G["Tables"].Effects[value]`
score: 3
type: QuestionComment

github-actions
tags question: http://stackoverflow.com/q/77115728
type: Tag
tag name: github-actions

http://stackoverflow.com/comment/136020051
type: AnswerComment
has text: 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?
comment on: http://stackoverflow.com/a/77156763
type: Comment
score: 0

http://stackoverflow.com/comment/136095458
has text: 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
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77183659
type: Comment

http://stackoverflow.com/comment/135987002
has text: Update. Solved the problem, just had to install the newest version of Scribunto, it works well now.
type: Comment
comment on: http://stackoverflow.com/q/77131643
score: 0
type: QuestionComment

http://stackoverflow.com/a/77171477
accepted answer of: http://stackoverflow.com/q/77105337
has body: The issue was that in the LUA script, I was calling splash:init_cookies(splash.args.cookies) in the start_requests method. By default, scrapy stores cookies in the cookie jar. When you call splash:init_cookies, 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. 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. Removing splash:init_cookies(splash.args.cookies) 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.
answers question: http://stackoverflow.com/q/77105337
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/136143884
comment on: http://stackoverflow.com/a/77221949
has text: Upvalues in Lua are very cheap. An upvalue costs almost as a local variable.
type: Comment
score: 0
type: AnswerComment

physics
type: Tag
tag name: physics
tags question: http://stackoverflow.com/q/77167668
tags question: http://stackoverflow.com/q/77581354
tags question: http://stackoverflow.com/q/78561649
tags question: http://stackoverflow.com/q/78575579

http://stackoverflow.com/comment/135871792
comment on: http://stackoverflow.com/q/77072924
type: QuestionComment
type: Comment
score: 2
has text: You should read a Lua tutorial about local variable's scope in Lua.

http://stackoverflow.com/comment/136011859
comment on: http://stackoverflow.com/q/77150165
score: 1
type: Comment
has text: 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
type: QuestionComment

lazy-evaluation
tags question: http://stackoverflow.com/q/77093640
type: Tag
tag name: lazy-evaluation
tags question: http://stackoverflow.com/q/78177017
tags question: http://stackoverflow.com/q/78831855

http://stackoverflow.com/q/77131035
has body: 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. Here is the tutorial for reference. Here is the code local greenFrame = script.Parent.Green local label = script.Parent.TextLabel local tweenService = game:GetService("TweenService") local info = TweenInfo.new(.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0) local lastHealth = 0 while wait(1) do if game.Players.LocalPlayer.Character then local currentHealth = math.floor(game.Player.LocalPlayer.Character.Humanoid.Health) local newFrameSize = UDim2.new(currentHealth/100,0,1,0) local tween = tweenService:Create(greenFrame,info,{Size=newFrameSize}) tween:Play() if currentHealth > lastHealth then for i = lastHealth, currentHealth, 1 do label.Text = tostring(i).."Hp" wait(1/(currentHealth-lastHealth)) end else for i = lastHealth, currentHealth, -1 do label.Text = tostring(i).."Hp" wait(1/(currentHealth-lastHealth)) end end lastHealth = currentHealth end end
type: Question
tagged with: game-development
has answer: http://stackoverflow.com/a/77156979
type: UnansweredQuestion
tagged with: roblox
tagged with: lua
has title: Why is my hp bar not working (should turn green and hp should go up) when i run my code?
answer count: 1
score: 0

http://stackoverflow.com/comment/136096515
type: Comment
has text: 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.
score: 0
comment on: http://stackoverflow.com/q/77170295
type: QuestionComment

input
tags question: http://stackoverflow.com/q/77100369
tag name: input
tags question: http://stackoverflow.com/q/77205227
type: Tag

http://stackoverflow.com/a/77156299
has body: 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.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/136022645
answers question: http://stackoverflow.com/q/77151783

webserver
tags question: http://stackoverflow.com/q/77150890
type: Tag
tag name: webserver
tags question: http://stackoverflow.com/q/77567066

http://stackoverflow.com/comment/136000318
type: Comment
has text: This appears to be bytecode, use a decompiler (e.g. luac or unluac) to read
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77138490

http://stackoverflow.com/comment/135946393
comment on: http://stackoverflow.com/q/77115728
type: Comment
score: 0
type: QuestionComment
has text: @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```).

http://stackoverflow.com/comment/136041551
has text: Worth noting, `ply` also acts as a table, and data can be written directly to it. eg. `ply.playerInjuries = ply.playerInjuries or {}`
type: QuestionComment
comment on: http://stackoverflow.com/q/77155984
type: Comment
score: 0

http://stackoverflow.com/comment/136082436
score: 0
type: QuestionComment
has text: Is `parameters.json` inside the zip archive?
type: Comment
comment on: http://stackoverflow.com/q/77189752

http://stackoverflow.com/comment/136137972
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77221949
has text: @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...
type: AnswerComment

syntax
tag name: syntax
tags question: http://stackoverflow.com/q/77209867
type: Tag
tags question: http://stackoverflow.com/q/78836865

http://stackoverflow.com/comment/136111286
type: AnswerComment
comment on: http://stackoverflow.com/a/77207097
has text: 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?
score: 0
type: Comment

argument-unpacking
type: Tag
tag name: argument-unpacking
tags question: http://stackoverflow.com/q/77175561
tags question: http://stackoverflow.com/q/79439624

rate-limiting
tag name: rate-limiting
tags question: http://stackoverflow.com/q/77151783
type: Tag

http://stackoverflow.com/comment/135960593
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/77119800
has text: Try `io.popen("LC_ALL=en_US.UTF-8 "..command)`
type: Comment

security
tags question: http://stackoverflow.com/q/77170295
tag name: security
type: Tag

ubuntu
type: Tag
tag name: ubuntu
tags question: http://stackoverflow.com/q/77150890
tags question: http://stackoverflow.com/q/77115424

windows-10
tags question: http://stackoverflow.com/q/77210020
type: Tag
tag name: windows-10
tags question: http://stackoverflow.com/q/77341991

http://stackoverflow.com/a/77405015
has comment: http://stackoverflow.com/comment/136506299
score: 0
type: Answer
has body: You can also deselect the loot option for greys in the bot menu and the bots won't loot them.
answers question: http://stackoverflow.com/q/77153081

http://stackoverflow.com/comment/136137298
type: Comment
comment on: http://stackoverflow.com/a/77221949
score: 0
type: AnswerComment
has text: `come at the runtime cost of allocating an empty table if t is falsey` - You can use pre-allocated single table instead of all `{}`

bresenham
tag name: bresenham
tags question: http://stackoverflow.com/q/77164011
type: Tag

http://stackoverflow.com/comment/136019772
type: AnswerComment
score: 0
has text: @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.
comment on: http://stackoverflow.com/a/77156763
type: Comment

http://stackoverflow.com/comment/135880136
has text: 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?
comment on: http://stackoverflow.com/q/77077778
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/77423449
has body: I believe it's just settings["my-mod-always-difficult"].value without the global. Then your removeAddedMusic function would need to be in the data stage, as the control stage can no longer modify the data global.
answers question: http://stackoverflow.com/q/77211174
type: Answer
score: 0

http://stackoverflow.com/comment/138357161
type: Comment
has text: 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).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78464858

http://stackoverflow.com/a/77186853
has body: I was given a solution here: https://ask.libreoffice.org/t/how-to-get-number-of-cells-in-libreofficecalc-workspace-using-com-object/96360/5 The answer suggested by JohnSUN is correct, but that's not how "true" and "false" work in Lua. You need to write it like this: local cursor = self._worksheet:createCursor() cursor:gotoEndOfUsedArea(1) local nCountCells = cursor:getRows():getCount() * cursor:getColumns():getCount() --143 local RCount = cursor:getRows():getCount() --11 local CCount = cursor:getColumns():getCount() --13
type: Answer
answers question: http://stackoverflow.com/q/77179926
has comment: http://stackoverflow.com/comment/136074503
score: 0

http://stackoverflow.com/comment/136115354
type: Comment
comment on: http://stackoverflow.com/q/77210020
has text: @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: Content-Length: 120 {"jsonrpc":"2.0","method":"$/status/report","params":{"text":"≡ƒÿ║Lua","tooltip":"Cached files: 0/0\nMemory usage: 2M"}}"
type: QuestionComment
score: 0

http://stackoverflow.com/comment/135920119
type: Comment
comment on: http://stackoverflow.com/a/77093869
score: 0
has text: @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 .
type: AnswerComment

lua-table
tags question: http://stackoverflow.com/q/77148511
tag name: lua-table
tags question: http://stackoverflow.com/q/77077148
tags question: http://stackoverflow.com/q/77066681
type: Tag
tags question: http://stackoverflow.com/q/77121137
tags question: http://stackoverflow.com/q/77243944
tags question: http://stackoverflow.com/q/77301309
tags question: http://stackoverflow.com/q/77438652
tags question: http://stackoverflow.com/q/77427482
tags question: http://stackoverflow.com/q/77595211
tags question: http://stackoverflow.com/q/77464631
tags question: http://stackoverflow.com/q/77849932
tags question: http://stackoverflow.com/q/77930867
tags question: http://stackoverflow.com/q/77838818
tags question: http://stackoverflow.com/q/78030461
tags question: http://stackoverflow.com/q/78274204
tags question: http://stackoverflow.com/q/78175954
tags question: http://stackoverflow.com/q/78239786
tags question: http://stackoverflow.com/q/78221219
tags question: http://stackoverflow.com/q/78160089
tags question: http://stackoverflow.com/q/78185511
tags question: http://stackoverflow.com/q/78379717
tags question: http://stackoverflow.com/q/78360664
tags question: http://stackoverflow.com/q/78390389
tags question: http://stackoverflow.com/q/78472564
tags question: http://stackoverflow.com/q/78532534
tags question: http://stackoverflow.com/q/78739507
tags question: http://stackoverflow.com/q/78736450
tags question: http://stackoverflow.com/q/78836865
tags question: http://stackoverflow.com/q/78765913
tags question: http://stackoverflow.com/q/78863937
tags question: http://stackoverflow.com/q/78890100
tags question: http://stackoverflow.com/q/79104155
tags question: http://stackoverflow.com/q/79091521
tags question: http://stackoverflow.com/q/79080682
tags question: http://stackoverflow.com/q/79179000
tags question: http://stackoverflow.com/q/79228627
tags question: http://stackoverflow.com/q/79267808
tags question: http://stackoverflow.com/q/79383237
tags question: http://stackoverflow.com/q/79366750
tags question: http://stackoverflow.com/q/79398465
tags question: http://stackoverflow.com/q/79465076
tags question: http://stackoverflow.com/q/79544120

http://stackoverflow.com/comment/135915519
has text: I've updated GHub. Indeed, in version 2023.7 `nil` is passed.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77093869

dictionary
type: Tag
tags question: http://stackoverflow.com/q/77093455
tag name: dictionary
tags question: http://stackoverflow.com/q/77255197
tags question: http://stackoverflow.com/q/78974887

http://stackoverflow.com/comment/135863856
comment on: http://stackoverflow.com/q/77066681
score: 0
type: QuestionComment
has text: If you know and there is already answer on SO, then why?
type: Comment

http://stackoverflow.com/comment/136059865
type: Comment
score: 0
has text: 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.
comment on: http://stackoverflow.com/a/77175650
type: AnswerComment

http://stackoverflow.com/a/77073363
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/77072924
has comment: http://stackoverflow.com/comment/135904891
upvote count: 5
type: Answer
has body: There are several issues with the loop that need to be fixed to make it work: local function between(a, b) local table = {} while a &gt; 0 do -- local a = 1 -- this is not needed, as it: -- (1) creates a *new* `a` value, which shadows the original value without changing it -- (2) is reset every loop iteration without any impact on the `a` value above table[a] = a -- local a = a + 1 -- this creates yet another `a` variable that is only visible -- inside the loop, so doesn't have any impact on the `while` condition -- since you already have the number of iterations you want to do (`a`) -- you can simply keep subtracting from it until it reaches 0: a = a - 1 end -- it's better to return the value, as you may do something other than printing return table end This should work, but in those cases when you know the number of iterations, it's better to use the for loop instead of the while loop, as it takes care of increasing/decreasing your loop variable: local tbl = {} for i = 1, a do tbl[i] = i end return tbl You should avoid using table as a variable name, as it clashes with the table value already provided by Lua.

http://stackoverflow.com/comment/135955764
comment on: http://stackoverflow.com/q/77121137
has text: 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?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136185403
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77247495
has text: thank u for the feedback but i cant understand it much ;w; like how did i compare workspace from plr.character haha im reallyyyyy sorryyy i dont seem to understand
type: AnswerComment

http://stackoverflow.com/comment/136734582
type: Comment
score: 0
has text: 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!
comment on: http://stackoverflow.com/a/77553699
type: AnswerComment

http://stackoverflow.com/comment/136070500
type: AnswerComment
has text: 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()`
comment on: http://stackoverflow.com/a/77180499
score: 1
type: Comment

character-encoding
type: Tag
tags question: http://stackoverflow.com/q/77138490
tag name: character-encoding
tags question: http://stackoverflow.com/q/78213846

cmake
tags question: http://stackoverflow.com/q/77115728
type: Tag
tag name: cmake

nginx-config
tags question: http://stackoverflow.com/q/77150890
tag name: nginx-config
type: Tag
tags question: http://stackoverflow.com/q/78778829

iterable-unpacking
tags question: http://stackoverflow.com/q/77175561
tag name: iterable-unpacking
type: Tag

stm32
tag name: stm32
tags question: http://stackoverflow.com/q/77099924
type: Tag

quarto
tags question: http://stackoverflow.com/q/77101884
type: Tag
tag name: quarto
tags question: http://stackoverflow.com/q/77550367
tags question: http://stackoverflow.com/q/77817799
tags question: http://stackoverflow.com/q/77882406
tags question: http://stackoverflow.com/q/78343371
tags question: http://stackoverflow.com/q/78531833
tags question: http://stackoverflow.com/q/78563147
tags question: http://stackoverflow.com/q/78563491
tags question: http://stackoverflow.com/q/78704192
tags question: http://stackoverflow.com/q/78899163
tags question: http://stackoverflow.com/q/79140278

http://stackoverflow.com/a/77110280
has body: 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. As for the MoveTo method, it only accepts at max two arguments. Modifying your code, it would look like so: zombieHumanoid:MoveTo(Vector3.new(zombieTorso.Position + Vector3.new(-50, 50, 0),0,Vector3.new(-50,50, 0))) 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. Related documentation: MoveTo documentation Vector3 documentation
score: 0
answers question: http://stackoverflow.com/q/77073753
type: Answer

redis
tags question: http://stackoverflow.com/q/77150797
type: Tag
tag name: redis
tags question: http://stackoverflow.com/q/77340179
tags question: http://stackoverflow.com/q/77270819
tags question: http://stackoverflow.com/q/77533955
tags question: http://stackoverflow.com/q/77566514
tags question: http://stackoverflow.com/q/78002123
tags question: http://stackoverflow.com/q/78068038
tags question: http://stackoverflow.com/q/78001723
tags question: http://stackoverflow.com/q/77994508
tags question: http://stackoverflow.com/q/78075230
tags question: http://stackoverflow.com/q/78074908
tags question: http://stackoverflow.com/q/78254595
tags question: http://stackoverflow.com/q/78712098
tags question: http://stackoverflow.com/q/78606577
tags question: http://stackoverflow.com/q/78654335
tags question: http://stackoverflow.com/q/78770057
tags question: http://stackoverflow.com/q/78909274
tags question: http://stackoverflow.com/q/79149433
tags question: http://stackoverflow.com/q/79326633
tags question: http://stackoverflow.com/q/79504829

shader
tags question: http://stackoverflow.com/q/77168985
tag name: shader
type: Tag

http://stackoverflow.com/a/77153140
type: Answer
has body: The event is not registered properly. The syntax is cancel = RegisterPlayerEvent( event, function ) So you need to replace your last 2 lines by RegisterPlayerEvent( 27, OnLoot ) However, I suggest writing an SQL query that removes the grey items from the creature_loot_template and possibly other tables instead. A good way to debug scripts, is to add print 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.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/77153081
upvote count: 2

http://stackoverflow.com/tag/c
type: Tag
tag name: c
tags question: http://stackoverflow.com/q/77091104
tags question: http://stackoverflow.com/q/77325669
tags question: http://stackoverflow.com/q/77693740
tags question: http://stackoverflow.com/q/77709503
tags question: http://stackoverflow.com/q/77712275
tags question: http://stackoverflow.com/q/77761655
tags question: http://stackoverflow.com/q/77734716
tags question: http://stackoverflow.com/q/77719576
tags question: http://stackoverflow.com/q/77930478
tags question: http://stackoverflow.com/q/77922338
tags question: http://stackoverflow.com/q/77872527
tags question: http://stackoverflow.com/q/78126689
tags question: http://stackoverflow.com/q/78513980
tags question: http://stackoverflow.com/q/78481795
tags question: http://stackoverflow.com/q/78535770
tags question: http://stackoverflow.com/q/78774815
tags question: http://stackoverflow.com/q/78839677
tags question: http://stackoverflow.com/q/79021129
tags question: http://stackoverflow.com/q/79106182
tags question: http://stackoverflow.com/q/79481658
tags question: http://stackoverflow.com/q/79423689

http://stackoverflow.com/comment/136085173
type: Comment
score: 0
has text: 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 :-)
comment on: http://stackoverflow.com/a/77187467
type: AnswerComment

configuration
tag name: configuration
type: Tag
tags question: http://stackoverflow.com/q/77210020
tags question: http://stackoverflow.com/q/77495184
tags question: http://stackoverflow.com/q/79375093

webhooks
type: Tag
tag name: webhooks
tags question: http://stackoverflow.com/q/77070009

http://stackoverflow.com/comment/136018239
has text: please provide a minimal reproducible code snipped (as code block - put it between those ``` and not as picture)
type: Comment
comment on: http://stackoverflow.com/q/77155856
score: 0
type: QuestionComment

http://stackoverflow.com/a/78759864
score: 0
has body: On Fedora install lua-devel. (Probably similar on other ones)
type: Answer
answers question: http://stackoverflow.com/q/77182395

game-engine
type: Tag
tags question: http://stackoverflow.com/q/77167668
tag name: game-engine
tags question: http://stackoverflow.com/q/78411075
tags question: http://stackoverflow.com/q/78595890

http://stackoverflow.com/comment/135974956
comment on: http://stackoverflow.com/q/77131643
type: Comment
has text: Did you [install](https://www.mediawiki.org/wiki/LuaSandbox#Installation) it?
score: 0
type: QuestionComment

nvim-lspconfig
tag name: nvim-lspconfig
type: Tag
tags question: http://stackoverflow.com/q/77210020
tags question: http://stackoverflow.com/q/77666088
tags question: http://stackoverflow.com/q/77697425
tags question: http://stackoverflow.com/q/77888576
tags question: http://stackoverflow.com/q/79021308
tags question: http://stackoverflow.com/q/79107680
tags question: http://stackoverflow.com/q/79268224
tags question: http://stackoverflow.com/q/79353612

math
tag name: math
tags question: http://stackoverflow.com/q/77093455
type: Tag
tags question: http://stackoverflow.com/q/77904973
tags question: http://stackoverflow.com/q/77945374
tags question: http://stackoverflow.com/q/77939546
tags question: http://stackoverflow.com/q/78300144
tags question: http://stackoverflow.com/q/78302174
tags question: http://stackoverflow.com/q/78262990
tags question: http://stackoverflow.com/q/78214820
tags question: http://stackoverflow.com/q/78356582
tags question: http://stackoverflow.com/q/78575468
tags question: http://stackoverflow.com/q/78578434
tags question: http://stackoverflow.com/q/78582469
tags question: http://stackoverflow.com/q/79137049

lunarvim
tag name: lunarvim
tags question: http://stackoverflow.com/q/77097667
type: Tag
tags question: http://stackoverflow.com/q/78039187
tags question: http://stackoverflow.com/q/78370029

neovim-plugin
tags question: http://stackoverflow.com/q/77223892
tag name: neovim-plugin
type: Tag
tags question: http://stackoverflow.com/q/77120892
tags question: http://stackoverflow.com/q/77405690
tags question: http://stackoverflow.com/q/77287266
tags question: http://stackoverflow.com/q/77332794
tags question: http://stackoverflow.com/q/77517930
tags question: http://stackoverflow.com/q/77437533
tags question: http://stackoverflow.com/q/77697425
tags question: http://stackoverflow.com/q/77734506
tags question: http://stackoverflow.com/q/77769954
tags question: http://stackoverflow.com/q/77913819
tags question: http://stackoverflow.com/q/77852628
tags question: http://stackoverflow.com/q/77906120
tags question: http://stackoverflow.com/q/77850861
tags question: http://stackoverflow.com/q/78137732
tags question: http://stackoverflow.com/q/77973700
tags question: http://stackoverflow.com/q/78243000
tags question: http://stackoverflow.com/q/78433872
tags question: http://stackoverflow.com/q/78427362
tags question: http://stackoverflow.com/q/78325836
tags question: http://stackoverflow.com/q/78308549
tags question: http://stackoverflow.com/q/78375359
tags question: http://stackoverflow.com/q/78318512
tags question: http://stackoverflow.com/q/78581431
tags question: http://stackoverflow.com/q/78845415
tags question: http://stackoverflow.com/q/78765047
tags question: http://stackoverflow.com/q/78846295
tags question: http://stackoverflow.com/q/78958369
tags question: http://stackoverflow.com/q/79135054
tags question: http://stackoverflow.com/q/79084279
tags question: http://stackoverflow.com/q/79248704
tags question: http://stackoverflow.com/q/79275737
tags question: http://stackoverflow.com/q/79349925
tags question: http://stackoverflow.com/q/79402036

vim-fzf
tags question: http://stackoverflow.com/q/77217545
type: Tag
tag name: vim-fzf

http://stackoverflow.com/a/77370216
has comment: http://stackoverflow.com/comment/136409336
has comment: http://stackoverflow.com/comment/136400465
answers question: http://stackoverflow.com/q/77355929
score: 0
has comment: http://stackoverflow.com/comment/136415119
has comment: http://stackoverflow.com/comment/136423066
has body: I'm not sure how startPosition is created, as I do not see it in your code snippet. However, you don't have to calculate anything. The RaycastResult, which you call "raycast" in your code holds the property "Position" (raycast.Position), this returns the Vector3 position value where the raycast hit. This position can directly be used to place the ball instance there.
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/136419185
accepted answer of: http://stackoverflow.com/q/77355929
has comment: http://stackoverflow.com/comment/136411947

http://stackoverflow.com/comment/136260817
type: AnswerComment
score: 0
has text: M bbas Haider Taqvi i changed it and tested but it stil does not work so that isnt the only problem aperently
type: Comment
comment on: http://stackoverflow.com/a/77291806

http://stackoverflow.com/q/77388159
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/77403013
answer count: 2
has answer: http://stackoverflow.com/a/77403013
has comment: http://stackoverflow.com/comment/136436794
has comment: http://stackoverflow.com/comment/136439657
type: Question
has title: 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?
tagged with: go
downvote count: 0
accepted answer: http://stackoverflow.com/a/77414996
score: 2
tagged with: lua
has answer: http://stackoverflow.com/a/77414996
upvote count: 2
has body: 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? function calling_this_function_would_be_required(predefined_table) print(predefined_table["something"]) end The IMAP server Dovecot does provide something like the above: https://doc.dovecot.org/configuration_manual/authentication/lua_based_authentication/#examples 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. Having a table set global is easy (L.SetGlobal(...)), but how do I add it to a expected function? Adding some function in Go func CallMe(L *lua.LState) { // How do I add a table as argument?? } func Foo() { L := NewState() defer L.Close() t := L.NewTable() t.RawSetString("example", lua.LString("some_value")) // I do not want a global table. I would like an expected Lua function that has _this_ table as argument L.SetGlobal("predefined_table", t) // Not even sure with his... L.SetGlobal("calling_this_function_is_required", L.NewFunction©llMe)) } If someone could enlight me a bit that would be great :-) Thanks in advance
favorite count: 0

http://stackoverflow.com/q/77405690
has answer: http://stackoverflow.com/a/79085480
favorite count: 0
upvote count: 2
has title: Astronvim: how to install neotest-jest?
tagged with: lua
type: Question
has body: Maybe somebody knows how to add neotes-jest to neotest configuration inside AstroNvim? P.S. Documentation didn't help
tagged with: neovim-plugin
type: UnansweredQuestion
score: 2
tagged with: neovim
downvote count: 0
answer count: 1

http://stackoverflow.com/q/77302144
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/77763154
has title: How to get circumcircle midpoint and radius in Lua?
favorite count: 0
tagged with: radius
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136278934
type: Question
downvote count: 0
has body: I've tried to make a function in Lua to get the circumcircle, circumcenter and radius, but something goes wrong: local function getCircumcircle (x1, y1, x2, y2, x3, y3) local d = 2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)) local t1, t2, t3 = x1*x1+y1*y1, x2*x2+y2*y2, x3*x3+y3*y3 local x = (t1*(y2-y3)+t2*(y3-y1)+t3*(y1-y2))/d local y = (t1*(x3-x2)+t2*(x1-x3)+t3*(x2-x1))/d local radius = math.sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y)) end
tagged with: lua
accepted answer: http://stackoverflow.com/a/77763154
score: 1
tagged with: geometry

http://stackoverflow.com/q/77384795
has title: Write a function to shuffle a given list. Make sure that all permutations are equally probable
has answer: http://stackoverflow.com/a/77384992
tagged with: shuffle
has comment: http://stackoverflow.com/comment/136425015
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/136426039
score: 2
tagged with: lua
tagged with: fisher-yates-shuffle
has body: Whilst reading Programming in Lua book, I came across an exercise which I'm not sure if I solved right, hence I wanted to ask you all. Problem statement: Exercise 6.4: Write a function to shuffle a given list. Make sure that all permutations are equally probable. Background: I've very basic mathematical and programmings knowledge 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 Fisher-Yates Shuffle which I think led me to a "working" solution. My ask: 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 unequal probabilities? One thing I noticed is if I add math.randomseed(1) (or, any other fixed number) in the getShuffledList function, I always get the same results, no matter how many times I try to shuffle the list. Why does that happen? My solution: local printList = function (a) for _, value in ipairs(a) do io.write(value, " ") end print() end local interchangeElements = function(list, i , j) local temp temp = list[i] list[i] = list[j] list[j] = temp return list end local getShuffledList = function(list) -- math.randomseed(1) --> gives constant shuffled list on each call local j for i = #list, 1, -1 do j = math.random(1, #list) interchangeElements(list, i, j) end return list end printList(getShuffledList({1, 2, 3, 4})) printList(getShuffledList({1, 2, 3, 4})) printList(getShuffledList({1, 2, 3, 4})) printList(getShuffledList({1, 2, 3, 4})) Output: 3 2 4 1 3 4 2 1 4 3 1 2 1 2 3 4 [Process exited 0]
answer count: 1
accepted answer: http://stackoverflow.com/a/77384992
favorite count: 0
has comment: http://stackoverflow.com/comment/136426038
has comment: http://stackoverflow.com/comment/136424994
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/a/77244053
answers question: http://stackoverflow.com/q/77243944
type: AcceptedAnswer
type: Answer
upvote count: 3
score: 3
downvote count: 0
has body: You are checking if those exist as keys. You should be checking if they exist as values. You can change the function to this function inTable(t,e) for k,v in pairs(t) do if v == e then return true end end return false end Also, in case you didn't know local table_ = {"A","B"} is equivalent to local table_ = {[1] = "A", [2] = "B"}
accepted answer of: http://stackoverflow.com/q/77243944

http://stackoverflow.com/comment/136284477
type: Comment
has text: Try passing only 8 bytes for the length instead of `offset+8`, e.g., `rtcp_dissector:call(buffer(offset, 8):tvb(), pinfo, subtree)`.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77302646

http://stackoverflow.com/comment/136320217
score: 2
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77325669
type: Comment

http://stackoverflow.com/q/77320254
has title: How can I sunstract ONE value (z) from two vector3's between them?
score: 0
type: AnsweredQuestion
answer count: 2
has body: 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 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. local direction = (endPosition - startPosition).Unit * range --I want to subtract the Z value of this vector3... if raycast then local sth = raycast.Instance.Position --...with the Z value of this other one... local mod = vector3(Xdirval, Ydirval, Zmodval) --...and create this supossed new vector3, with the X and Y values of the "direction"'s vector3. end 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)
type: Question
possible better answer: http://stackoverflow.com/a/77325537
tagged with: vector
tagged with: lua
has answer: http://stackoverflow.com/a/77320646
accepted answer: http://stackoverflow.com/a/77320646
tagged with: roblox
has answer: http://stackoverflow.com/a/77325537

http://stackoverflow.com/q/77311853
tagged with: vim
has answer: http://stackoverflow.com/a/77533350
tagged with: lua
has title: Neovim - Conditional colorschemes
accepted answer: http://stackoverflow.com/a/77533350
tagged with: neovim
downvote count: 0
answer count: 1
score: 1
has body: The Objective I want to set a specific config for a plugin if a certain colorscheme is applied at startup. What I tried If vim.cmd("colorscheme") == "oxocarbon" then print("this is oxocarbon") else print("this isn't oxocarbon") end The problem Everytime I open neovim the theme oxocarbon loads, but the return is "this isn't oxocarbon". Minimal config - init.lua require('lazy').setup({ { import = "plugins.core" } -- oxocarbon get installed and loaded }) require("macros") -- the if statement Note After VimEnter, when I type the command :lua vim.cmd("colorscheme") (or simply :colorscheme), it returns "oxocarbon" (Which is the configured theme loaded during VimEnter)
favorite count: 0
type: AnsweredQuestion
type: Question
upvote count: 1

openssl
tags question: http://stackoverflow.com/q/77265289
tag name: openssl
type: Tag

http://stackoverflow.com/comment/136429491
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/77384048
type: Comment
score: 0

http://stackoverflow.com/q/77320606
tagged with: lua
tagged with: fivem
answer count: 1
type: UnansweredQuestion
score: 0
has title: Lua variable ambient invoked by another file
type: Question
has answer: http://stackoverflow.com/a/77328286
has body: 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. I have declared the following variable: local spawnWaterZone = { vector3(3529.44, 3697.76, 20.99), vector3(3520.59, 3674.07, 20.99), } and I have the following piece of code: &lt;!-- language:lua--&gt; RegisterNetEvent('humaneHeist:guardsN', function(spawnzoneData) spawnzone = spawnzoneData.arg1 guardsN = spawnzoneData.arg2 for i=guardsN, 1, -1 do guardID = CreatePed(30, -1275859404, spawnzone[i], 0, true, false) print(spawnzone[i] .. ' is the coords') allGuards[#allGuards+1] = guardID end TriggerClientEvent('humaneHeist:guards', -1, allGuards) end) 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 read it: arg1 = 'spawnWaterZone', 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. but if i simply define RegisterNetEvent('humaneHeist:guardsN', function(spawnzoneData) spawnzone = spawnWaterZone the loop works normally and go through the vectors. Any ideas on why it happens?

http://stackoverflow.com/comment/136197489
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77247864
has text: 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. Please paste the full code and include the complete error message (including line number)
score: 0

http://stackoverflow.com/comment/136327286
comment on: http://stackoverflow.com/a/77326403
has text: 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.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/136425001
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77385301
has text: 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'}`?

http://stackoverflow.com/a/77255380
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/77255197
score: 2
accepted answer of: http://stackoverflow.com/q/77255197
upvote count: 2
has body: Where are the pairs "1 , secondBool" and "2, false" coming from? From here: local newTable = {boolName, false,} This is equivalent to local newTable = {} newTable[1] = boolName newTable[2] = false What is a better way to write a function to change a value in dictionary? If you want to mutate the table: Just boolValues[boolName] = state. No need for a function (note that due to proxy tables with __index and __newindex metamethods, this also isn't a problem if you decide that you need to hook this later on). If you want to create a mutated copy, first copy, then mutate. A simple shallowcopy would be: local function shallowcopy(t) local copy = {} for k, v in pairs(t) do copy[k] = v end return copy end
downvote count: 0

http://stackoverflow.com/q/77283313
has body: 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. I've tried the following but its not working. keymap.set("n", "<C-k>", "7k", {remap = true, silent = true}) keymap.set("n", "<C-j>", "7j", {remap = true, silent = true}) Using something like keymap.set("n", "<C-a>", "7j", {remap = true, silent = true}) works, but its not wat I want. Feels like there are some other keybindings in the way blocking ctrl+k and ctrl+j.
answer count: 1
type: UnansweredQuestion
tagged with: neovim
score: 0
has answer: http://stackoverflow.com/a/77307361
has title: Neovim: Can't bind ctrl+j to 7j or ctrl+k 7k using neovim with lua and iterm2
type: Question
tagged with: lua
tagged with: iterm2

http://stackoverflow.com/comment/136321497
has text: @Oka - Perhaps I missed something, where is the C++ outside of the comments?
comment on: http://stackoverflow.com/a/77326403
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/77384992
accepted answer of: http://stackoverflow.com/q/77384795
answers question: http://stackoverflow.com/q/77384795
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: Is my solution right? 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. Let's call the length of the list n. In each iteration of your loop, you choose a number between 1 and n. There are n iterations, so there are n^n equally likely ways that all the numbers can be chosen. The number of permutations of the list is n factorial. (Except in trivial small cases), there is no way to divide n factorial permutations evenly into the n^n outcomes, thus it is impossible for all the permutations to be equally likely. For example with n=4, 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. To get the proper Fisher-Yates algorithm, change j = math.random(1, #list) to j = math.random(1, i). This means that the previous counterargument no longer applies: the first random number is from 1 to n, then 1 to n - 1, etc. So, the number of ways the random numbers can be chosen is also n 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). One thing I noticed is if I add math.randomseed(1) [...], I always get the same results[...] Why does that happen? math.random 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 "pseudo-random"). math.randomseed sets the hidden internal state. Be…
score: 2
downvote count: 0

http://stackoverflow.com/q/77287266
answer count: 2
upvote count: 1
tagged with: neovim-plugin
favorite count: 0
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/77321912
tagged with: lua
type: Question
has answer: http://stackoverflow.com/a/77321912
has body: I was following this tutorial here to set up NeoVim: https://www.youtube.com/watch?v=J9yqSdvAKXY However, it doesn't work and throws a weird error that I don't understand and can't find anything on google for. I know that this tutorial is for Linux, but I followed another tutorial for windows with the same results. Restarting/-installing Neovim does not solve the issue. Environment I am working on Windows 11 (22H2) with NeoVim 0.9.2. NeoVim does start (and Packer installed the plugins), but with an error in the lua scripts. My structure inside the nvim folder is this: (Why the icons are not working is another question...) Error The error I am getting is: E5113: Error while calling lua chunk: vim/_init_packages.lua:21: ...r1\AppData\Local\nvim/lua/core/plugin_config/gruvbox.lua:1: '=' expected stack traceback: [C]: in function 'error' vim/_init_packages.lua:21: in function <vim/_init_packages.lua:15> [C]: in function 'require' ...user1\AppData\Local\nvim/lua/core/plugin_config/init.lua:2: in main chunk [C]: in function 'require' C:\Users\user1\AppData\Local\nvim\init.lua:6: in main chunk If you scroll down to lua/core/plugin_config/init.lua, you will se that the require parts throw this error, but if I paste the contents of the config scripts (lua/core/plugin_config/*.lua) in lua/core/plugin_config/init.lua, it runs without errors. Also, when I leave the gruvbox.lua, lualine.lua or nvim-tree.lua files empty, almost the same error occurs: E5113: Error while calling lua chunk: vim/_init_packages.lua:21: ...r1\AppData\Local\nvim/lua/core/plugin_config/gruvbox.lua:1: '=' expected near '<eof>' stack traceback: [C]: in function 'error' vim/_init_packages.lua:21: in function <vim/_init_packages.lua:15> [C]: in function 'require' ...user1\AppData\Local\nvim/lua/core/plugin_config/init.lua:2: in main chunk [C]: in function 'require' C:\Users\user1\AppData\Local\nvim\init.lua:6: in main chunk Code-ZIP https://drive.google.com/file/d/188hEJQOvcrS7G3zwBgOxKq91adIEpQli/view?usp=s…
possible better answer: http://stackoverflow.com/a/77295794
tagged with: neovim
has answer: http://stackoverflow.com/a/77295794
has title: NeoVim nested require throws errors
score: 1

http://stackoverflow.com/comment/136287273
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77302646
type: Comment
has text: 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?

http://stackoverflow.com/comment/136437279
type: Comment
comment on: http://stackoverflow.com/q/77391686
type: QuestionComment
has text: @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?
score: 0

http://stackoverflow.com/q/77243944
favorite count: 0
has comment: http://stackoverflow.com/comment/136176381
type: AnsweredQuestion
has body: I made a program, which checks if in table has (for example) "A" and a "B" in itself. But it doesn't works. Here's code: function inTable(t,e) return t[e] ~= nil end --Example local table_ = {"A","B"} if inTable(table_,"A") and inTable(table_,"B") then --Do some stuff end Please, help me. I tried everything but it still doesn't work.
has answer: http://stackoverflow.com/a/77244053
score: 2
accepted answer: http://stackoverflow.com/a/77244053
type: Question
downvote count: 0
tagged with: lua
tagged with: lua-table
has title: How to check in Lua if there are multiple elements in a table?
upvote count: 2
answer count: 1

http://stackoverflow.com/q/77280566
linked to: http://stackoverflow.com/q/36489928
answer count: 1
has body: 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. When 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). What I don´t want is to pre initialize all possible state. I only want to ask in lua for example: if(table.player.killedEnemys > 5) then //calls a c-function that loads the given Text to display and the follow up function when clicked PresentOption("Try to impress opponent.", "show_off_to_soldier") end 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: function newindex_metamethod(t,i, v) rawset(t, i, v) end function index_metamethod(t,i) t[i] = 0 end But I encounter an error by the line of the if-condition, saying: attempt to index a nil value (field 'player') when player is also not existing in the table so far. I thought the metamethods set the field "player" in the table before indexing this field further with "killedEnemys". But this seems to be wrong and I do not understand why. In my imagination the table should looks like this: table = { "player" = //set by the metamethods { "killedEnemys" = 0 //set by the metamethod } } Questions: 1. Is it possible to use metamethods in lua like this, if more than one field in a nested table does not exist? 2. How does Lua operate on this nested table calls? This is how I call it from C and the function being called in lua: //IN C: lua_getglobal(L, funcName); // where funcName represents a string for the function //"small_talk" below lua_table_serializer ser = {}; //serialization of the game state using the LBP-Method ser.L = L; //it creates a table and pushes it to the stack where Serialize(&ser, npc); lua_newtable(L); // creating a tabl…
favorite count: 0
type: Question
tagged with: nested-table
upvote count: 2
accepted answer: http://stackoverflow.com/a/77281716
has answer: http://stackoverflow.com/a/77281716
score: 2
tagged with: lua
downvote count: 0
tagged with: metatable
has title: Lua "attempt to index a nil value": indexing nested tables, where several tables might be not existing (using __index and __newindex metamethod)
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/77251312

http://stackoverflow.com/q/77331392
has answer: http://stackoverflow.com/a/77331477
favorite count: 0
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77331867
has comment: http://stackoverflow.com/comment/136330217
has comment: http://stackoverflow.com/comment/136330364
has body: Say I have a bunch of files that all follow the same pattern: /tmp/project1/server_config.json /tmp/project1/client_config.json /tmp/project1/monitor_config.json what I need is to extract the names: server client monitor If all I got is the full paths as a strings, is there a Lua method to extract the part that lies between /tmp/projectXX/ and _config.json ?
type: Question
downvote count: 0
has title: Lua string matching : how to find a target path
has answer: http://stackoverflow.com/a/77331522
tagged with: lua
answer count: 3
accepted answer: http://stackoverflow.com/a/77331522
score: 2
possible better answer: http://stackoverflow.com/a/77331867

http://stackoverflow.com/a/77331867
upvote count: 4
score: 4
downvote count: 0
has body: You need to be careful with the pattern. Assuming you want to match exactly the test strings you have given, where the filename may vary in the prefix, but the suffix needs to be _config.json, and the name of the project folder may vary in the suffix, use the pattern ^/tmp/project[^/]+/([^/]+)_config.json for string.match: print(("/tmp/project[^/]+/server_config.json"):match"^/tmp/project1/([^/]+)_config.json") -- server Note also the nuances in the patterns by the other answerers: /tmp/project%d+/(.-)_config.json misses anchors (^ and $). (Assuming this is unintended) this is a frequent mistake in Lua patterns. This will match anything that has something matching /tmp/project%d+/(.-)_config.json anywhere in it; it will also accept the *_config.json file being included in a subdirectory of the project. The following will match, for example: /foo/bar/tmp/project42/subfolder/server_config.json.blah.blub, and the match would be subfolder/server. .*/(.+)_config.json effectively matches just the filename, and removes a suffix of _config.json. Note that this also isn't anchored. A ^ anchor isn't needed here, as .* being greedy already suffices to start at the start of the string, but this pattern will allow arbitrary suffixes after _config.json. It will also allow arbitrary parent folders as it matches just the filename. /blah/blub/server_config.json.blah.blub would match as just server. /tmp/project[1-9]*/(.+)_config.json is similar to the first pattern in that it isn't anchored. It will pretty much have the same issues; it allows [1-9]* rather than %d+ as the project folder suffix though.
type: Answer
answers question: http://stackoverflow.com/q/77331392

http://stackoverflow.com/a/77307361
has body: try to use which key to figure out the keybindings
answers question: http://stackoverflow.com/q/77283313
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/136352389

http://stackoverflow.com/q/77332794
tagged with: neovim-plugin
tagged with: neovim
has body: For my Neovim setup I have a config folder under the lua 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 /zfg/init.lua: local plugins = { 'pear', 'harpoon', 'lsp-zero', 'treesitter', 'undotree', 'colors', 'lualine', 'snip', 'tabline', 'telescope', 'tmux' } local imports = "Loaded: " for i,plug in pairs(plugins) do _ = i if not pcall(require, 'zfg.config.'..plug) then print('Failed to load '..plug) else imports = imports.." "..plug end end print(imports) My directory structure is as follows: nvim/ | -- init.lua | - lua/zfg/ | | - config/ | | |-- pear.lua | | |-- colors.lua | | |-- harpoon.lua | | |-- lsp-zero.lua | | |-- lualine.lua | | |-- snip.lua | | |-- tabline.lua | | |-- telescope.lua | | |-- treesitter.lua | | |-- undotree.lua | |-- init.lua |-- init.lua I can then check this message in :mes to verify that most all the require calls worked (or at least I think that's how that works) in addition to using the other plugins. The main issue is that other plugins will modify my buffer as expected: I can invoke snippets, the pears.nvim 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 lsp-zero in that none of my setup seems to take (no bordered window boxes with suggestions, autocompletion, or mappings). I have added an additional source command to the /nvim/zfg/init.lua file in an attempt to force the file to be sourced but this also failed: local src = ":so ~/.config/nvim/lua/zfg/config/lsp-zero.lua" vim.api.nvim_command(src) It will work correctly when I source nvim/zfg/init.lua 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.
accepted answer: http://stackoverflow.com/a/77454952
score: 0
type: Question
tagged with: lua
has title: lsp plugin config file will load but not modify current buffer until sourced
answer count: 1
has answer: http://stackoverflow.com/a/77454952
type: AnsweredQuestion

sandbox
tags question: http://stackoverflow.com/q/77312520
type: Tag
tag name: sandbox

http://stackoverflow.com/q/77381239
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77386995
score: 0
type: Question
tagged with: lua
has body: 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. I tried putting (event == "MOUSE_BUTTON_PRESSED" and arg == 3) together/before/after (event == "MOUSE_BUTTON_PRESSED" and arg == 1), but the script didn't want to activate in any way. function OnEvent(event, arg) if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) and IsMouseButtonPressed(3) then repeat MoveMouseRelative(1 , 1) if not IsMouseButtonPressed(1) then break end until not IsMouseButtonPressed(1) end if (event == "PROFILE_ACTIVATED") then EnablePrimaryMouseButtonEvents(true) end end
tagged with: logitech-gaming-software
has title: Sequences of two button presses. Logitech G Hub lua script

http://stackoverflow.com/q/77341061
answer count: 1
type: Question
tagged with: mysql
has answer: http://stackoverflow.com/a/77347354
tagged with: lua
has title: Lu-oxmysql Assistance
tagged with: fivem
score: 0
type: UnansweredQuestion
has body: I need help! this bug: [ 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] ["license:405702e0a3ae0630efaa0e0520c2ae1d40de74b6",null,1.4739839571120683e-8,0] [ script:oxmysql] Unknown column 'NaN' in 'field list' and this is the code(server.lua): -- Save player's location to the database RegisterCommand('savelocation', function(source, args, rawCommand) local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(-1))) local playerId = GetPlayerIdentifier(source, 0) -- Check if x, y, or z are NaN (not a number) and replace them with 0 if not x or not tonumber(x) then x = 0.0 end if not y or not tonumber(y) then y = 0.0 end if not z or not tonumber(z) then z = 0.0 end local query = "INSERT INTO player_locations (player_id, x, y, z) VALUES (@player_id, @x, @y, @z)" local params = { ['@player_id'] = playerId, ['@x'] = x, ['@y'] = y, ['@z'] = z } exports.oxmysql:execute(query, params, function(affectedRows) if affectedRows > 0 then TriggerClientEvent('chatMessage', source, '^2Location saved!') else TriggerClientEvent('chatMessage', source, '^1Error saving location!') end end) end, false) \` \-- Teleport the player to a random saved location RegisterCommand('teleporttolocation', function(source, args, rawCommand) local playerId = GetPlayerIdentifier(source, 0) local query = "SELECT * FROM player_locations WHERE player_id = @player_id ORDER BY RAND() LIMIT 1" local params = { ['@player_id'] = playerId } exports.oxmysql:fetch(query, params, function(result) if result and type(result) == 'table' and result[1] then local x, y, z = tonumber(result[1].x), tonumber(result[1].y), tonumber(result[1].z) if x and y and z then local playerPed = GetPlayerPed(-1) SetEntityCoords(playerPed, x, y, z, true, true, true) TriggerClientEvent('chatMessage', source, '^2Teleported to a saved location!') else TriggerClientEvent('chatMessage', source, '^1Invalid coordin…

http://stackoverflow.com/q/77325669
accepted answer: http://stackoverflow.com/a/77326403
type: Question
has comment: http://stackoverflow.com/comment/136320217
has comment: http://stackoverflow.com/comment/136321339
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
score: 1
has answer: http://stackoverflow.com/a/77326403
tagged with: lua
has comment: http://stackoverflow.com/comment/136320380
has comment: http://stackoverflow.com/comment/136320277
has comment: http://stackoverflow.com/comment/136320275
tagged with: c++
has comment: http://stackoverflow.com/comment/136320296
favorite count: 0
has comment: http://stackoverflow.com/comment/136320341
type: AnsweredQuestion
tagged with: arrays
has title: Convert Lua array to C array when C function takes multiple inputs
has comment: http://stackoverflow.com/comment/136321481
has comment: http://stackoverflow.com/comment/136321450
upvote count: 1
linked to: http://stackoverflow.com/q/25940366
answer count: 1
has body: 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 -1 to index the array. Note 1: I am not a Lua expert. Note 2: 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. Lua name = "id string" random_array = {1.2, 1.3, 1.4} c_function(name, random_array, 3) -- 3 is the size of array. C static int c_function(lua_State* L) { const char* name = luaL_checkstring(L, 1); int size = luaL_checkinteger(L, 3); double data[size]; // How do I get array values from 'L' into 'data'? Calculate(name, data, size); return 0; } void Calculate(const char* name, double* data, int size) { // Existing function which acts on the data. // This function cannot change. }
has comment: http://stackoverflow.com/comment/136320245

http://stackoverflow.com/a/77454952
accepted answer of: http://stackoverflow.com/q/77332794
answers question: http://stackoverflow.com/q/77332794
has body: I managed to resolve this issue by changing my structure around slightly. I used the following directory configuration: nvim/ |-- init.lua | - lua/zfg/ | | - config/ | | |-- pear.lua | | |-- colors.lua | | |-- harpoon.lua | | |-- lualine.lua | | |-- snip.lua | | |-- tabline.lua | | |-- telescope.lua | | |-- treesitter.lua | | |-- undotree.lua | |-- init.lua | - after/plugin | |-- lsp-zero.lua As far as I can tell this fixes the issue by loading the completion engine and LSP functionalities after everything under the lua directory and the plugins are loaded (if I'm understanding Neovim configuration correctly).
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/77251826
accepted answer of: http://stackoverflow.com/q/77251312
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
has body: Use a constructor function to create tables with a metatable that has an __index metamethod that recursively calls the constructor function to create new table depths when an indexed key is not present. Here is a condensed example, but this can be written to reuse the metatable. local function nestable(t) return setmetatable(t or {}, { __index = function (self, key) local new = nestable {} rawset(self, key, new) return new end }) end local data = nestable {} data.raw.a1.a2 = { foo = 'bar' } print(data.raw.a1.a2.foo) Result: bar
answers question: http://stackoverflow.com/q/77251312

http://stackoverflow.com/comment/136330689
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77331522
has text: Is it the "+" symbol (or rather the `(.+)` ) that gets me the "thing I want" out of the pattern?

amazon-s3
tag name: amazon-s3
type: Tag
tags question: http://stackoverflow.com/q/77292433
tags question: http://stackoverflow.com/q/78453790

http://stackoverflow.com/q/77251312
upvote count: 2
linked to: http://stackoverflow.com/q/36489928
has answer: http://stackoverflow.com/a/77251826
answer count: 1
favorite count: 0
type: AnsweredQuestion
has title: Recursive metamethod __index?
downvote count: 0
has comment: http://stackoverflow.com/comment/136189606
tagged with: lua
type: Question
has body: How can I extend my __index metamethod so that it works regardless of the level of nesting? My current approach works only for data.raw.a1.a2, but not for data.raw.b1.b2.b3 and following. data = { raw = {} } setmetatable(data.raw, { __index = function(t,k) t[k] = {} return t[k] end }) data.raw.a1.a2 = { foo = "bar" } data.raw.b1.b2.b3 = { foo = "bar" } -- throws an error data.raw.c1.c2.c3.c4 = { foo = "bar" } -- throws an error I tried adding a second setmetatable but this only works for one more level of nesting. data = { raw = {} } setmetatable(data.raw, { __index = function(t,k) t[k] = {} -- below is new setmetatable(t[k], { __index = function(t,k) t[k] = {} return t[k] end }) -- above is new return t[k] end }) data.raw.a1.a2 = { foo = "bar" } data.raw.b1.b2.b3 = { foo = "bar" } -- now this works data.raw.c1.c2.c3.c4 = { foo = "bar" } -- this still throws an error I don't know how I can make this recursive, so that it works for all levels of nesting. Send help.
score: 2
tagged with: metatable
accepted answer: http://stackoverflow.com/a/77251826

http://stackoverflow.com/q/77251948
accepted answer: http://stackoverflow.com/a/77252271
score: -1
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77252271
has body: Today I bought a logitek g502x mouse started writing scripts (I had never written them before) I looked in different places and saw an interesting option The script that i make, does not return errors, but for some reason it does not do anything. What have I done wrong? EnablePrimaryMouseButtonEvents(true); function OnEvent(event, arg) if IsMouseButtonPressed(1) then repeat if IsModifierPressed ("shift") then repeat if IsModifierPressed ("w") then --- PressAndReleaseKey("LCTRL") Sleep(10) MoveMouseTo(33000, 55000) Sleep(50) PressMouseButton(1) Sleep(130) ReleaseMouseButton(1) Sleep(10) PressAndReleaseKey("LCTRL") Sleep(10) --- end until not IsModifierPressed ("shift") end until not IsMouseButtonPressed(1) end end
type: Question
upvote count: 0
tagged with: logitech
tagged with: lua
tagged with: logitech-gaming-software
answer count: 1
has title: Lua script to execute commands after pressing a few keys
favorite count: 0

http://stackoverflow.com/q/77384048
tagged with: awesome-wm
type: Question
tagged with: lgi
tagged with: lua
has comment: http://stackoverflow.com/comment/136430497
has body: 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. The problem I'm facing is with this code: local bg_img = lgi.cairo.ImageSurface.create_from_png("path_to_image.png") print(bg_img.status) -- This prints "NO_MEMORY" -- this is part of the window manager api, but I think you can still make out what's going on local s = tsoil.create(screen_width, screen_height) s.cr:rectangle(0, 0, screen_width, screen_height) s.cr:set_source_surface(bg_img) s.cr:fill() tsoil.set_as_wallpaper(s) This code prints out "NO_MEMORY" for some reason. I don't think this should happen, since the image is only about 600kb of memory. I also tried loading in a much smaller image (26kb in size), and that worked. I also tried running my window manager with Xephyr, and also directly with startx, but that didn't make my code with the larger image work. I don't know how to fix this. EDIT: I also tried this in awesome-wm and it also fails. Again, I don't know why. EDIT2: I also tried to rewrite this code in C, and it still gives the same error: // only the code that gives this error, for the sake of brevity cairo_surface_t *img = cairo_image_surface_create_from_png(path); // this prints "out of memory" printf("%s\n", cairo_status_to_string(cairo_surface_status(img)));
type: UnansweredQuestion
tagged with: cairo
has answer: http://stackoverflow.com/a/77388694
has title: `cairo_image_surface_create_from_png` returns "out of memory", but I have enough memory
has comment: http://stackoverflow.com/comment/136429491
score: 0
answer count: 1
tagged with: x11

http://stackoverflow.com/q/77253099
answer count: 1
score: 0
type: Question
tagged with: lua
tagged with: api-gateway
tagged with: krakend
has title: krakend lua scripting fail by load lib
has answer: http://stackoverflow.com/a/77265763
accepted answer: http://stackoverflow.com/a/77265763
has body: "endpoint": "/apps/{id}", "output_encoding": "no-op", "method": "GET", "backend": [ { "host": [ "http://xxx.yyy.zz:8888" ], "url_pattern": "/apps/{id}", "extra_config": { "modifier/lua-backend": { "sources": [ "/etc/krakend/Hello.lua" ], "post": "local r = response.load(); printPostBody(r:body());", "allow_open_libs": true } } } ] }, My Hello.lua: local mylua = require("cjson") function printPostBody(body) print(body); end When i add this part: local mylua = require("cjson") i got this error: 2023/10/08 09:36:23 [Recovery] 2023/10/08 - 09:36:23 panic recovered: runtime error: slice bounds out of range [-1:] /usr/local/go/src/runtime/panic.go:153 (0xf3dc7e) /go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/error.go:140 (0x1971f64) /go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/binder.go:27 (0x1970866) /go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/error.go:201 (0x1972397) /go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/binder.go:43 (0x19707ee) /go/pkg/mod/github.com/krakendio/binder@v0.0.0-20230413105421-1bbe94e65f45/binder.go:26 (0x1970785) /go/pkg/mod/github.com/krakendio/krakend-lua/v2@v2.1.2/proxy/proxy.go:75 (0x1979793) /go/pkg/mod/github.com/luraproject/lura/v2@v2.3.0/proxy/balancing.go:77 (0x13080a8) /go/pkg/mod/github.com/luraproject/lura/v2@v2.3.0/proxy/http.go:113 (0x130db84) /go/pkg/mod/github.com/luraproject/lura/v2@v2.3.0/router/gin/endpoint.go:50 (0x1bbf674) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1bb49c1) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/recovery.go:102 (0x1bb49ac) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1bb3ae6) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/logger.go:240 (0x1bb3ac9) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/context.go:174 (0x1bb296a) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:620 (0x1bb25f1) /go/pkg/mod/github.com/gin-gonic/gin@v1.9.1/gin.go:576 (0x1bb211c) /usr/loca…
type: AnsweredQuestion

http://stackoverflow.com/comment/136308631
type: Comment
comment on: http://stackoverflow.com/a/77312829
type: AnswerComment
has text: Well what typically happens is after the hook returns, program control returns back to lua, whereas i wanted it to return to c
score: 0

http://stackoverflow.com/comment/136278934
type: Comment
type: QuestionComment
score: 3
has text: 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
comment on: http://stackoverflow.com/q/77302144

visual-studio-code
type: Tag
tags question: http://stackoverflow.com/q/77369921
tag name: visual-studio-code
tags question: http://stackoverflow.com/q/77711848
tags question: http://stackoverflow.com/q/78408798
tags question: http://stackoverflow.com/q/78617539
tags question: http://stackoverflow.com/q/78839148
tags question: http://stackoverflow.com/q/78987682
tags question: http://stackoverflow.com/q/79139400
tags question: http://stackoverflow.com/q/79293179

http://stackoverflow.com/q/77355929
tagged with: vector
tagged with: lua
has title: I need to create a part where the target I shot is at
tagged with: roblox
has body: 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. 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. 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. The code in question: if raycast then local mf = raycast.Instance.Position local hitCharacter = raycast.Instance.Parent local diferencia = Vector3.new(direction.X, direction.Y, direction.Z - mf.Z) local shot = hitCharacter:FindFirstChild("Humanoid") print ("donde disparaste:", direction) print("donde esta lo que disparaste:", mf) print ("diferencia entre lo q disparé y donde disparé:", diferencia) if shot then if hitCharacter.Name ~= player.Character.Name then baleado:FireServer(tool, shot, damage) end elseif not shot then esquirla:FireServer(startPosition, diferencia) end end The script, which catches the remote event fired in the LocalScript: local remoteEvent = script.Parent.esquirlaEvent local tool = script.Parent local debris = game:GetService("Debris") remoteEvent.OnServerEvent:Connect(function(player, startPosition, diferencia) local function crearescombros(startPosition, diferencia) local center = startPosition + diferencia / 2 local distance = diferencia.Magnitude local visual = Instance.new("Part") visual.Parent = game.Workspace.linea visual.Anchored = true visual.CanCollide = false visual.BrickColor = BrickColor.new("Medium stone grey") visual.Material = Enum.Material.Plastic visual.Transparency = .4 visu…
answer count: 1
has answer: http://stackoverflow.com/a/77370216
accepted answer: http://stackoverflow.com/a/77370216
type: AnsweredQuestion
score: 0
type: Question

http://stackoverflow.com/a/77388694
has comment: http://stackoverflow.com/comment/136444232
upvote count: 1
downvote count: 0
type: Answer
score: 1
has body: Nevermind, I found the answer. I tried loading a ".jpg" image with the cairo ...from_png function, which is my fault. 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.
answers question: http://stackoverflow.com/q/77384048

http://stackoverflow.com/a/77350229
type: Answer
answers question: http://stackoverflow.com/q/77341991
has body: 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.
score: 0

http://stackoverflow.com/comment/136175710
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77239619
has text: I think that would Work. Could you pleased Post a complete answer,because the comment alone doesnt Help me solve my Problem.
type: Comment

http://stackoverflow.com/comment/136197745
type: QuestionComment
score: 0
has text: This should be considered a typo, according to my understanding, what you are looking for should be `local newTable = { [boolName] = false }`
type: Comment
comment on: http://stackoverflow.com/q/77255197

http://stackoverflow.com/comment/136261072
type: Comment
comment on: http://stackoverflow.com/a/77291806
score: 0
type: AnswerComment
has text: please provide the errors

http://stackoverflow.com/q/77322628
has comment: http://stackoverflow.com/comment/136315470
has comment: http://stackoverflow.com/comment/136315117
downvote count: 0
answer count: 1
type: UnansweredQuestion
favorite count: 0
has title: How can I prevent DoFile() calls in an threaded environment with gopher-lua?
has body: these are my first steps with gopher-lua. So far I have a worker thread that receives "Actions" 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. Here is the action module: package action import ( "context" "fmt" "net/http" "github.com/croessner/authserv/server/decl" "github.com/croessner/authserv/server/logging" "github.com/go-kit/log/level" "github.com/yuin/gopher-lua" ) var Actions chan *Action type Action struct { Repeating bool ScriptPath string ClientIP string ClientPort string ClientNet string Username string Password string Protocol string } func (a *Action) Loader(L *lua.LState) int { mod := L.SetFuncs(L.NewTable(), map[string]lua.LGFunction{ "is_repeating": a.isRepeating, "get_client_ip": a.getClientIP, "get_client_port": a.getClientPort, "get_client_net": a.getClientNet, "get_username": a.getUsername, "get_password": a.getPassword, "get_protocol": a.getProtocol, }) L.Push(mod) return 1 } func (a *Action) isRepeating(L *lua.LState) int { L.Push(lua.LBool(a.Repeating)) return 1 } func (a *Action) getClientIP(L *lua.LState) int { L.Push(lua.LString(a.ClientIP)) return 1 } func (a *Action) getClientPort(L *lua.LState) int { L.Push(lua.LString(a.ClientPort)) return 1 } func (a *Action) getClientNet(L *lua.LState) int { L.Push(lua.LString(a.ClientNet)) return 1 } func (a *Action) getUsername(L *lua.LState) int { L.Push(lua.LString(a.Username)) return 1 } func (a *Action) getPassword(L *lua.LState) int { L.Push(lua.LString(a.Password)) return 1 } func (a *Action) getProtocol(L *lua.LState) int { L.Push(lua.LString(a.Protocol)) return 1 } func Worker(ctx context.Context) { var a *Action Actions = make(chan *Action) for { select { case <-ctx.Done(): break case a = <-Actions: func() { L := lua.NewState() defer L.Close() L.PreloadModule("as_action", a.Loader) // Other useful modules, i.e…
tagged with: go
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/77890997
has comment: http://stackoverflow.com/comment/136316918
tagged with: lua
score: 1
has comment: http://stackoverflow.com/comment/136316457

http://stackoverflow.com/comment/136436700
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77391686
has text: 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?
type: QuestionComment

http://stackoverflow.com/a/77890997
answers question: http://stackoverflow.com/q/77322628
type: Answer
has body: That's so far as I can see, It looks like there wont write Action by Lua. Why not a Lua table to "deliver" data instead. Sharing Lua byte code between LStates as @kostix mentioned. It is a way to avoid create lots of LStates if you need: The LState pool pattern I tend to set the action module up like this: package action import ( "bufio" "context" "log" "os" "sync" lua "github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua/parse" ) var Actions chan *Action type Action struct { Repeating bool ScriptPath string ClientIP string ClientPort string ClientNet string Username string Password string Protocol string } func (a *Action) ToLuaTable() *lua.LTable { tab := &lua.LTable{} tab.RawSet(lua.LString("Repeating"), lua.LBool(a.Repeating)) tab.RawSet(lua.LString("ClientIP"), lua.LString(a.ClientIP)) tab.RawSet(lua.LString("ClientPort"), lua.LString(a.ClientPort)) tab.RawSet(lua.LString("ClientNet"), lua.LString(a.ClientNet)) tab.RawSet(lua.LString("Username"), lua.LString(a.Username)) tab.RawSet(lua.LString("Password"), lua.LString(a.Password)) tab.RawSet(lua.LString("Protocol"), lua.LString(a.Protocol)) return tab } // I borrow it from https://github.com/yuin/gopher-lua?tab=readme-ov-file#sharing-lua-byte-code-between-lstates // ============================ // ============================ // CompileLua reads the passed lua file from disk and compiles it. func CompileLua(filePath string) (*lua.FunctionProto, error) { file, err := os.Open(filePath) defer file.Close() if err != nil { return nil, err } reader := bufio.NewReader(file) chunk, err := parse.Parse(reader, filePath) if err != nil { return nil, err } proto, err := lua.Compile(chunk, filePath) if err != nil { return nil, err } return proto, nil } // ============================ // ============================ func DoCompiledProto(L *lua.LState, proto *lua.FunctionProto, a *Action) error { lFunc := L.NewFunctionFromProto(proto) L.Push(lFunc) tab := a.ToLuaTable() L.Push(tab) return L.PCall(1, lua.MultRet, nil) } var …
score: 0

http://stackoverflow.com/a/77252313
accepted answer of: http://stackoverflow.com/q/77249976
answers question: http://stackoverflow.com/q/77249976
has body: When you call lua_newuserdata, you're creating a full 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. I am skeptical because after I close Lua using lua_close() I can still access the circle, moving it, drawing it, etc. 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. Another note about your function: the C++ standard says this under section 6.7.3 [basic.life]: 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 delete-expression (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. So you should probably add a __gc metamethod that calls circle-&gt;~CircleShape();.
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/77291788
type: Question
has answer: http://stackoverflow.com/a/77291806
has title: 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
has comment: http://stackoverflow.com/comment/136262377
tagged with: lua
has body: 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)} function toggleBundledColor(side, color) applied = rs.getBundledOutput(side) if applied == 0 then rs.setBundledOutput(side,color) elseif applied ~= color and 0 then rs.setBundledOutput(side, colors.combine(applied, color)) elseif applied == color then rs.setBundledOutput(side, colors.subtract(applied,color)) end end 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
tagged with: computercraft
type: UnansweredQuestion
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/136262972
downvote count: 1
has comment: http://stackoverflow.com/comment/136262506
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/136281358
type: Comment
has text: 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
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77302646

http://stackoverflow.com/q/77249976
has body: 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 lua_close(L), I try to delete the pointer, but this causes the program to crash. I also tried free, but that had the same result I then learned from this post that Lua will automatically free userdata and therefore I do not need to delete the pointer. Is this true? I am skeptical because after I close Lua using lua_close(), I can still access the circle, moving it, drawing it, etc. If I don't delete the pointer to the userdata will this cause a memory leak? I've tried deleting and freeing the pointer, doing it before I close Lua, but all just crashes Here's how I create the userdata int wrap_createCircle(lua_State* luaState){ float radius = lua_tonumber(luaState, 1); CircleShape* circle = (CircleShape*)lua_newuserdata(luaState, sizeof(CircleShape)); new (circle) CircleShape(radius); luaL_getmetatable(luaState, "CircleMetaTable"); lua_setmetatable(luaState, -2); return 1; }
score: 1
tagged with: lua-api
tagged with: c++
tagged with: lua-c++-connection
favorite count: 0
has answer: http://stackoverflow.com/a/77252313
accepted answer: http://stackoverflow.com/a/77252313
type: AnsweredQuestion
answer count: 2
linked to: http://stackoverflow.com/q/2583656
possible better answer: http://stackoverflow.com/a/77252372
duplicate of: http://stackoverflow.com/q/2583656
linked to: http://stackoverflow.com/q/4329643
upvote count: 1
has comment: http://stackoverflow.com/comment/136187003
has comment: http://stackoverflow.com/comment/136187510
type: Question
has title: Does Lua automatically free userdata?
downvote count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/77252372

http://stackoverflow.com/q/77391686
score: 0
type: Question
has title: ROBLOX script still allows messages through
has comment: http://stackoverflow.com/comment/136436923
tagged with: luau
answer count: 0
has comment: http://stackoverflow.com/comment/136437279
tagged with: lua
has comment: http://stackoverflow.com/comment/136437621
has comment: http://stackoverflow.com/comment/136437007
has comment: http://stackoverflow.com/comment/136436700
tagged with: roblox
has comment: http://stackoverflow.com/comment/136447102
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136436979
has body: 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? I have tried a super basic filter, which just removes words it finds to be “bad” from a table, and that surprisingly works. ONLY SCRIPT: local TextChatService = game:GetService("TextChatService") local Channels = TextChatService:WaitForChild("TextChannels") local HttpService = game:GetService("HttpService") local TextClassifier = "https://api.example.com" -- not actual thing, actual api returns json data local MaxScore = 0.7 local function isMessageToxic(message: string, speaker: TextSource): boolean if message == "" then return false end pcall(function() response = HttpService:PostAsync( TextClassifier, HttpService:JSONEncode({ text = message }), Enum.HttpContentType.ApplicationJson ) response = HttpService:JSONDecode(response).response end) if response.Error or not response then print("There has been an error.") -- no body or etc return false end if response[1].score > (MaxScore or 0.7) then print("Message has been flagged.") return true else print("Message has passed.") return false end end local function channelAdded(channel: TextChannel) if not channel:IsA("TextChannel") then return end channel.ShouldDeliverCallback = function(message, textSource) return not isMessageToxic(message.Text, textSource) end end for _, channel in pairs(Channels:GetChildren()) do channelAdded(channel) end Channels.ChildAdded:Connect(channelAdded) What is sent to the API: { "text": "i hate you” } What it responds with: { "response": [{ "label": "NEGATIVE", "score": 0.9993651509284973 }, { "label": "POSITIVE", "score": 0.0006348910392262042 }] } Image of it not working: What is printed: 17:19:59 -- Message has been flagged. 17:19:59 -- Message has been flagged.
has comment: http://stackoverflow.com/comment/136437043

http://stackoverflow.com/comment/136436794
has text: Are you asking "how do I pass a table as an argument when calling a Lua function from Go?"
type: Comment
comment on: http://stackoverflow.com/q/77388159
score: 0
type: QuestionComment

http://stackoverflow.com/q/77252080
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77253388
answer count: 1
tagged with: c++
tagged with: boost-spirit
favorite count: 0
tagged with: boost-spirit-x3
type: Question
tagged with: boost
has title: x3::phrase_parse is not expected
accepted answer: http://stackoverflow.com/a/77253388
downvote count: 0
score: 2
tagged with: lua
has body: I expect to parse Lua syntax through x3,The Complete Syntax of Lua: https://www.lua.org/manual/5.3/manual.html#9 My question is, in this definition, [auto const expdef=simexp | (simexp>>binop>>simexp) | (unop>>simexp);] Why not choose (simexp>>binop>>simexp) when it fails。 I have the following results: output: \n function Lu \n function Lu \n function Lu LuaPrint(str)\n LuaPrint(str)\n (str)\n pr [L, u, a, P, r, i, n, t] LuaPrint(str)\n (str)\n pr [L, u, a, P, r, i, n, t] (str)\n pr (str)\n pr str)\n pri str)\n pri str)\n pri )\n print( [s, t, r] )\n print( )\n print( \n print(" \n print(" print("[in lua]:" .. <fail/> print("[in lua]:" .. print("[in lua]:" .. print("[in lua]:" .. print("[in lua]:" .. ("[in lua]:" .. tost [p, r, i, n, t] ("[in lua]:" .. tost ("[in lua]:" .. tost ("[in lua]:" .. tost "[in lua]:" .. tostr "[in lua]:" .. tostr "[in lua]:" .. tostr <literal_string> "[in lua]:" .. tostr .. tostring(str))\n [[, i, n, , l, u, a, ], :] </literal_string> .. tostring(str))\n .. tostring(str))\n .. tostring(str))\n ("[in lua]:" .. tost <fail/> <literal_string> ("[in lua]:" .. tost <fail/> </literal_string> <fail/> print("[in lua]:" .. print("[in lua]:" .. print("[in lua]:" .. ("[in lua]:" .. tost [p, r, i, n, t] ("[in lua]:" .. tost ("[in lua]:" .. tost <fail/> print("[in lua]:" .. print("[in lua]:" .. print("[in lua]:" .. ("[in lua]:" .. tost [p, r, i, n, t] ("[in lua]:" .. tost ("[in lua]:" .. tost <fail/> ("[in lua]:" .. tost <fail/> \n print(" print("[in lua]:" .. <fail/> print("[in lua]:" .. print("[in lua]:" .. print("[in lua]:" .. print("[in lua]:" .. ("[in lua]:" .. tost [p, r, i, n, t] ("[in lua]:" .. tost ("[in lua]:" .. tost ("[in lua]:" .. tost "[in lua]:" .. tostr "[in lua]:" .. tostr "[in lua]:" .. tostr <literal_string> "[in lua]:" .. tostr .. tostring(str))\n [[, i, n, , l, u, a, ], :] </literal_string> .. tostring(str))\n .. tostring(str))\n .. tostring(str))\n ("[in lua]:" .. tost <fail/> <literal_string> ("[in lua]:" .. tost <fail/> </literal…

http://stackoverflow.com/a/77312829
has comment: http://stackoverflow.com/comment/136297820
has body: 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 "attempt to yield across a C-call boundary" 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). You may check this SO question, as it appears to describe a similar goal and one of the answers suggests an extension (yieldhook) that may be relevant to your question.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77312520
has comment: http://stackoverflow.com/comment/136299502
has comment: http://stackoverflow.com/comment/136308631

http://stackoverflow.com/a/77281716
type: AcceptedAnswer
type: Answer
has body: There are a few problems here that build on each other. For starters, when an __index metamethod is invoked, and that metamethod is a function, the value resolved by that index is the return value of the function. For example, local t = setmetatable({}, { __index = function (self, key) return 42 end }) print(t.a, t.b) prints 42 42 So in your code, even if you assign a value to that key in the table function index_metamethod(t,i) t[i] = 0 end the metamethod returns nothing, and the result of table.player is nil. You need to return t[i] (or equivalent) after you set it. 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. That is, for a.b.c, if 'b' does not exist in a, but a has an __index metamethod, then a.b is resolved to the result of invoking that metamethod (as previously discussed). Then, that intermediate value (a.b) is indexed by 'c', and again if 'c' does not exist in that intermediate value, then that intermediate value's __index metamethod would be invoked, assuming it exists. Basically a.b.c is local result do local x = a.b -- possibly invoke `getmetatable(a).__index` result = x.c -- possibly invoke `getmetatable(x).__index` end 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 reused by more than one table). This issue is very similar in concept to this question from just a few days ago, which shows how to solve this on the Lua side. Finally, assuming you fix everything else, the value set by index_metamethod (t[i] = 0) means table.player will resolve as 0, and so table.player.killedEnemys will create the error attempt to index a number value (field 'player') but "fixing" (assuming you use the same index_metamethod for every nested table) this by changing t[i] = 0 to t[i] = {} means that table.player.killedEnemys > 5 will cr…
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/77280566
answers question: http://stackoverflow.com/q/77280566
downvote count: 0

http://stackoverflow.com/comment/136425188
comment on: http://stackoverflow.com/q/77385301
score: 0
type: QuestionComment
has text: 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"}}`?
type: Comment

http://stackoverflow.com/comment/136282469
comment on: http://stackoverflow.com/q/77301309
score: 1
type: Comment
has text: 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.
type: QuestionComment

http://stackoverflow.com/q/77240847
type: AnsweredQuestion
has body: 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 cjson for basic deserialization, but I'm struggling with mapping the nested JSON to my custom data structures efficiently. Here's a simplified example of the JSON object returned by the API: { "data": { "id": 1, "attributes": { "name": "John", "details": { "age": 30, "address": { "street": "123 Main St", "city": "Anytown" } } } } } And here's what I would like to map this to in Lua: Person = { id = 1, name = "John", age = 30, street_address = "123 Main St", city = "Anytown" } 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. Thank you in advance for any insights or recommendations!
has title: How to Efficiently Map Nested JSON to Custom Lua Data Structures in a REST API Client?
type: Question
tagged with: cjson
tagged with: http://stackoverflow.com/tag/json
tagged with: lua
has answer: http://stackoverflow.com/a/77244125
answer count: 1
accepted answer: http://stackoverflow.com/a/77244125
score: 0

websocket
type: Tag
tag name: websocket
tags question: http://stackoverflow.com/q/77265289
tags question: http://stackoverflow.com/q/77802584

http://stackoverflow.com/q/77302646
has comment: http://stackoverflow.com/comment/136294347
has body: 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? Basically I need to use rtcp sub-dissector to present the below: 10.. .... = Version: RFC 1889 Version (2) ..0. .... = Padding: False ...0 0001 = Reception report count: 1 Packet type: Report (200) Length: 12 (52 bytes) SSRC: 0x107bb175 (276541813) I am trying the below code: my_proto = Proto("my_proto", "My Protocol") magic_number = ProtoField.uint32("my_proto.magic_number", "Magic number", base.DEC) version = ProtoField.uint16("my_proto.version" , "Version" , base.DEC) my_proto.fields = { magic_number, version ) function my_proto.dissector(buffer, pinfo, tree) length = buffer:reported_length_remaining() local offset = 0 if length < 16 then return end local subtree = tree:add(my_proto, buffer:range(offset,length), "My protocol (Report)") subtree:add(magic_number, buffer(offset,4)) offset = offset + 4 subtree:add(version, buffer(offset,2)) offset = offset + 2 -- Then I have 8 bytes related to rtcp protocol, i.e. version, padding, etc. Dissector.get("rtcp"):call(buffer(offset, offset+8):tvb(), pinfo, subtree) This line: Dissector.get("rtcp"):call(buffer(offset, offset+8):tvb(), pinfo, subtree) is not working for me. I need it to be presented as below: 10.. .... = Version: RFC 1889 Version (2) ..0. .... = Padding: False ...0 0001 = Reception report count: 1 Packet type: Report (200) Length: 12 (52 bytes) SSRC: 0x107bb175 (276541813) Any help please?
answer count: 0
score: 0
tagged with: wireshark
tagged with: wireshark-dissector
has comment: http://stackoverflow.com/comment/136281358
type: Question
tagged with: lua
has title: Lua sub-dissector for rtcp inside a proprietary protocol
has comment: http://stackoverflow.com/comment/136293925
has comment: http://stackoverflow.com/comment/136294731
has comment: http://stackoverflow.com/comment/136284477
has comment: http://stackoverflow.com/comment/136296576
has comment: http://stackoverflow.com/comment/136282902
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136293280
has comment: http://stackoverflow.com/comment/136287273

http://stackoverflow.com/q/77274978
has body: Given a vararg ... like 1, 2, 3, nil, 5, I would like to write a function reverse, such that reverse(...) returns the vararg 5, nil, 3, 2, 1.
type: Question
has title: Reversing a vararg
tagged with: variadic-functions
tagged with: lua
upvote count: 3
has answer: http://stackoverflow.com/a/77276293
has answer: http://stackoverflow.com/a/77274979
type: UnansweredQuestion
downvote count: 0
favorite count: 0
answer count: 2
score: 3

http://stackoverflow.com/q/77413427
answer count: 0
has comment: http://stackoverflow.com/comment/136509654
has comment: http://stackoverflow.com/comment/136510987
tagged with: lua
type: Question
tagged with: roblox
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136493304
has title: I want to make a part, created by a script, play a sound
score: 0
has body: 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 "impacto") local remoteEvent = script.Parent.esquirlaEvent local ruido = script.Parent.ruidoEvent local tool = script.Parent local debris = game:GetService("Debris") local material = Enum.Material remoteEvent.OnServerEvent:Connect(function(player, startPosition, impacto, colordobjeto, materialdobjeto) local function crearescombros(startPosition, impacto) local visual = Instance.new("Part") visual.Name = "esquirla" visual.Parent = game.Workspace.esquirlas visual.Anchored = true visual.CanCollide = false visual.Transparency = .5 visual.Shape = Enum.PartType.Ball if materialdobjeto ~= material.Metal then visual.Size = Vector3.new(2, 2, 2) visual.Material = material.Plastic elseif materialdobjeto == Enum.Material.Metal then visual.Size = Vector3.new(1, 1, 1) visual.Material = material.Neon end if materialdobjeto == Enum.Material.Concrete then visual.BrickColor = BrickColor.new("Medium stone grey") elseif materialdobjeto == Enum.Material.Brick then visual.BrickColor = colordobjeto elseif materialdobjeto == Enum.Material.Metal then visual.BrickColor = BrickColor.new("New Yeller") elseif materialdobjeto == Enum.Material.Grass then visual.BrickColor = BrickColor.new("Brown") end visual.CFrame = CFrame.lookAt(impacto, startPosition) wait(.1) visual.Transparency = .8 debris:AddItem(visual, 0.2) end crearescombros(startPosition, impacto) end) Well, I'd like this part instance, visual, play a sound. 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 "visual" appears, it stops playing as soon as the part dissapears, 0.2 seconds, cutting the audio midway, making it bothering. This is the attempt: local remoteEvent = script.Parent.esquirlaEvent local ruido = script.Parent.ruidoEvent local tool = script.Parent local debris = game:Get…

http://stackoverflow.com/q/77330371
has body: 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. { "$schema": "https://www.krakend.io/schema/v3.json", "version": 3, "port": 9000, "timeout": "300000s", "cache_ttl": "4000s", "extra_config": { "router": { "return_error_msg": true } }, "endpoints": [ { "@comment": "Feature: GET apps by identification", "endpoint": "/apps/{id}", "output_encoding": "no-op", "method": "GET", "backend": [ { "host": [ "http://xxx.yyy.zzz:8080" ], "url_pattern": "/apps/{id}", "extra_config": { "modifier/lua-backend": { "sources": [ "/etc/krakend/json.lua", "/etc/krakend/Hello.lua" ], "post": "local r = response.load(); modifyBody(r);", "live": true, "allow_open_libs": true } } } ] }, My Hello.lua function modifyBody(response) print(response:body()) //return the body local json_parse = json_parse(response); print(json_parse) //return the modified body print(response:body(json_parse)) //return the modified body print(response) //return userdata: 0xc000618b10 return response:body(json_parse) end i got a 200 from the container: [00] 2023/10/18 09:18:21 KRAKEND INFO: [SERVICE: Gin] Listening on port: 9000 [00] [GIN] 2023/10/18 - 09:18:27 | 200 | 312.644487ms | 172.20.0.1 | GET "/apps/aaaaa" print(json_parse) the logs returns a correct formated json but the but the postman console is empty: Could not get response Error: aborted i tried another combination: "output_encoding": "json", //endpoint level "encoding": "no-op", //backend level -> empty json {} "output_encoding": "json", //endpoint level "encoding": "json", //backend level -> 2023/10/19 15:06:33 KRAKEND ERROR: [ENDPOINT: /apps/:id] unexpected character '' at line 1 col 1 [00] [GIN] 2023/10/19 - 15:06:33 | 500 | 578.746497ms | 172.20.0.1 | GET "/ apps /11111"
tagged with: lua
tagged with: krakend
has title: Krakend lua set response body returns nil
has answer: http://stackoverflow.com/a/77364344
type: UnansweredQuestion
favorite count: 0
score: -1
downvote count: 1
answer count: 1
upvote count: 0
tagged with: api-gateway
type: Question

http://stackoverflow.com/a/77279133
answers question: http://stackoverflow.com/q/77277130
type: Answer
has body: You can use string method rep() -- columns.lua local cols = 80 -- Amount of spaces local tab = {} -- A Table local space = "\32" -- Byte for a Space table.insert(tab, space:rep(cols)) -- Insert it with length of cols time print(tab[#tab] .. 'END') -- Show it -- Output: END
score: 0

http://stackoverflow.com/comment/136419185
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/77370216
type: Comment
score: 0

cairo
tag name: cairo
tags question: http://stackoverflow.com/q/77384048
type: Tag
tags question: http://stackoverflow.com/q/78394057

http://stackoverflow.com/q/77312520
tagged with: sandbox
has answer: http://stackoverflow.com/a/77312918
tagged with: lua
has title: Lua debugger, hooks, yield and resume
downvote count: 0
linked to: http://stackoverflow.com/q/54858455
tagged with: lua-api
has comment: http://stackoverflow.com/comment/136297851
type: UnansweredQuestion
score: 1
has body: 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. I can setup a hook to trigger every line, or every x instructions etc. I can also create thread/coroutines to allow yielding which can return control flow back to c. The issue comes when trying to combine these. The lua script should not have to invoke anything special for this. is calling lua_yield not allowed from a hook function? Here I create a new lua state, a new lua thread, set a hook and run script.lua using pcallk lua_State* L = luaL_newstate(); luaL_openlibs(L); lua_State* T = lua_newthread(L); lua_sethook(T, &hookfunc, LUA_HOOKLINE, 1); // Run a hook to trigger every line luaL_loadfile(T, "script.lua"); int nres; // throwaway, unused int status = lua_resume(T, 0, 0, &nres); // Run the script so that it can yield The hook function simply calls yield. lua_yield(L, 0); This doesn't work as expected, is this legal? did I miss something in documentation. I've looked at: PIL 4th edition. The lua.org documentation This sandbox page And an old email thread i cannot find the link to I will reiterate this is to be done in the c api, the lua script itself doesn't invoke anything
favorite count: 0
answer count: 2
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/77312829

variadic-functions
tags question: http://stackoverflow.com/q/77274978
tag name: variadic-functions
type: Tag

mpv
type: Tag
tag name: mpv
tags question: http://stackoverflow.com/q/77341991
tags question: http://stackoverflow.com/q/78649659
tags question: http://stackoverflow.com/q/78658397

http://stackoverflow.com/comment/136509654
type: Comment
has text: Could you elaborate on PlayOnRemove ? how is it used? the situation in which it's used is the one I'm in actually.
comment on: http://stackoverflow.com/q/77413427
score: 0
type: QuestionComment

http://stackoverflow.com/q/77317160
type: UnansweredQuestion
answer count: 1
score: 0
has body: I have creted a lua script requesting vi curl a JSON response from a server. This is the code: local buffer = {} local headers = { "Content-Type: application/json" } url = "https://apiserver/fsapi/json_emcontacts?username=10001&domain=my.domain.com" local c = curl.easy { url = url, ssl_verifypeer = false, ssl_verifyhost = false, httpheader = headers, [curl.OPT_TIMEOUT] = 2, } c:setopt_writefunction(table.insert, buffer) local ok, err = c:perform() if ok then local status = c:getinfo_response_code() if status == 200 then consoleLog("info", "API GET JSON OK\n") local response = json.decode(table.concat(buffer)) consoleLog("info", "Data = "..response['item1'].."\n") else consoleLog("info", "API GET JSON FAIL , status code = "..status.."\n") end else consoleLog("info", "API Call Timeout\n") end I'm using the "[curl.OPT_TIMEOUT]" 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. Does someone knows how to print some log or do something when the timeout is complete? Thanks in advance. Ricardo
type: Question
tagged with: lua
has title: Lua Curl catch Timeout
has answer: http://stackoverflow.com/a/77326248
tagged with: curl

image
type: Tag
tag name: image
tags question: http://stackoverflow.com/q/77389377
tags question: http://stackoverflow.com/q/78791003

http://stackoverflow.com/comment/136447102
type: QuestionComment
comment on: http://stackoverflow.com/q/77391686
type: Comment
has text: @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
score: 0

http://stackoverflow.com/q/77265289
favorite count: 0
type: Question
downvote count: 0
tagged with: luarocks
answer count: 0
tagged with: windows
tagged with: openssl
tagged with: websocket
score: 1
has title: Need help to correctly setup ssl for lua
tagged with: lua
type: UnansweredQuestion
upvote count: 1
has body: 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. I'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. When 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) I'm currently stuck there: > luarocks install cqueues CRYPTO_INCDIR=C:\external\include CRYPTO_LIBDIR="C:\Program Files\OpenSSL-Win64" Installing https://luarocks.org/cqueues-20200726.54-0.src.rock Error: Could not find library file for CRYPTO No file libcrypto.dll.a in C:\Program Files\OpenSSL-Win64 No file crypto.dll.a in C:\Program Files\OpenSSL-Win64 No file libcrypto.a in C:\Program Files\OpenSSL-Win64 No file cygcrypto.dll in C:\Program Files\OpenSSL-Win64 No file libcrypto.dll in C:\Program Files\OpenSSL-Win64 No file crypto.dll in C:\Program Files\OpenSSL-Win64 No file crypto.lib in C:\Program Files\OpenSSL-Win64 You may have to install CRYPTO in your system and/or pass CRYPTO_DIR or CRYPTO_LIBDIR to the luarocks command. Example: luarocks install cqueues CRYPTO_DIR=/usr/local So I'm here to call for help. Thank you very much!

http://stackoverflow.com/q/77298079
tagged with: roblox
has answer: http://stackoverflow.com/a/77308279
tagged with: lua
has body: 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? We looked up code online but couldn't find anything
type: UnansweredQuestion
has title: How to highlight player and speed coil in boblox studio
answer count: 1
score: 0
type: Question

http://stackoverflow.com/comment/136325140
type: AnswerComment
has text: Rather than defining that anonymous function, you could also do `pcall(c.perform, c)` instead.
type: Comment
comment on: http://stackoverflow.com/a/77326248
score: 0

http://stackoverflow.com/q/77257804
upvote count: 0
accepted answer: http://stackoverflow.com/a/77258285
score: -1
tagged with: lua
tagged with: resty
answer count: 1
has body: In my NGINX-config I have location /x { access_by_lua_file auth/auth.lua; content_by_lua_file auth/content.lua; } 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. content.lua looks like this: local files_cache = require 'files_cache' local filePath = ngx.var.file_path local fileContent = files_cache.load(filePath) if fileContent ~= nil then ngx.header["X-Source"] = "Cache" ngx.say(fileContent) ngx.status = ngx.HTTP_OK return ngx.exit(ngx.status) end
type: AnsweredQuestion
tagged with: nginx
has title: Ignore content_by_lua_file under some circumstances and let NGINX do it's job
downvote count: 1
type: Question
favorite count: 0
has answer: http://stackoverflow.com/a/77258285

http://stackoverflow.com/comment/136352690
has text: Thank you so much. But what if script failed to execute this "return newAmount" line of code?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77341135
type: Comment

http://stackoverflow.com/comment/136293925
comment on: http://stackoverflow.com/q/77302646
has text: 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!
type: QuestionComment
type: Comment
score: 0

datastore
tag name: datastore
type: Tag
tags question: http://stackoverflow.com/q/77327059
tags question: http://stackoverflow.com/q/77936647
tags question: http://stackoverflow.com/q/78828816

http://stackoverflow.com/a/77347354
has body: What you're trying to do is to save the location of the FiveM Server. -- This means that you want to get the ped of the current user. -- This only works in the FiveM client, not the server. local ped = GetPlayerPed(-1) On the server side, you can get the player's location by passing the player's ID in the GetPlayerPed(param1) function (Fivem Docs). 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 > 0, it's a player). Try this instead: -- Save player's location to the database RegisterCommand('savelocation', function(source, args, rawCommand) local x, y, z = table.unpack(GetEntityCoords(GetPlayerPed(source))) local playerId = GetPlayerIdentifier(source, 0) -- Check if x, y, or z are NaN (not a number) and replace them with 0 if not x or not tonumber(x) then x = 0.0 end if not y or not tonumber(y) then y = 0.0 end if not z or not tonumber(z) then z = 0.0 end local query = "INSERT INTO player_locations (player_id, x, y, z) VALUES (@player_id, @x, @y, @z)" local params = { ['@player_id'] = playerId, ['@x'] = x, ['@y'] = y, ['@z'] = z } exports.oxmysql:execute(query, params, function(affectedRows) if affectedRows > 0 then TriggerClientEvent('chatMessage', source, '^2Location saved!') else TriggerClientEvent('chatMessage', source, '^1Error saving location!') end end) end, false)
type: Answer
answers question: http://stackoverflow.com/q/77341061
score: 0

http://stackoverflow.com/comment/136436923
comment on: http://stackoverflow.com/q/77391686
score: 0
type: QuestionComment
type: Comment
has text: 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.

http://stackoverflow.com/comment/136330217
has text: Try `path:match(".*/(.+)_config.json")`.
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/77331392

geometry
tag name: geometry
type: Tag
tags question: http://stackoverflow.com/q/77302144
tags question: http://stackoverflow.com/q/78214820
tags question: http://stackoverflow.com/q/78300144
tags question: http://stackoverflow.com/q/78356582
tags question: http://stackoverflow.com/q/79455748

http://stackoverflow.com/q/77340179
answer count: 2
type: AnsweredQuestion
has title: If a executable redis's lua script fail to return value to client (java application), is that transaction rolled back or not?
accepted answer: http://stackoverflow.com/a/77341135
favorite count: 0
possible better answer: http://stackoverflow.com/a/77342417
type: Question
upvote count: 1
has body: Here is my Lua script. local field = ARGV[1] local amount = ARGV[2] local newAmount = redis.call("HINCRBYFLOAT", key, field, amount) return newAmount I have this lua script in my java application. My concern is if this script fail to return "newAmount" then the script's transactions will roll back or not? My expectation is the roll back operation should happen.
tagged with: lua
tagged with: redis
has answer: http://stackoverflow.com/a/77342417
downvote count: 0
has answer: http://stackoverflow.com/a/77341135
score: 1

http://stackoverflow.com/q/77329678
has comment: http://stackoverflow.com/comment/136346319
has title: I want to complete the FiveM Lua syntax
has answer: http://stackoverflow.com/a/77356286
type: Question
has comment: http://stackoverflow.com/comment/136335621
has comment: http://stackoverflow.com/comment/136329167
has comment: http://stackoverflow.com/comment/136329433
tagged with: lua
answer count: 1
tagged with: fivem
type: UnansweredQuestion
has body: This is the part of the string inside the "". I want to know if this is okay. "[[�����������" I want to put this inside the string "" is redundant, is there any way? "`,6<,futb=!;/2f*:= enter image description here I want to put the two values above in a TriggerServerEvent("") function that exists in a game called FiveM. To convert that value to a TriggerServerEvent, it must be created as follows TriggerServerEvent(""`,6<,futb=!;/2f*:=", "[[�����������", ,1573218749406,-1,"T1","Dances") Let me know what's wrong with this syntax
score: 0

http://stackoverflow.com/q/77383213
score: 0
type: Question
has answer: http://stackoverflow.com/a/77385147
has title: Display page sort key on MediaWiki page or footer
tagged with: mediawiki-templates
tagged with: mediawiki-extensions
answer count: 1
type: UnansweredQuestion
has body: I need to display the MediaWiki page sort key on the page, or in the footer by using a template within MediaWiki:Lastmodifiedatby. The sort key can be either automatically defined or by using DEFAULTSORT. 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. Is there a way to derive and display the sort key of a MediaWiki page, by template or Lua code?
tagged with: lua
tagged with: mediawiki

http://stackoverflow.com/a/77385147
answers question: http://stackoverflow.com/q/77383213
score: 0
has body: You can create a template named DEFAULTSORT (or whatever) and use that instead of the magic word to intercept the call. For example, this adds a containing the sort key to the page: {{DEFAULTSORT:{{{1|}}}|{{{2|}}}}}{{{1|}}} And then you can just replace the : in previous usages with |:
type: Answer

http://stackoverflow.com/comment/136176381
comment on: http://stackoverflow.com/q/77243944
has text: Create table as `local table_ = {["A"]=1,["B"]=1}` and your code will work.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136179180
comment on: http://stackoverflow.com/a/77243961
type: Comment
has text: Thanks for the detailled write-up. I decided to accept shingo's, because it seems a more conventional way of doing it.
score: 0
type: AnswerComment

http://stackoverflow.com/q/77270819
type: AnsweredQuestion
score: 0
tagged with: openresty
tagged with: redis
tagged with: docker
has body: my lua script local redis = require "resty.redis" local red = redis:new() red:set_timeout(1000) local ok, err = red:connect("172.20.0.2", 6379) if not ok then ngx.log(ngx.CRIT, "Failed to connect to redis: ", err) return end function save_bytes_sent() local bytes_sent = ngx.var.bytes_sent local res, err = red:set("bytes_sent_" .. ngx.var.uri, bytes_sent) if not res then ngx.log(ngx.CRIT, "Failed to save bytes_sent in redis: ", err) return end local ok, err = red:close() if not ok then ngx.log(ngx.CRIT, "Failed to close the connection to redis: ", err) return end ngx.log(ngx.CRIT, "Saved bytes_sent in redis successfully") end save_bytes_sent() and my nginx.conf location / { access_by_lua_file /test.lua; } i use openresty docker image and all config is ok such as volumes, network and ... I want to get the ngx.var.bytes_sent value from the response of each request and insert it in redis, but my problem is that in access_by_lua_file, its value is zero, and if I use the log_by_lua_file, I can get its value, but I cannot use Redis because there is no access to Redis in this phase. What is the solution for this problem?
has title: how to access value of ngx.var.bytes_sent in access_by_lua_file
tagged with: nginx
answer count: 1
accepted answer: http://stackoverflow.com/a/77271356
type: Question
has answer: http://stackoverflow.com/a/77271356
tagged with: lua

http://stackoverflow.com/q/77377056
type: Question
tagged with: roblox
answer count: 0
has body: 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 Hit() or Double() it decides it wants 3 cards instead of 1 card, 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. Thanks :D local function Hit(player, Hand) if #deck == 0 then shuffleTable(deck) end local newCard = table.remove(deck, 1) local newCardTexture = cardTextures[newCard] -- Add the new card to the player's hand table.insert(Hand, newCard) local handTotal = CalculateHandTotal(Hand) player.PlayerGui.Blackjack.Main.PlayerTotal.Text = handTotal -- Update the player's hand display local templateCard = game.ReplicatedStorage.CardImages.FirstCard:Clone() templateCard.Name = "NewCard" -- Change the name if necessary templateCard.Image = newCardTexture templateCard.Parent = player.PlayerGui.Blackjack.Main.PlayerCards if tonumber(player.PlayerGui.Blackjack.Main.PlayerTotal.Text) > 21 then print("You busted!") return false end return true end -- Function to handle the "Stand" action local function Stand(player, playerHand, dealerHand) while tonumber(player.PlayerGui.Blackjack.Main.DealerTotal.Text) < 17 do dealerTotal = CalculateHandTotal(dealerHand) player.PlayerGui.Blackjack.Main.DealerTotal.Text = dealerTotal if dealerTotal > 17 then break end if #deck == 0 then shuffleTable(deck) end local newCard = table.remove(deck, 1) local newCardTexture = cardTextures[newCard] -- Add the new card to the dealer's hand table.insert(dealerHand, newCard) -- Update the dealer's hand display local templateCard = game.ReplicatedStorage.CardImages.FirstCard:C…
tagged with: lua
has comment: http://stackoverflow.com/comment/136411135
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136411181
score: 0
has title: Hit and Double function gets called repeatedly- on one press

http://stackoverflow.com/comment/136442419
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77395261
type: Comment
score: 0

http://stackoverflow.com/a/77305460
answers question: http://stackoverflow.com/q/77301309
has body: Fixed Step one: local t = { ["track"] = "one#two#three", { ["track"] = "four" }, -- [1] } local function probe(tbl) -- Rename "track" to "aura" for k, v in pairs(tbl) do if type(v) == "table" then probe(v) end end if tbl.track then tbl.aura = tbl.track tbl.track = nil end end probe(t):now table becomes { ["aura"] = "one#two#three", { ["aura"] = "four", }, -- [1] } Step two: function updateDB(tbl, depth) if depth > 0 then for k, v in pairs(tbl) do if type(v) ~= 'table' then if k == 'track' then local count = 1 for word in v:gmatch(("[^%s]+"):format("#")) do table.insert(tbl,{ ["aura"] = word }) count = count + 1 end tbl[k] = nil end else updateDB(v, depth-1) end end end end updateDB(t,1): now table becomes { { aura= "one", }, -- [1] { aura= "two", }, -- [2] { aura= "three", }, -- [3] { aura= "four", }, -- [3] }
score: 0
type: Answer

http://stackoverflow.com/a/77385533
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/77385301
upvote count: 3
has body: This operation is called flattening. It turns "nested" lists like {{'text'}, {'something', 'string'}, {'thing'}} into a "flat" list {'text', 'something', 'string', 'thing'}. A deep flattening can straightforwardly be written as follows: function flatten(v) local res = {} local function flatten(v) if type(v) ~= "table" then table.insert(res, v) return end for _, v in ipairs(v) do flatten(v) end end flatten(v) return res end Usage: print(table.unpack(flatten{{'text'}, {'something', 'string'}, {'thing'}})) -- text something string thing
score: 3

http://stackoverflow.com/q/77277130
answer count: 2
tagged with: string
type: UnansweredQuestion
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/77277202
has comment: http://stackoverflow.com/comment/136235415
has answer: http://stackoverflow.com/a/77279133
has title: How can I insert spaces in a table (lua)
type: Question
has comment: http://stackoverflow.com/comment/136240539
tagged with: lua
downvote count: 1
has body: 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. 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?
has comment: http://stackoverflow.com/comment/136238052
upvote count: 0

http://stackoverflow.com/comment/136330364
type: QuestionComment
has text: @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 `.*/` :-)
score: 1
type: Comment
comment on: http://stackoverflow.com/q/77331392

http://stackoverflow.com/comment/136359269
type: AnswerComment
has text: @Md.SaifulIslam I have updated my answer with an example that hopefully answers your question and other questions regarding what happens in a script.
score: 0
comment on: http://stackoverflow.com/a/77341135
type: Comment

http://stackoverflow.com/q/77385301
tagged with: lua
has title: Flattening nested lists in Lua
type: UnansweredQuestion
tagged with: indexing
has answer: http://stackoverflow.com/a/77385533
answer count: 1
favorite count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/136425188
type: Question
score: 3
has comment: http://stackoverflow.com/comment/136425159
has comment: http://stackoverflow.com/comment/136425001
has body: Suppose I have a list that looks like this: {{'text'}, {'something', 'string'}, {'thing'}} I want to turn this into the following list: {'text', 'something', 'string', 'thing'} "flattening" the nested lists.
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/136296576
type: Comment
comment on: http://stackoverflow.com/q/77302646
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/q/77389377
type: Question
downvote count: 0
tagged with: lua
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77391310
upvote count: 2
has body: 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. function PlayState:update(dt) if love.keyboard.wasPressed('p') then if self.pause then self.pause = false scrolling = true sounds['music']:play() sounds['pause']:pause() else self.pause = true scrolling = false sounds['music']:pause() sounds['pause']:play() end end if not self.pause then function PlayState:render() for k, pair in pairs(self.pipePairs) do pair:render() end if self.pause then love.graphics.draw(pause, 235, 100, center) end love.graphics.setFont(flappyFont) love.graphics.print('Score: ' .. tostring(self.score), 8, 8) self.bird:render() 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.
score: 2
tagged with: love2d
has comment: http://stackoverflow.com/comment/136434574
favorite count: 0
tagged with: image
answer count: 1
has title: image not loading over others in pause state

http://stackoverflow.com/comment/136283378
has text: And how could I do it?
comment on: http://stackoverflow.com/q/77301309
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/77301524
has body: Because you started inserting elements from 1. To insert elements into empty slots, you can use either t[#t+1] or table.insert. --local count = 1 for word in v:gmatch(("[^%s]+"):format("#")) do tbl[#tbl+1] = { ["aura"] = word } --count = count + 1 end --local count = 1 for word in v:gmatch(("[^%s]+"):format("#")) do table.insert(tbl, { ["aura"] = word }) --count = count + 1 end
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77301309
answers question: http://stackoverflow.com/q/77301309
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/comment/136297820
has text: 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
comment on: http://stackoverflow.com/a/77312829
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/136443433
score: 2
comment on: http://stackoverflow.com/q/77395261
type: Comment
has text: @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++.
type: QuestionComment

http://stackoverflow.com/comment/136411135
score: 1
comment on: http://stackoverflow.com/q/77377056
type: Comment
has text: 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.
type: QuestionComment

http://stackoverflow.com/a/77403013
has body: You can return a predefined table if argument is ommited. Example -- pdtfunc.lua local function pdtfunc(pdt) local pdt = pdt and setmetatable(pdt, {__index = table}) or setmetatable({"Exampe Value (Index Key 1)", ["Example"] = "Example Value by named Key"}, {__index = table}) return(pdt) end return(pdtfunc) The Constructor of the returned table has all table functions attached as methods. Example of use (Lua 5.1 Standalone) € /bin/lua Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio > pdt = require("pdtfunc") > print(pdt()) table: 0x565b2bf0 > print(pdt():concat()) -- Attached Method to get string or number values Exampe Value (Index Key 1) > print(pdt()[1]) Exampe Value (Index Key 1) > print(pdt()["Example"]) Example Value by named Key > print(pdt().Example) Example Value by named Key > mytab = pdt() > print(mytab:concat()) Exampe Value (Index Key 1) > print(mytab.Example) Example Value by named Key > mytab:insert("New Value with insert()") > print(#mytab) 2 > print(mytab:concat("\n")) Exampe Value (Index Key 1) New Value with insert() > -- Now give a table as argument > mytab = require("pdtfunc")({"With a table as argument"}) > print(mytab:concat()) With a table as argument
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77388159

http://stackoverflow.com/comment/136299502
type: Comment
score: 0
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/77312829

http://stackoverflow.com/comment/136197493
has text: Also do you have emojis in your code on purpose? `if (btn(⬇️)) then`
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77247864

http://stackoverflow.com/q/77312058
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/77313568
score: 0
has title: nginx: How to define 404 error page based on environment variable
type: Question
tagged with: lua
accepted answer: http://stackoverflow.com/a/77313568
tagged with: nginx
has body: I'm using os.getenv() to retrieve environment variables to be used by the lua block for example set_by_lua_block $csp_header { local frameSrc = "frame-src 'self' '*.mywebsite.com'" .. (os.getenv("EXTRA_FRAME_SRC") or "") } Things are working as expected when my application is deployed. 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'). Something like if (os.getenv(var) return /error-pages/404.html, else return error-pages/404-2.html) server { error_page 404 /error-pages/404.html } Could someone explain how can this be done using lua?

http://stackoverflow.com/a/77271356
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/77270819
has body: Since Rewrite/Access Phase precedes Content Phase, it is too early to use $bytes_sent (ngx.var.bytes_sent) in access_by_lua_* directives (the value will be zero). See the figure below. Log Phase (log_by_lua_*) 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). The common trick is to wrap your code in a callback and run it via zero-delay timer. See this section of the documentation: Cosockets Not Available Everywhere. A rough example: log_by_lua_block { local redis = require "resty.redis" local REDIS_HOST = "127.20.0.2" local REDIS_PORT = 6379 local function get_redis_connection(host, port) local red = redis:new() red:set_timeout(1000) local ok, err = red:connect(host, port) if not ok then return nil, err end return red end local function save_bytes_sent(_, uri, bytes_sent) local red, err = get_redis_connection(REDIS_HOST, REDIS_PORT) if not red then ngx.log(ngx.CRIT, "Failed to connect to redis: ", err) return end local res, err = red:set("bytes_sent_" .. uri, bytes_sent) if not res then ngx.log(ngx.CRIT, "Failed to save bytes_sent in redis: ", err) return end local ok, err = red:close() if not ok then ngx.log(ngx.CRIT, "Failed to close the connection to redis: ", err) return end ngx.log(ngx.CRIT, "Saved bytes_sent in redis successfully") end ngx.timer.at(0, save_bytes_sent, ngx.var.uri, ngx.var.bytes_sent) }
answers question: http://stackoverflow.com/q/77270819

curl
tag name: curl
type: Tag
tags question: http://stackoverflow.com/q/77317160
tags question: http://stackoverflow.com/q/78052804

http://stackoverflow.com/comment/136262377
comment on: http://stackoverflow.com/q/77291788
type: Comment
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/q/77240666
tagged with: function
type: Question
downvote count: 0
tagged with: require
has answer: http://stackoverflow.com/a/77240821
tagged with: lua
score: 2
has title: Is there a difference between global require and local require within a function
favorite count: 0
has body: 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 "module"? Following example: In the below example, script1 just loads the module.lua once so any other usage just fetches the content from package.loaded, whereas script2 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 require "module" as to what it does in the first case? module.lua local Table = {} local function print_func(message): print(message) end Table.print_func = print_func return Table script1.lua local table = require "module" local function perform() table.print_func("PERFORM") end local function work() table.print_func("WORK") end script2.lua local function do() local table = require "module" table.print_func("DO") end local function work() local table = require "module" table.print_func("WORK")
upvote count: 2
type: AnsweredQuestion
answer count: 1
tagged with: module
tagged with: package
accepted answer: http://stackoverflow.com/a/77240821

http://stackoverflow.com/comment/136320341
score: 0
has text: @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.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77325669

http://stackoverflow.com/comment/136320245
type: QuestionComment
comment on: http://stackoverflow.com/q/77325669
type: Comment
has text: 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)
score: 1

http://stackoverflow.com/q/77247864
score: 0
tagged with: collision-detection
has answer: http://stackoverflow.com/a/78533446
tagged with: lua
type: Question
has body: Error: Attempt to index global 'W' (a nil value) Hello! I am having trouble getting collision working with a different system that spawns sprites in from the map screen. This is the collision tutorial I used: https://youtu.be/Recf5_RJbZI?si=Df6FbJ2FYfCN39Qx This is the sprite spawning tutorial I used: https://youtu.be/8jb8SHNS66c?si=233nn8z_S1R4R64n 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. 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! -- game loop -- function _init() cls() walls={} make_player() make_walls() -- top-left and lower-right -- bounds of player area a1,b1=8,8 a2,b2=112,112 end function _update60() -- keep inside the play area move_player() p.x=mid(a1,p.x,a2) p.y=mid(b1,p.y,b2) end function _draw() cls() draw_map() draw_player() for w in all(walls) do spr(w.wsp,w.wx,w.wy) end end -- map -- function draw_map() map(0,0,0,0,16,16) end -- player -- function make_player() p={ x=40, y=40, w=8, h=8, speed=2, sprite=1, } end function move_player() --move player with buttons --interacts with wall collision if (btn(⬅️)) then for newx=p.x,p.x-p.speed,-1 do if not box_hit(newx,p.y, p.w,p.h, w.wx,w.wy, w.ww,w.wh) then p.x=newx end end end if (btn(➡️)) then for newx=p.x,p.x+p.speed do if not box_hit(newx,p.y, p.w,p.h, w.wx,w.wy, w.ww,w.wh) then p.x=newx end end end if (btn(⬆️)) then for newy=p.y,p.y-p.speed,-1 do if not box_hit(p.x,newy, p.w,p.h, w.wx,w.wy, w.ww,w.wh) then p.y=newy end end end if (btn(⬇️)) then for newy=p.y,p.y+p.speed do if not box_hit(p.x,newy, p.w,p.h, w.wx,w.wy, w.ww,w.wh) then p.y=newy end en…
has title: How to improve Pico-8 Collision?
tagged with: pico-8
has comment: http://stackoverflow.com/comment/136197493
has comment: http://stackoverflow.com/comment/136197489
answer count: 2
has answer: http://stackoverflow.com/a/79053304
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136375826

pico-8
type: Tag
tags question: http://stackoverflow.com/q/77247864
tag name: pico-8
tags question: http://stackoverflow.com/q/77582051

http://stackoverflow.com/q/77327059
favorite count: 0
has body: i am trying to make a game and the leaderboard data should save but isn't. here is the code in serverscriptservice: local DataStoreService = game:GetService("DataStoreService") local statsDS = DataStoreService:GetDataStore("statsDS") local SAVE_INTERVAL = 60 -- Save data every 60 seconds (1 minute) -- Helper function to save player data local function savePlayerData(player) local leaderstats = player:FindFirstChild("leaderstats") if leaderstats then local Clicks = leaderstats:FindFirstChild("Clicks") local Time = leaderstats:FindFirstChild("Time") if Clicks and Time then local data = {Clicks.Value, Time.Value} local playerUserId = "Player" .. player.UserId local success, errorMessage = pcall(function() statsDS:SetAsync(playerUserId, data) end) if success then print("Saved data for " .. player.Name) else warn("Error saving data for " .. player.Name .. ": " .. errorMessage) end end end end game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Clicks = Instance.new("IntValue") Clicks.Name = "Clicks" Clicks.Parent = leaderstats local Time = Instance.new("IntValue") Time.Name = "Time" Time.Parent = leaderstats local playerUserId = "Player" .. player.UserId local data = statsDS:GetAsync(playerUserId) if data then Clicks.Value = data[1] Time.Value = data[2] end player:WaitForChild("leaderstats") player:WaitForChild("leaderstats"):WaitForChild("Clicks") local lastSaveTime = tick() local saveTimer saveTimer = game:GetService("RunService").Heartbeat:Connect(function() if tick() - lastSaveTime >= SAVE_INTERVAL then lastSaveTime = tick() savePlayerData(player) end if not player:IsDescendantOf(game) then -- Player left the game saveTimer:Disconnect() savePlayerData(player) end end) end) game.Players.PlayerRemoving:Connect(function(player) savePlayerData(player) end) i was expecting the data to save when i leave and rejoin, but it is reset to 0 i tried messing around with the…
type: Question
upvote count: 0
score: -1
tagged with: lua
has title: Roblox Studio: Why isn't my values saving with datastore?
tagged with: roblox
tagged with: datastore
possible better answer: http://stackoverflow.com/a/77362581
accepted answer: http://stackoverflow.com/a/77636876
has answer: http://stackoverflow.com/a/77362581
tagged with: save
answer count: 2
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77636876
tagged with: game-development

http://stackoverflow.com/q/77395261
type: Question
has comment: http://stackoverflow.com/comment/136442419
answer count: 0
has body: EDIT: Calling fn on set works, the Lua function is called. The problem is on the timer's callback. I suspect this conversion[*] from "std::function" to "void *" is the problem. &const_cast<std::function<void()> &>(fn) Because on the timer's callback I got an EXC_BAD_ACCESS. CONFIRMED: The problem is between the conversion between std::function to void pointer. Is there a safe way to do this? I would like to use SDL timers. I'm using the sol2 library to create bindings between Lua and C++. I've created a class called timermanager, where the set 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 (*fn)();. I also tried using sol::function, which is supposedly more flexible than std::function, but it crashes at the same line. The binding works, and the timer is correctly configured with the interval I pass. 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 engine.run() that gets stuck in a loop. #include <sol/sol.hpp> #include <iostream> #include #include #include <memory> #include <string> #include <unordered_map> uint32_t wrapper(uint32_t interval, void *param) { auto fn = static_cast<std::function<void()> *>(param); (*fn)(); return interval; } class timermanager { public: timermanager() = default; virtual ~timermanager(); void set(int32_t interval, const std::function<void()> &fn) { const auto id = SDL_AddTimer(interval, wrapper, &const_cast<std::function<void()> &>(fn)); if (id == 0) { throw std::runtime_error("[SDL_AddTimer] failed to set timer"); } _timers[id] = fn; } private: std::map<int32_t, std::function<void()>> _timers; }; class scriptengine { public: scriptengine() = default; virtual ~scriptengine() = default; void run() { _lua.set_function("set", &timermanager::set, &_timermanager); const auto script = R"( local e = engin…
has comment: http://stackoverflow.com/comment/136442176
has comment: http://stackoverflow.com/comment/136442516
has comment: http://stackoverflow.com/comment/136443433
tagged with: lua
type: UnansweredQuestion
has title: Crash when passing a Lua function as a callback, works well with C++ lambdas
has comment: http://stackoverflow.com/comment/136443236
has comment: http://stackoverflow.com/comment/136443458
tagged with: c++
score: 0

http://stackoverflow.com/q/77377725
score: 0
has body: It's like cashpersecond function isnt actually per second though im not really sure what could be causing this. Also each time I rob the increment increased by like a second which is so weird. Script below: local maxCash = 3000 local cashPerSecond = 500 local timeToRob = 300 local robbing = false local cooldown = 30 local closed = false local defaultVaultPosition = script.Parent.VaultDoor.Position local playersRobbing = {} local alreadyRobbed = {} local guis = {} function endRobbery() closed = true robbing = false wait(1) script.Parent.Door.CanCollide = true script.Parent.VaultDoor.Position = defaultVaultPosition for i, gui in pairs(guis) do gui:Destroy() end for p, x in pairs(playersRobbing) do p.Character.HumanoidRootPart.CFrame = script.Parent.FailedToRob.CFrame end playersRobbing = {} alreadyRobbed = {} script.Alarm:Stop() wait(cooldown) closed = false script.Parent.Door.CanCollide = false end function beginRobbery() for i = 1, timeToRob do wait(1) local region3 = Region3.new(script.Parent.VaultArea.Position - script.Parent.VaultArea.Size/2, script.Parent.VaultArea.Position + script.Parent.VaultArea.Size/2) local parts = workspace:FindPartsInRegion3(region3, script.Parent, math.huge) local playersGivenCashTo = {} for x, part in pairs(parts) do if playersRobbing[game.Players:GetPlayerFromCharacter(part.Parent)] and playersRobbing[game.Players:GetPlayerFromCharacter(part.Parent)] < maxCash and not playersGivenCashTo[game.Players:GetPlayerFromCharacter(part.Parent)] then playersGivenCashTo[game.Players:GetPlayerFromCharacter(part.Parent)] = true playersRobbing[game.Players:GetPlayerFromCharacter(part.Parent)] += cashPerSecond if not game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui:FindFirstChild("RobberyGui") then script.RobberyGui:Clone().Parent = game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui game.Players:GetPlayerFromCharacter(part.Parent).PlayerGui.RobberyGui.StatsHUD.CashBagHUD.Cash.Amount.Text = "$0" table.insert(guis, game.Players:GetPl…
type: AnsweredQuestion
tagged with: luau
accepted answer: http://stackoverflow.com/a/77379676
tagged with: lua
type: Question
tagged with: roblox
has answer: http://stackoverflow.com/a/77379676
answer count: 1
has title: What could be causing my robbing bank script to increment faster than a second each time I rob. (Roblox LuaU)

http://stackoverflow.com/a/77341135
upvote count: 2
has comment: http://stackoverflow.com/comment/136349299
has comment: http://stackoverflow.com/comment/136359269
has body: 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, rollbacks in Redis doesn't exist at all. But there are discussions about implementing some kind of rollback feature. Important definition of "atomically": Redis guarantees the script's atomic execution. While executing the script, all server activities are blocked during its entire runtime. That means that Redis treats the complete script as one operation with no other operation interrupting it. To prevent errors you should validate all your input arguments very thoroughly before using them. To handle potential errors, you can use redis.pcall() instead of redis.call(). With redis.pcall() you can handle runtime errors that are raised by Redis as redis.pcall() always returns a reply and never throws a runtime exception. This can be helpful in creating your own rollback logic and to log errors. Example: local function scriptNoRollback(keys) redis.call("INCR", keys[1]) redis.call("INCR", keys[2]) return "OK" end local function scriptRollback(keys) -- Store initial value. local initValueCounter1 = redis.call("GET", keys[1]) redis.call("INCR", keys[1]) local reply = redis.pcall("INCR", keys[2]) if type(reply) == "table" and reply["err"] ~= nil then reply["err"] = "Oops, error!" -- Try to rollback data. redis.call("SET", keys[1], initValueCounter1) return reply end return "OK" end scriptNoRollback OK: 127.0.0.1:6379> MSET counter1 1 counter2 2 OK 127.0.0.1:6379> FCALL scriptNoRollback 2 counter1 counter2 "OK" 127.0.0.1:6379> MGET counter1 counter2 1) "2" 2) "3" scriptNoRollback ERR: 127.0.0.1:6379> MSET counter1 1 counter2 A OK 127.0.0.1:6379> FCALL scriptNoRollback 2 counter1 counter2 (error) ERR value is not an integer or out of range script: scriptNoRollback, on @user_function:118. 127.0.0.1:6379> MGET counter1 counter2 1) "2" 2) "A" counter1 is not rolled back to initial state. scriptRollback OK: 1…
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/136349563
score: 2
has comment: http://stackoverflow.com/comment/136352690
accepted answer of: http://stackoverflow.com/q/77340179
answers question: http://stackoverflow.com/q/77340179

http://stackoverflow.com/comment/136346319
score: 1
type: Comment
type: QuestionComment
has text: @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, …?
comment on: http://stackoverflow.com/q/77329678

http://stackoverflow.com/comment/136284618
type: QuestionComment
has text: This scirpt is broken: writes only the first value, the other three are empty (`nil`)
score: 0
comment on: http://stackoverflow.com/q/77301309
type: Comment

http://stackoverflow.com/a/77331477
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/77331392
has body: Is it possible to use string.match and %d+ to do this? Say for example: function extract_name(file_path) local pattern = "/tmp/project%d+/(.-)_config.json" local name = string.match(file_path, pattern) return name end %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. You could then create variables with the directories in and call on the function created above. Hopefully that helped.
downvote count: 0
score: 2

x11
type: Tag
tags question: http://stackoverflow.com/q/77384048
tag name: x11

http://stackoverflow.com/comment/136330780
type: Comment
comment on: http://stackoverflow.com/a/77331522
type: AnswerComment
has text: @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`
score: 0

http://stackoverflow.com/comment/136179190
type: Comment
comment on: http://stackoverflow.com/q/77239619
score: 0
has text: @ESkri Thanks, but creating a folder `__base__` cannot be part of the answer.
type: QuestionComment

http://stackoverflow.com/comment/136426039
has text: Thanks @tehtmi I understand the gaps now!
comment on: http://stackoverflow.com/q/77384795
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/77391310
upvote count: 3
score: 3
type: Answer
answers question: http://stackoverflow.com/q/77389377
downvote count: 0
has body: Converting my comment to an answer... 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: -- ... for k, pair in pairs(self.pipePairs) do pair:render() end love.graphics.setFont(flappyFont) love.graphics.print('Score: ' .. tostring(self.score), 8, 8) self.bird:render() if self.pause then -- moved down to bottom love.graphics.draw(pause, 235, 100, center) end -- ...

http://stackoverflow.com/comment/136349299
score: 0
type: AnswerComment
has text: Actually, I am facing a network problem on getting return value. How can I assure that
type: Comment
comment on: http://stackoverflow.com/a/77341135

http://stackoverflow.com/comment/136411181
score: 0
comment on: http://stackoverflow.com/q/77377056
has text: @tehtmi I didn't even think about that, I will try that thanks!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/77355213
upvote count: 0
accepted answer: http://stackoverflow.com/a/77377054
type: AnsweredQuestion
answer count: 1
favorite count: 0
score: -1
type: Question
has answer: http://stackoverflow.com/a/77377054
tagged with: game-development
has body: 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? This is how i make the player look in the direction the velocity is going: bodyGyro.CFrame = CFrame.lookAt(Vector3.new(), bodyVelocity.Velocity.Unit * 2 * rayDirection) The rayDirection is just either 1 or -1. i've tried disabling ragdoll on the humanoid but that didn't help.
downvote count: 1
tagged with: roblox
has title: Having an issue with Gyros on roblox
tagged with: lua
tagged with: scripting

http://stackoverflow.com/comment/136321481
type: Comment
type: QuestionComment
has text: @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.
comment on: http://stackoverflow.com/q/77325669
score: 0

http://stackoverflow.com/a/77533350
has body: Just to give you one idea, here it is how I set my colors: local colorscheme = "tokyonight" -- vim.notify("Selected colorscheme: " .. colorscheme) -- Debugging message -- local colorscheme = "tokyonight" local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) if not status_ok then vim.notify("colorscheme " .. colorscheme .. " not found!") return end
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77311853
answers question: http://stackoverflow.com/q/77311853

http://stackoverflow.com/a/77252531
has comment: http://stackoverflow.com/comment/136191180
upvote count: 4
score: 4
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77252496
answers question: http://stackoverflow.com/q/77252496
has body: Does b need to be like this or can you simply modify a.lua like so? local a = {} function a.new(x, y) x = x or 0 y = y or 0 local b = {} b.x = x b.y = y b.z = 'Static' return b end -- b.lua d = {} table.insert(d, a.new(1, 2)) table.insert(d, a.new(2, 3)) for k, v in pairs(d) do print(k, v.x, v.y) end

http://stackoverflow.com/comment/136329167
score: 1
type: Comment
comment on: http://stackoverflow.com/q/77329678
type: QuestionComment
has text: Doesn't Lua tell you _what's wrong with this syntax_? And what do you mean by _"" is redundant_?

http://stackoverflow.com/comment/136330825
type: Comment
comment on: http://stackoverflow.com/a/77331522
score: 0
type: AnswerComment
has text: @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

http://stackoverflow.com/comment/136400465
comment on: http://stackoverflow.com/a/77370216
type: Comment
score: 0
type: AnswerComment
has text: 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.

http://stackoverflow.com/q/77356875
has body: 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. 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: settings.Moderators("username", "username2", "username3") And here is how I have tried to link the group with that script: settings.Moderators("groupname:groupid:grouprank")
tagged with: admin
type: Question
has answer: http://stackoverflow.com/a/77371375
has title: How to rank people with Adonis Admin on roblox
tagged with: lua
tagged with: roblox
score: 0
answer count: 1
type: UnansweredQuestion

boost-spirit-x3
tags question: http://stackoverflow.com/q/77252080
type: Tag
tag name: boost-spirit-x3

save
type: Tag
tag name: save
tags question: http://stackoverflow.com/q/77327059

http://stackoverflow.com/a/77326248
has comment: http://stackoverflow.com/comment/136325140
answers question: http://stackoverflow.com/q/77317160
score: -1
downvote count: 1
upvote count: 0
type: Answer
has body: Finally i figured out. You have to call pcall in order to catch the error from timeout. I added this local ok, err = pcall(function() c:perform() end) With this i'm able to catch the error in the else like this : print("API Call - Curl Error No "..err:no().." - "..err:msg().."\n") Hope could be help for others.... Ricardo

luau
tags question: http://stackoverflow.com/q/77391686
tag name: luau
type: Tag
tags question: http://stackoverflow.com/q/77377725
tags question: http://stackoverflow.com/q/77743878
tags question: http://stackoverflow.com/q/77755513
tags question: http://stackoverflow.com/q/77748092
tags question: http://stackoverflow.com/q/77669809
tags question: http://stackoverflow.com/q/77736920
tags question: http://stackoverflow.com/q/77891743
tags question: http://stackoverflow.com/q/77961269
tags question: http://stackoverflow.com/q/77918731
tags question: http://stackoverflow.com/q/77789112
tags question: http://stackoverflow.com/q/78059961
tags question: http://stackoverflow.com/q/78268821
tags question: http://stackoverflow.com/q/78251874
tags question: http://stackoverflow.com/q/78285075
tags question: http://stackoverflow.com/q/78202258
tags question: http://stackoverflow.com/q/78420466
tags question: http://stackoverflow.com/q/78369116
tags question: http://stackoverflow.com/q/78439743
tags question: http://stackoverflow.com/q/78334699
tags question: http://stackoverflow.com/q/78434058
tags question: http://stackoverflow.com/q/78317719
tags question: http://stackoverflow.com/q/78469654
tags question: http://stackoverflow.com/q/78551106
tags question: http://stackoverflow.com/q/78539465
tags question: http://stackoverflow.com/q/78531655
tags question: http://stackoverflow.com/q/78561649
tags question: http://stackoverflow.com/q/78720214
tags question: http://stackoverflow.com/q/78718156
tags question: http://stackoverflow.com/q/78713867
tags question: http://stackoverflow.com/q/78710890
tags question: http://stackoverflow.com/q/78705996
tags question: http://stackoverflow.com/q/78655709
tags question: http://stackoverflow.com/q/78656483
tags question: http://stackoverflow.com/q/78717400
tags question: http://stackoverflow.com/q/78712660
tags question: http://stackoverflow.com/q/78794166
tags question: http://stackoverflow.com/q/78885569
tags question: http://stackoverflow.com/q/78745464
tags question: http://stackoverflow.com/q/78829514
tags question: http://stackoverflow.com/q/78882803
tags question: http://stackoverflow.com/q/79012369
tags question: http://stackoverflow.com/q/78912520
tags question: http://stackoverflow.com/q/78962708
tags question: http://stackoverflow.com/q/79124153
tags question: http://stackoverflow.com/q/79080159
tags question: http://stackoverflow.com/q/79084408
tags question: http://stackoverflow.com/q/79213245
tags question: http://stackoverflow.com/q/79316557
tags question: http://stackoverflow.com/q/79510694

http://stackoverflow.com/q/77369921
upvote count: 0
tagged with: visual-studio-code
type: Question
has body: i can't disable hover in vscde for Lua (I am use sumneko's lua server v3.7.0) This bug occurs in GH codespaces and on mac (with vs code Version: 1.83.1) (I want to kiil it since while informative, it can be visually distracting.) FYI: i've tried disabling it in the VScode editor section and also in the Lua extensions section . but no luck. help!
tagged with: lua
score: -1
downvote count: 1
has answer: http://stackoverflow.com/a/77402796
tagged with: hover
answer count: 1
type: UnansweredQuestion
has title: why can't i disable vscode hover (with the lua extension enabled)
favorite count: 0

http://stackoverflow.com/a/77240821
accepted answer of: http://stackoverflow.com/q/77240666
has body: 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 "require", when "require" 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 "require" is generally preferred.
answers question: http://stackoverflow.com/q/77240666
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0
score: 3

http://stackoverflow.com/q/77255197
accepted answer: http://stackoverflow.com/a/77255380
has body: 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. boolValues = { firstBool=true, secondBool=true, thirdBool=true, } function setBoolValue(boolName, state) local newTable = {boolName, false,} for k, v in pairs(boolValues) do if k == boolName then v = state end newTable[k] = v end return newTable end function showTable(tableName) print("printing the table:") for k, v in pairs(tableName) do print(k,v) end print("") end showTable(boolValues) boolValues = setBoolValue("secondBool", false) showTable(boolValues) The result: printing the table: firstBool true secondBool true thirdBool true printing the table: 1 secondBool 2 false firstBool true secondBool false thirdBool true Where are the pairs "1 , secondBool" and "2, false" coming from? What is a better way to write a function to change a value in dictionary?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/77257480
has answer: http://stackoverflow.com/a/77255380
has comment: http://stackoverflow.com/comment/136197745
score: 0
answer count: 2
tagged with: function
type: Question
has title: Lua: Function to Change Value in Dictionary
tagged with: dictionary
has answer: http://stackoverflow.com/a/77257480
tagged with: lua

http://stackoverflow.com/comment/136437043
has text: 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).
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77391686

http://stackoverflow.com/q/77301309
favorite count: 0
has comment: http://stackoverflow.com/comment/136284925
has comment: http://stackoverflow.com/comment/136284818
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77301524
has comment: http://stackoverflow.com/comment/136284882
has title: Manipulating table key
has comment: http://stackoverflow.com/comment/136282380
has answer: http://stackoverflow.com/a/77303114
answer count: 3
linked to: http://stackoverflow.com/q/1426954
type: Question
has comment: http://stackoverflow.com/comment/136283378
downvote count: 0
possible better answer: http://stackoverflow.com/a/77303114
has answer: http://stackoverflow.com/a/77305460
tagged with: lua
has comment: http://stackoverflow.com/comment/136282469
tagged with: lua-table
has comment: http://stackoverflow.com/comment/136283474
accepted answer: http://stackoverflow.com/a/77301524
upvote count: 2
tagged with: data-manipulation
has body: This table is structured like this: local t = { ["track"] = "one#two#three", { ["track"] = "four" }, -- [1] } The first step is to replace the "track" key with the "aura" key. For this purpose I created this function local function probe(tbl) for k, v in pairs(tbl) do if type(v) == "table" then probe(v) elseif type(v) == "string" and k == "track" then tbl["aura"] = tbl[k] tbl[k] = nil end end end running the probe(t) command the table becomes { ["aura"] = "one#two#three", { ["aura"] = "four", }, -- [1] } The second step consists in creating as many tables of the form { ["aura"] = word } as there are tokens in the string "one#two#three". For this purpose I created the function local function updateDB(tbl, depth) if depth > 0 then local d = depth for k, v in pairs(tbl) do if type(v) ~= 'table' then if k == 'aura' then local count = 1 for word in v:gmatch(("[^%s]+"):format("#")) do tbl[count] = { ["aura"] = word } count = count + 1 end tbl[k] = nil end else d = d - 1 updateDB(v, d) end end end end The final table I get is this { { aura= "one", }, -- [1] { aura= "two", }, -- [2] { aura= "three", }, -- [3] } But "four" value is gone away
score: 2
has comment: http://stackoverflow.com/comment/136281528
has comment: http://stackoverflow.com/comment/136284618

http://stackoverflow.com/q/77252496
type: Question
downvote count: 0
upvote count: 1
tagged with: lua
tagged with: list
score: 1
accepted answer: http://stackoverflow.com/a/77252531
has body: 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. The below represents code in a file the main program is fetching from. a.lua local a = {} local b = {} b.x = 0 b.y = 0 b.z = 'Static' function a.new(x, y) b.x = x b.y = y return b end What follows is an example of how the above code is implemented. b.lua a = require 'a' d = {} table.insert(d, a.new(1, 2)) table.insert(d, a.new(2, 3)) 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 "d" table all pointing to the same location. How can I go about generating tables in this way with unique addresses?
tagged with: love2d
answer count: 1
tagged with: generate
favorite count: 0
tagged with: arrays
has title: Generating tables with unique addresses
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77252531

http://stackoverflow.com/comment/136237962
type: AnswerComment
has text: `like this: " "` That IS a space in a string?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77277202

http://stackoverflow.com/comment/136315470
type: Comment
has text: I can not compile the file in front of the for{} loop, because the shown "Actions" struct contains the script path dynamically.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77322628

http://stackoverflow.com/a/77356286
answers question: http://stackoverflow.com/q/77329678
score: 1
has body: To include a double quote (") within a Lua string 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 (\) in front of it, like so: local message = "he said \"bye\" and left" print(message) --Output would be: he said "bye" and left
type: Answer
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/77295794
has body: 'I know that this tutorial is for Linux, but I followed another tutorial for windows with the same results.' I am pretty sure your Errors in require depends on wrong use of Slashes and Backslashes. I mean it looks you use Scripts for a Linux Machine on Windows and that will fail. ...r1\AppData\Local\nvim/lua/core/plugin_config/gruvbox.lua:1: '=' expected The Windows Path without the filename ends: ...r1\AppData\Local\ ...and the filename will be interpreted with Slashes as: "nvim/lua/core/plugin_config/gruvbox.lua" So try to correct/replace every occurance of a Slash in a Path with: \\ (Escaped Backslash) That will be interpreted by Lua to a single Backslash. PS: The Dot (.) in require is OS Independend but harcoded Paths in the Script' that dont make a decision ("Am i on Linux or Windows?" - LuaJIT/FFI) will fail.
type: Answer
answers question: http://stackoverflow.com/q/77287266
score: 0

lua-userdata
tag name: lua-userdata
tags question: http://stackoverflow.com/q/77403589
type: Tag
tags question: http://stackoverflow.com/q/77761655
tags question: http://stackoverflow.com/q/78717400

http://stackoverflow.com/a/77265763
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77253099
answers question: http://stackoverflow.com/q/77253099
has body: As you have seen, if you remove the line with a require 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 sources directory. 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 sources.
score: 1
upvote count: 1

http://stackoverflow.com/a/77253388
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77252080
downvote count: 0
type: AcceptedAnswer
type: Answer
has body: PEG (Parser Expression Grammars) are inherently left-to-right greedy. This means, among other things that left recursion needs to be avoided. Why not choose (simexp&gt;&gt;binop&gt;&gt;simexp) when it fails When what fails? If simexp fails, then by definition the second branch fails because it starts with a simexp. In the general case, parsers a|a &gt;&gt; b will never parse the second branch, because if the a in a &gt;&gt; b would match, then the first branch had already won. The logical workaround here seems to rephrase as a &gt;&gt; b|a or indeed even a &gt;&gt; -b depending on the intent/AST. Review 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.
answers question: http://stackoverflow.com/q/77252080
has comment: http://stackoverflow.com/comment/136197394
score: 1

api-gateway
tags question: http://stackoverflow.com/q/77253099
tag name: api-gateway
tags question: http://stackoverflow.com/q/77330371
type: Tag

iterm2
tags question: http://stackoverflow.com/q/77283313
tag name: iterm2
type: Tag

http://stackoverflow.com/a/77257480
score: 0
type: Answer
has body: Thank you for the easy solution, I am doing it like this now, even though the function is not necessary: function setBoolValue(boolName, state) boolValues[boolName] = state end Example: setBoolValue("secondBool", false)
answers question: http://stackoverflow.com/q/77255197

http://stackoverflow.com/q/77255648
tagged with: neovim
upvote count: 1
score: 1
has title: Best method to convert a vim <expr> value to neovim in lua
type: UnansweredQuestion
tagged with: vim
downvote count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/78694686
answer count: 1
type: Question
has body: I am working to convert from Vim to NeoVim and am trying to transfer commands from my init.vim and .vimrc files to my lua files. I had a command in my .vimrc file that would recognize the term r80= meant that the value of r80= should be replaced with 80 = characters. The command in my .vimrc file was iab <expr> r80= repeat('=', 80) I have the following structure for my nvim file in .config nvim ├── after │ └── plugin │ ├── colors.lua │ ├── fugitive.lua │ ├── harpoon.lua │ ├── lsp.lua │ ├── telescope.lua │ ├── treesitter.lua │ └── undotree.lua ├── init.lua ├── lua │ └── core │ ├── init.lua │ ├── packer.lua │ ├── remap.lua │ └── set.lua └── plugin └── packer_compiled.lua Within the nvim/core/set.lua file I have tried the following vim.cmd("iab <expr> r80= repeat('=', 80)") However this does not appear to work. How can I embed this functionality into Neovim with lua files?
favorite count: 0

http://stackoverflow.com/comment/136290860
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77308279
type: Comment
has text: Wouldn’t a Highlight be better than a selectionbox?

http://stackoverflow.com/a/77331522
accepted answer of: http://stackoverflow.com/q/77331392
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136330825
has body: You can use a string.match on your names and specify the correct regex like so: local file_path = "/tmp/project1/client_config.json" local filename_no_config = string.match(file_path, "/tmp/project[1-9]*/(.+)_config.json") print(filename_no_config) In this case print will write client and will work for project followed by whatever number (even bigger than 2 digits)
has comment: http://stackoverflow.com/comment/136330780
answers question: http://stackoverflow.com/q/77331392
has comment: http://stackoverflow.com/comment/136330632
has comment: http://stackoverflow.com/comment/136330689
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/a/77303114
answers question: http://stackoverflow.com/q/77301309
upvote count: 1
has body: See this string separator: https://stackoverflow.com/a/1647577/12968803 The code by the link takes strings between separators (also both ends). Update: The function returns the list, not iterator: function string:split(pat) pat = pat or '%s+' local result = {} local st, g = 1, self:gmatch("()("..pat..")") local function getter(segs, seps, sep, cap1, ...) st = sep and seps + #sep table.insert(result, self:sub(segs, (seps or 0) - 1)) return cap1 or sep, ... end local function iterate() if st then getter(st, g()) end return result end while st do iterate() end return result end usage: local str = "one#two#three" local list = str:split("#") for i, v in ipairs (list) do print (i, v) end result: 1 one 2 two 3 three
score: 1
type: Answer
downvote count: 0

docker
tags question: http://stackoverflow.com/q/77270819
type: Tag
tag name: docker
tags question: http://stackoverflow.com/q/77846650
tags question: http://stackoverflow.com/q/78373365
tags question: http://stackoverflow.com/q/79205736

http://stackoverflow.com/comment/136240539
type: QuestionComment
has text: Yeah, my compiler was the problem the entire time.
score: 0
comment on: http://stackoverflow.com/q/77277130
type: Comment

http://stackoverflow.com/comment/136437007
comment on: http://stackoverflow.com/q/77391686
has text: @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
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136294731
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77302646
has text: 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..
type: QuestionComment

http://stackoverflow.com/comment/136510987
comment on: http://stackoverflow.com/q/77413427
type: QuestionComment
score: 0
has text: 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()`)
type: Comment

shuffle
tags question: http://stackoverflow.com/q/77384795
type: Tag
tag name: shuffle

http://stackoverflow.com/q/77341991
tagged with: windows-10
has body: While playing YouTube videos, the script saves the cut clips on the RAM rather than a C: directory, I believe. What line should I add to the config.lua file? I use mpv-cut, or there is another scrip that allows me to change the location within C:? 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.
downvote count: 1
type: Question
tagged with: mpv
tagged with: lua
tagged with: video-processing
tagged with: config
upvote count: 0
has answer: http://stackoverflow.com/a/77350229
answer count: 1
type: UnansweredQuestion
favorite count: 0
score: -1
has title: Lua scrip: mpv-cut. change location for cut videos

http://stackoverflow.com/a/77276293
answers question: http://stackoverflow.com/q/77274978
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: If you are interested in dropping down a level, the Lua C API provides lua_insert and lua_rotate (5.3+), both of which can be used to manipulate the stack directly. An example using the former: #include <lua.h> static int reverse(lua_State *L) { int n = lua_gettop(L); for (int i = 1; i < n; i++) lua_insert(L, i); return n; } int luaopen_reverse(lua_State *L) { lua_pushcfunction(L, reverse); return 1; } local reverse = require 'reverse' print(reverse(1, 2, 3, 4)) 4 3 2 1 (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+, lua_insert is a macro around lua_rotate.) Interestingly, there is an internal API function called reverse, used by lua_rotate, which performs this task very efficiently across a stack segment. If one has the ability to change the source code for their installation, then it is possible to modify src/lapi.c with the following function, /* reverse the entire stack segment */ LUA_API void lua_reverse (lua_State *L) { lua_lock(L); int n = lua_gettop(L); if (n > 1) reverse(L, index2stack(L, 1), index2stack(L, n)); lua_unlock(L); } src/lua.h with the following protoype, LUA_API void (lua_reverse) (lua_State *L); src/lbaselib.c with the following function, static int luaB_reverse (lua_State *L) { lua_reverse(L); return lua_gettop(L); } and add {"reverse", luaB_reverse}, to the base_funcs array in src/lbaselib.c, to get access to an efficient, global reverse function: Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio > reverse('hello', 'world', 42) 42 world hello (and a lua_reverse C API function, of course.)

http://stackoverflow.com/comment/136262972
type: QuestionComment
comment on: http://stackoverflow.com/q/77291788
has text: for k, v in pairs(rs) do print(k, v) end
score: 0
type: Comment

http://stackoverflow.com/comment/136329433
type: Comment
comment on: http://stackoverflow.com/q/77329678
score: 0
type: QuestionComment
has text: @Armali <"`,6<,futb=!;/2f*:=> If you include a "" in there, it becomes ""`,6<,futb=!;/2f*:=" as The leading "" is redundant. Is this grammatically correct?

http://stackoverflow.com/comment/136189606
has text: Possible duplicate of https://stackoverflow.com/questions/36489928/lua-attempt-to-index-a-nil-value-avoiding-errors-in-conditionals
comment on: http://stackoverflow.com/q/77251312
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136442516
type: Comment
comment on: http://stackoverflow.com/q/77395261
type: QuestionComment
score: 0
has text: 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.

list
type: Tag
tags question: http://stackoverflow.com/q/77252496
tag name: list
tags question: http://stackoverflow.com/q/78317635

http://stackoverflow.com/comment/136411947
has text: 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". and hit is: local hit = raycast.Position
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77370216
type: AnswerComment

http://stackoverflow.com/a/77328286
score: 0
has body: For anybody who might stumble in the same question as I: So basically arg1 = 'spawnWaterZone', is not the same as spawnzone = spawnWaterZone and that is a little bit obvious, but if you try arg1 = spawnWaterZone that will not work too. That is because you are calling up a variable that is not defined in the file. You need to: Define it in the other file you are calling your function or Set the variable as global
answers question: http://stackoverflow.com/q/77320606
type: Answer

http://stackoverflow.com/comment/136415119
score: 0
type: Comment
has text: 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. Replaced CFrame.new with CFrame.lookAt(hit, startPosition). And see what happens. Although, I do not know why you want to use a CFrame lookat method, since it's a ball.
comment on: http://stackoverflow.com/a/77370216
type: AnswerComment

nested-table
tag name: nested-table
tags question: http://stackoverflow.com/q/77280566
type: Tag

http://stackoverflow.com/a/78533446
upvote count: 1
answers question: http://stackoverflow.com/q/77247864
type: Answer
downvote count: 0
score: 1
has body: 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. this tutorial series has alot of great advice, though its for another platform i still go back to it for help: https://www.youtube.com/playlist?list=PLy4zsTUHwGJIc90UaTKd-wpIH12FCSoLh this article also seems very useful, though i havent read through it all: http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/

http://stackoverflow.com/comment/136262441
type: Comment
has text: i have put the only error i got thats literly the error the nil value
comment on: http://stackoverflow.com/a/77291806
score: 0
type: AnswerComment

http://stackoverflow.com/a/77379676
upvote count: 1
has body: Aside from your lack of using variables, the solution is rather simple: Every instruction takes a certain amount of time to be executed. Functions that interact with the WorldRoot are the major part of instructions that take up the most time. Because you have a lot of :GetPlayerFromCharacter functions, there are chances where the time may deviate from your target 1 second. 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. The 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. 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: ... task.spawn(function() task.wait(1) playersRobbing[player] += cashPerSecond end) -- rest of the code ...
score: 1
accepted answer of: http://stackoverflow.com/q/77377725
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/77377725

http://stackoverflow.com/q/77239619
has title: How to require "__base__/bar" in Lua?
possible better answer: http://stackoverflow.com/a/77243961
accepted answer: http://stackoverflow.com/a/77244580
tagged with: lua
has answer: http://stackoverflow.com/a/77243961
has comment: http://stackoverflow.com/comment/136179190
has answer: http://stackoverflow.com/a/77244580
score: 0
type: AnsweredQuestion
has body: I have a file foo.lua that I'm running with lua foo.lua. The file requires a package __base__/bar like so: -- foo.bar require("__base__/bar") print("foo") File bar.lua is in C:\Temp, which is also the __base__ path. How do I make the require look into C:\Temp whenever a require imports from __base__? I cannot change that that line: require("__base__/bar")! I tried the following in foo.lua which does print the correct path, but somehow it still does not require: -- foo.bar local function custom_loader(name) -- Replace "__base__" with "C:/Temp" in the module name local modified_name = name:gsub("__base__", "C:/Temp") -- Attempt to load the module using the modified name print("DEBUG", package.searchpath(modified_name, "?.lua")) return package.searchpath(modified_name, "?.lua") end table.insert(package.searchers, custom_loader) require("__base__/bar") print("foo") PS C:\Users\Daniel\Documents\source\asset> .\lua52.exe .\foo.lua DEBUG: C:/Temp/bar.lua C:\Users\Daniel\Documents\source\asset\lua52.exe: .\foo.lua:10: module '__base__/bar' not found: no field package.preload['__base__/bar'] no file 'C:\Users\Daniel\Documents\source\asset\lua\__base__/bar.lua' no file 'C:\Users\Daniel\Documents\source\asset\lua\__base__/bar\init.lua' no file 'C:\Users\Daniel\Documents\source\asset\__base__/bar.lua' no file 'C:\Users\Daniel\Documents\source\asset\__base__/bar\init.lua' no file '.\__base__/bar.lua' no file 'C:\Users\Daniel\Documents\source\asset\__base__/bar.dll' no file 'C:\Users\Daniel\Documents\source\asset\loadall.dll' no file '.\__base__/bar.dll' no file 'C:\Users\Daniel\Documents\source\asset\__base__/bar52.dll' no file '.\__base__/bar52.dll'C:/Temp/bar.lua stack traceback: [C]: in function 'require' .\foo.lua:10: in main chunk [C]: in ?
answer count: 2
has comment: http://stackoverflow.com/comment/136170911
has comment: http://stackoverflow.com/comment/136175710
has comment: http://stackoverflow.com/comment/136175879
type: Question

lgi
tag name: lgi
type: Tag
tags question: http://stackoverflow.com/q/77384048
tags question: http://stackoverflow.com/q/79191945

http://stackoverflow.com/comment/136375826
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77247864
has text: @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.

http://stackoverflow.com/a/77252372
answers question: http://stackoverflow.com/q/77249976
score: 1
has body: 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.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 #include <iostream> #include "lua.hpp" #define LUA_FUNC __declspec(dllexport) class CircleShape { float radius_; public: explicit CircleShape(const float radius) : radius_(radius) { std::cout << "CircleShape Constructor Called" << std::endl; } ~CircleShape() { std::cout << "CircleShape Destructor Called" << std::endl; } nodiscard float getRadius() const { return radius_; } }; LUA_FUNC int NewCircleShape(lua_State* L) { const auto radius = static_cast<float>(luaL_checknumber(L, 1)); auto** p_circle_shape = static_cast<CircleShape**>(lua_newuserdata(L, sizeof(CircleShape*))); *p_circle_shape = new CircleShape(radius); luaL_getmetatable(L, "CircleMetaTable"); lua_setmetatable(L, -2); return 1; } LUA_FUNC int DeleteCircleShape(lua_State* L) { auto** p_circle_shape = static_cast<CircleShape**>(luaL_checkudata(L, 1, "CircleMetaTable")); luaL_argcheck(L, *p_circle_shape != NULL, 1, "Error blah"); // if pointer is stored somewhere like a vector remove it now!!! delete* p_circle_shape; return 0; } LUA_FUNC int GetCircleShapeRadius(lua_State* L) { auto** p_circle_shape = static_cast<CircleShape**>(luaL_checkudata(L, 1, "CircleMetaTable")); const float radius = (*p_circle_shape)->getRadius(); lua_pushnumber(L, radius); return 1; } extern "C" LUA_FUNC int luaopen_CircleShapeModule(lua_State * L) { static constexpr luaL_Reg circle_shape_methods[] = { { "getRadius", &GetCircleShapeRadius }, {nullptr, nullptr} }; static constexpr luaL_Reg circle_shape[] = { { "new", &NewCircleShape }, {nullptr…
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/136434574
type: QuestionComment
comment on: http://stackoverflow.com/q/77389377
score: 1
type: Comment
has text: Did you try moving `love.graphics.draw(pause, 235, 100, center)` to the bottom of the `render()` function?

http://stackoverflow.com/a/77405442
answers question: http://stackoverflow.com/q/77403589
has body: So a few more hours in, I found out about ffi.cast and wrote another testcase that combines Light Userdata and ffi. 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. Timings: C++ elapsed time: 0.001683s Sol (Container) elapsed time: 1.020745s Lua (Light Userdata) elapsed time: 0.337135s LuaJit ffi elapsed time: 0.004741s Code: void ffi_perf_test( int32_t iterations, int32_t count ) { sol::state lua; lua.open_libraries( sol::lib::base, sol::lib::package, sol::lib::jit, sol::lib::ffi ); lua_State* p_lua = lua.lua_state(); create_transform_library( p_lua ); int status = luaL_dostring( p_lua, R"( local ffi = require( "ffi" ) ffi.cdef[[ typedef struct Transform { float position_x; float position_y; float position_z; float scale_x; float scale_y; float scale_z; } Transform; ]] function Update( count ) local transforms = Transform:GetLightTransformArray() local ffi_transforms = ffi.cast( "Transform*", transforms ) for i = 0, count-1, 1 do local position_x = ffi_transforms[i].position_x local scale_x = ffi_transforms[i].scale_x position_x = position_x + 0.01 scale_x = scale_x + 0.01 ffi_transforms[i].position_x = position_x ffi_transforms[i].scale_x = scale_x end end )" ); if( status != 0 ) { printf( "Error: %s\n", lua_tostring( p_lua, -1 ) ); return; } auto start = std::chrono::high_resolution_clock::now(); for( int i = 0; i < iterations; ++i ) { lua_getglobal( p_lua, "Update" ); lua_pushinteger( p_lua, count ); lua_pcall( p_lua, 1, 0, 0 ); } auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> elapsed_seconds = end - start; double elapsed = elapsed_seconds.count(); printf( "LuaJit ffi elapsed time: %fs\n", elapsed ); }
score: 0
type: Answer

http://stackoverflow.com/comment/136425159
has text: 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.
score: 1
comment on: http://stackoverflow.com/q/77385301
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/136294347
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77302646
has text: 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.
type: Comment

http://stackoverflow.com/comment/136283474
type: Comment
comment on: http://stackoverflow.com/q/77301309
score: 1
has text: 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 :)
type: QuestionComment

http://stackoverflow.com/comment/136175879
has text: 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")`
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77239619

http://stackoverflow.com/comment/136321450
type: Comment
has text: @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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77325669

data-manipulation
tags question: http://stackoverflow.com/q/77301309
type: Tag
tag name: data-manipulation
tags question: http://stackoverflow.com/q/78638506
tags question: http://stackoverflow.com/q/78659386

http://stackoverflow.com/comment/136187003
type: QuestionComment
comment on: http://stackoverflow.com/q/77249976
score: 1
type: Comment
has text: Show code. There are several ways to pass user data to Lua...

indexing
type: Tag
tag name: indexing
tags question: http://stackoverflow.com/q/77385301
tags question: http://stackoverflow.com/q/78194647
tags question: http://stackoverflow.com/q/79285284

http://stackoverflow.com/comment/136284882
has text: 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...`
type: Comment
comment on: http://stackoverflow.com/q/77301309
score: 0
type: QuestionComment

video-processing
tags question: http://stackoverflow.com/q/77341991
type: Tag
tag name: video-processing
tags question: http://stackoverflow.com/q/78672216

http://stackoverflow.com/comment/136235415
type: QuestionComment
has text: Show your code that isn't working.
comment on: http://stackoverflow.com/q/77277130
score: 2
type: Comment

resty
tag name: resty
type: Tag
tags question: http://stackoverflow.com/q/77257804

http://stackoverflow.com/comment/136465869
comment on: http://stackoverflow.com/q/77404263
type: Comment
score: 0
has text: 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.
type: QuestionComment

http://stackoverflow.com/a/77291806
answers question: http://stackoverflow.com/q/77291788
upvote count: 1
has comment: http://stackoverflow.com/comment/136260817
score: 1
has body: I see you have a variable set as aplied and you have referenced applied (once with a double p) which won't refer to the original variable aplied (with a single p). so applied is a nil value since it isn't set to anything. related line of code for your reference: elseif aplied ~= color and 0 then rs.setBundledOutput(side, colors.combine(--&gt;applied&lt;--, color))
has comment: http://stackoverflow.com/comment/136262441
has comment: http://stackoverflow.com/comment/136261072
type: Answer
downvote count: 0

fisher-yates-shuffle
type: Tag
tag name: fisher-yates-shuffle
tags question: http://stackoverflow.com/q/77384795

http://stackoverflow.com/a/77362581
has body: 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 isn't live. If you wish to disable this you can do so in the Game Settings under the Home tab. Otherwise, you can test the game from the Roblox Player and all DataStores should operate as intended.
answers question: http://stackoverflow.com/q/77327059
score: 0
type: Answer

http://stackoverflow.com/a/77414996
accepted answer of: http://stackoverflow.com/q/77388159
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Based on @koyaanisqatsi answer, I found out how to get things working in Go. Go code example: package main import ( "fmt" "github.com/yuin/gopher-lua" ) type Person struct { Name string GivenName string Street string PostalCode string City string } func main() { p := &Person{ Name: "Mustermann", GivenName: "Max", Street: "Sackgasse 19", PostalCode: "36304", City: "Alsfeld", } L := lua.NewState() defer L.Close() if err := L.DoFile("sample.lua"); err != nil { panic(err) } t := L.NewTable() t.RawSetString("name", lua.LString(p.Name)) t.RawSetString("given_name", lua.LString(p.GivenName)) t.RawSetString("street", lua.LString(p.Street)) t.RawSetString("postal_code", lua.LString(p.PostalCode)) t.RawSetString("city", lua.LString(p.City)) if err := L.CallByParam(lua.P{ Fn: L.GetGlobal("call_me"), NRet: 1, Protect: true, }, t); err != nil { panic(err) } ret := L.Get(-1) // returned value L.Pop(1) // remove received value fmt.Println("The result of the Lua function is:", ret) } sample.lua file: function call_me(tbl) print(tbl.name) print(tbl.given_name) print(tbl.street) print(tbl.postal_code) print(tbl.city) return 0 end Result: Mustermann Max Sackgasse 19 36304 Alsfeld The result of the Lua function is: 0
answers question: http://stackoverflow.com/q/77388159
upvote count: 1
score: 1

http://stackoverflow.com/a/77244125
type: AcceptedAnswer
type: Answer
downvote count: 0
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77240847
answers question: http://stackoverflow.com/q/77240847
score: 1
has body: The "traversing JSON" functionality is useful here. local json = require"json" local s = [[ { "data": { "id": 1, "attributes": { "name": "John", "details": { "age": 30, "address": { "street": "123 Main St", "city": "Anytown" } } } } } ]] local Person = {} json.traverse(s, function (path, json_type, value, pos, pos_last) local path_str = table.concat(path, "/") print("DEBUG:", path_str, json_type, value, pos, pos_last) if json_type == "number" or json_type == "string" then Person[path[#path]] = value end end ) print"RESULT" for k,v in pairs(Person) do print(k, v) end Output: DEBUG: object nil 1 nil DEBUG: data object nil 14 nil DEBUG: data/id number 1 28 28 DEBUG: data/attributes object nil 51 nil DEBUG: data/attributes/name string John 70 75 DEBUG: data/attributes/details object nil 98 nil DEBUG: data/attributes/details/age number 30 119 120 DEBUG: data/attributes/details/address object nil 146 nil DEBUG: data/attributes/details/address/street string 123 Main St 173 185 DEBUG: data/attributes/details/address/city string Anytown 211 219 RESULT name John street 123 Main St city Anytown age 30 id 1 The library is here

http://stackoverflow.com/comment/136443236
score: 5
comment on: http://stackoverflow.com/q/77395261
type: QuestionComment
type: Comment
has text: `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

http://stackoverflow.com/comment/136492460
score: 0
type: QuestionComment
has text: Start by opening the base library: `lua.open_libraries(sol::lib::base);`
comment on: http://stackoverflow.com/q/77404263
type: Comment

krakend
tags question: http://stackoverflow.com/q/77253099
tags question: http://stackoverflow.com/q/77330371
tag name: krakend
type: Tag
tags question: http://stackoverflow.com/q/79383994

http://stackoverflow.com/comment/136425015
comment on: http://stackoverflow.com/q/77384795
type: Comment
has text: 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.
type: QuestionComment
score: 0

http://stackoverflow.com/a/77325537
score: 0
type: Answer
has body: Vector arithmetic is pretty simple once you know the trick. You just apply each operation to each component of the vectors. For example: local a = Vector3.new(1, 2, 3) local b = Vector3.new(4, 5, 6) print(a + b) -- returns (5, 7, 9) print(a - b) -- returns (-3, -3, -3) print(a * b) -- returns (4, 10, 18) print(a / b) -- returns (0.25, 0.4, 0.5) So if you wanted to perform an operation on just one component of the vector, you can apply a mask 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. local direction = (endPosition - startPosition).Unit * range if raycast then local pos = raycast.Instance.Position local mask = Vector3.new(0, 0, 1) -- subtract the position's z value from the direction direction -= (pos * mask) end
answers question: http://stackoverflow.com/q/77320254

vector
tags question: http://stackoverflow.com/q/77355929
tags question: http://stackoverflow.com/q/77320254
tag name: vector
type: Tag
tags question: http://stackoverflow.com/q/77939546
tags question: http://stackoverflow.com/q/78129002
tags question: http://stackoverflow.com/q/79137049

http://stackoverflow.com/comment/136423066
has text: Please make a second thread for your second question.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77370216

http://stackoverflow.com/comment/136493304
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77413427
has text: 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.)

http://stackoverflow.com/a/77326403
has comment: http://stackoverflow.com/comment/136327286
score: 1
has comment: http://stackoverflow.com/comment/136321470
upvote count: 1
has comment: http://stackoverflow.com/comment/136321512
has comment: http://stackoverflow.com/comment/136321505
downvote count: 0
answers question: http://stackoverflow.com/q/77325669
has comment: http://stackoverflow.com/comment/136321497
has body: 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: Lua name = "id of entry" array1 = {1.1, 1.2, 1.3} array2 = {2.1, 2.2, 2.3, 2.4} c_function(name, array1, array2) C/C++ static int c_function(lua_State* L) { const char* name = luaL_checkstring(L, 1); std::vector<double> arr1; std::vector<double> arr2; // array1 - pay attention to use of 2, -1 and 1. if (lua_istable(L, 2) != 0) { unsigned int size = lua_rawlen(L, 2); arr1.resize(size); for (unsigned int i = 0; i < size; i++) { lua_rawgeti(L, 2, i + 1); // Lua uses 1 based indices. arr1[i] = lua_tonumber(L, -1); lua_pop(L, 1); } } // array2 - pay attention to use of 3, -1 and 1. if (lua_istable(L, 3) != 0) { unsigned int size = lua_rawlen(L, 3); arr2.resize(size); for (unsigned int i = 0; i < size; i++) { lua_rawgeti(L, 3, i + 1); // Lua uses 1 based indices. arr2[i] = lua_tonumber(L, -1); lua_pop(L, 1); } } Calculate(name, arr1, arr2); return 0; } void Calculate(const char* name, const std::vector<double>& arr1, const std::vector<double>& arr2) { // Do stuff here. }
has comment: http://stackoverflow.com/comment/136321606
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77325669

metatable
tags question: http://stackoverflow.com/q/77280566
tag name: metatable
tags question: http://stackoverflow.com/q/77251312
type: Tag
tags question: http://stackoverflow.com/q/77941484
tags question: http://stackoverflow.com/q/78767348

http://stackoverflow.com/q/77292433
downvote count: 0
tagged with: fluent-bit
score: 2
tagged with: lua
tagged with: kubernetes
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78576628
upvote count: 2
answer count: 1
has title: Fluentbit S3 Configuration: How to Get Log Paths Similar to FluentD?
tagged with: amazon-s3
tagged with: fluent-bit-rewrite-tag
favorite count: 0
has body: 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. FluentD config: # environment ${record["kubernetes"]["namespace_name"]} # pod ${record["kubernetes"]["pod_name"]} # podid ${record["kubernetes"]["pod_id"]} # container ${record["kubernetes"]["container_name"]} # # </filter> # <match **> # @type s3 # s3_bucket logs.bucket.us-east-1.domain.com # s3_region us-east-1 # s3_object_key_format %Y/%m/%d/${environment}/${container}/${container}-${environment}-%Y%m%d-%H%M-${podid}-%{index}.%{file_extension} # store_as text Fluentbit Config: [INPUT] Name tail Tag s3logs.* Path /var/log/containers/*.log parser cri multiline.parser cri Mem_Buf_Limit 5MB Skip_Long_Lines On Skip_Empty_Lines On Refresh_Interval 10 [FILTER] Name kubernetes Match s3logs.* Merge_Log On K8S-Logging.Parser On K8S-Logging.Exclude On Keep_Log Off Labels Off Annotations Off [FILTER] Name record_modifier Match s3logs.* Record cluster_name ${CLUSTER} [FILTER] name lua alias set_std_keys match s3logs.* script /fluent-bit/scripts/s3_path.lua call set_std_keys [FILTER] name rewrite_tag match s3logs.* rule $log ^.*$ s3.$namespace_name.$app_name.$container_name.$pod_id true outputs: | [OUTPUT] Name s3 Match s3logs.* bucket logs.bucket.us-east-1.domain.com region us-east-1 s3_key_format /%Y/%m/%d/$TAG[1]/$TAG[2]/$TAG[3]/$TAG[3]-$TAG[1]-%Y%m%d-%H%M-${podid}.txt store_dir /var/log/fluentbit-s3-buffers total_file_size 256MB upload_timeout 2m use_put_object On preserve_data_ordering On S3 Lua script - based on my reading you have to use a LUA script to extract K8S metada: function set_std_keys(tag, timestamp, record) -- Pull up cluster if (record["cluster_name"] ~= nil) then record["cluster_name"] = record["cluster_name"] else record["cluster_name"] = "mycluster" end if (record["kubernetes"] ~= nil) then kube = record["kubernetes"] -- Pull up namespace if (kube["namespace_name"] ~= nil and string.len(kube["…
type: Question

http://stackoverflow.com/comment/136316457
comment on: http://stackoverflow.com/q/77322628
type: Comment
has text: 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?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/136187510
has text: 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.
comment on: http://stackoverflow.com/q/77249976
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/136321470
score: 1
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/77326403
type: AnswerComment

cjson
tags question: http://stackoverflow.com/q/77240847
tag name: cjson
type: Tag
tags question: http://stackoverflow.com/q/77705072

http://stackoverflow.com/comment/136197394
comment on: http://stackoverflow.com/a/77253388
score: 0
type: AnswerComment
has text: Yes, I overlooked the greedy nature of left recursion, and I will eliminate the problem of ATS The test code is complete
type: Comment

http://stackoverflow.com/comment/136320380
has text: 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);`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77325669

require
tag name: require
type: Tag
tags question: http://stackoverflow.com/q/77240666
tags question: http://stackoverflow.com/q/78318512
tags question: http://stackoverflow.com/q/78362205
tags question: http://stackoverflow.com/q/78831240
tags question: http://stackoverflow.com/q/79059982

http://stackoverflow.com/comment/136442176
comment on: http://stackoverflow.com/q/77395261
type: Comment
score: 0
has text: You are right. I am using sol2, it should get translated automatically though.
type: QuestionComment

http://stackoverflow.com/comment/136282902
type: Comment
has text: 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: rtcp_dissector:call(buffer(7):tvb(8), pinfo, subtree)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77302646

http://stackoverflow.com/a/77258285
has body: I found a solution: I have to put ngx.exec(ngx.var.file_path) in the end to return the ball to NGINX.
answers question: http://stackoverflow.com/q/77257804
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77257804

luajit
tags question: http://stackoverflow.com/q/77403589
tag name: luajit
type: Tag
tags question: http://stackoverflow.com/q/77709503
tags question: http://stackoverflow.com/q/77924312
tags question: http://stackoverflow.com/q/78430344
tags question: http://stackoverflow.com/q/78330939
tags question: http://stackoverflow.com/q/78615298
tags question: http://stackoverflow.com/q/78863482
tags question: http://stackoverflow.com/q/78839677
tags question: http://stackoverflow.com/q/78765913
tags question: http://stackoverflow.com/q/78860683
tags question: http://stackoverflow.com/q/79021129
tags question: http://stackoverflow.com/q/78985787
tags question: http://stackoverflow.com/q/79398648
tags question: http://stackoverflow.com/q/79516964
tags question: http://stackoverflow.com/q/79544735

http://stackoverflow.com/comment/136335621
type: QuestionComment
has text: 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).
comment on: http://stackoverflow.com/q/77329678
type: Comment
score: 0

http://stackoverflow.com/a/77371375
has body: 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. -- Let's say you want to add a new moderator to the system -- You would go to the "settings.Ranks" table and find the "Moderators" section -- Add the new moderator's information to the "Users" list: settings.Ranks["Moderators"].Users = { "ExistingModerator", "NewModerator:1234567", 7654321, -- User ID "Group:RobloxDevelopers:3", -- Group ID and rank "Item:9876543", -- Item ID } -- Now, "NewModerator" with User ID 1234567, User ID 7654321, and those in group "RobloxDevelopers" with rank 3, or owning the item with ID 9876543 will be moderators. -- You can similarly modify other settings as needed to suit your requirements.
answers question: http://stackoverflow.com/q/77356875
score: 0
type: Answer

http://stackoverflow.com/a/77321912
type: AcceptedAnswer
type: Answer
has body: I tried using Lazy instead of Packer and everything works fine. I have no clue why Packer failed but I wanted to switch to Lazy sooner or later anyways. EDIT: The icons didn't show because I wasn't using a nerd font. See here: https://nerdfonts.com
answers question: http://stackoverflow.com/q/77287266
accepted answer of: http://stackoverflow.com/q/77287266
score: 0

http://stackoverflow.com/a/78576628
answers question: http://stackoverflow.com/q/77292433
type: Answer
score: 0
has body: About rewrite See https://docs.fluentbit.io/manual/pipeline/filters/rewrite-tag#configuration-example After you made a rewrite with rule $log ^.*$ s3.$namespace_name.$app_name.$container_name.$pod_id true 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 So output should look like: outputs: | [OUTPUT] Name s3 Match s3.* # etc About extension See https://docs.fluentbit.io/manual/pipeline/outputs/s3#allowing-a-file-extension-in-the-s3-key-format-with-usduuid You should change line to s3_key_formatm /%Y/%m/%d/$TAG[1]/$TAG[2]/$TAG[3]/$TAG[3]-$TAG[1]-%Y%m%d-%H%M-${podid}-$UUID.txt

http://stackoverflow.com/comment/136444232
has text: 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".
type: AnswerComment
comment on: http://stackoverflow.com/a/77388694
score: 3
type: Comment

hover
tags question: http://stackoverflow.com/q/77369921
tag name: hover
type: Tag

http://stackoverflow.com/q/77403589
type: Question
downvote count: 0
has title: How to get better performance out of Lua when iterating array of structs
tagged with: lua
has answer: http://stackoverflow.com/a/77405442
tagged with: c++
score: 2
answer count: 1
type: UnansweredQuestion
tagged with: lua-userdata
tagged with: performance
tagged with: luajit
favorite count: 0
upvote count: 2
has body: Problem: Iterating an array of structs in Lua and manipulating the data, that is than used in C++ later on. Backstory: I did some performance testing this week and I am kind of disappointed by the performance of Lua. My 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. Testcase: I 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. Timings: C++ elapsed time: 0.002736s Sol (Container) elapsed time: 0.999166s Lua (Light Userdata) elapsed time: 0.338946s Question: Is this something to expect or is there any chance to get close to native C++ performance for a usecase like this? Info: LuaJit (latest master branch) sol2 (latest master branch) Compiler: MSVC19 OS: Windows 11 Code: #define SOL_ALL_SAFETIES_ON 0 #define SOL_USING_CXX_LUAJIT 1 #include <sol/sol.hpp> #include <chrono> struct Transform { float position_x; float position_y; float position_z; float scale_x; float scale_y; float scale_z; }; Transform* p_transforms = nullptr; std::vector<Transform*> GetTransformPointerArray( int32_t count ) { std::vector<Transform*> transform_pointers( count ); for( int i = 0; i < transform_pointers.size(); ++i ) transform_pointers[ i ] = &p_transforms[ i ]; return transform_pointers; } void c_Update( int32_t count ) { for( int i = 0; i < count; ++i ) { Transform* p_transform = &p_transforms[ i ]; p_transform->position_x += 0.01f; p_transform->scale_x += 0.01f; } } void c_perf_test( int32_t iterations, int32_t count ) { auto start = std::chrono::high_resolution_clock::now(); for( int i = 0; i < iterations; ++i ) c_Updat…

http://stackoverflow.com/comment/136282380
type: Comment
comment on: http://stackoverflow.com/q/77301309
has text: The function renames the "track" keys to "aura" keys
score: 0
type: QuestionComment

admin
tag name: admin
type: Tag
tags question: http://stackoverflow.com/q/77356875

collision-detection
type: Tag
tag name: collision-detection
tags question: http://stackoverflow.com/q/77247864

http://stackoverflow.com/comment/136284925
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77301309
score: 1
type: Comment

http://stackoverflow.com/comment/136330632
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77331522
has text: 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).
type: AnswerComment

http://stackoverflow.com/comment/136284818
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77301309
has text: 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.

http://stackoverflow.com/a/77364344
has body: change the Content-Length resolved the problem. response:body(newBody) response:headers("Content-Length", tostring(string.len(newBody)))
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77330371

http://stackoverflow.com/a/77763154
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/77302144
answers question: http://stackoverflow.com/q/77302144
has body: Thanks, Ivo, my bad. local function getCircumcircle (x1, y1, x2, y2, x3, y3) local d = 2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2)) local t1, t2, t3 = x1*x1+y1*y1, x2*x2+y2*y2, x3*x3+y3*y3 local x = (t1*(y2-y3)+t2*(y3-y1)+t3*(y1-y2))/d local y = (t1*(x3-x2)+t2*(x1-x3)+t3*(x2-x1))/d local radius = math.sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y)) return x,y,radius end
type: AcceptedAnswer
type: Answer
upvote count: 1

http://stackoverflow.com/q/77404263
type: Question
answer count: 0
tagged with: lua
has body: 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. However, now I want to use sol2, since the other one seems abandoned. So, what I want to do is: Define an abstract class in C++ Create another class, and in this class, I would have a method that takes instances of classes that implement the interface. In a method of this same class, be able to call the abstract method, which will point to the Lua implementation. I'm not quite sure if I'm making a mistake in the Lua code, but I remember this being possible. Lua code: local Actor = setmetatable({}, {__index = loopable}) function Actor:new() local obj = {} setmetatable(obj, self) self.__index = self return obj end function Actor:loop() print("Actor:loop") -- It should print this on `e:run()` end local a = Actor:new() local e = engine:new() e:add_loopable(a) e:run() Where loopable is my abstract class. C++ sol2 code: lua.new_usertype<engine>("engine", "add_loopable", &engine::add_loopable, "run", &engine::run); // I do not know how to declare a abstract class. lua.new_usertype<loopable>("loopable", "loop", &loopable::loop); Minimal reproducible example: https://godbolt.org/z/6n71v3Pq3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136465869
tagged with: c++
has title: Using Sol2 to expose an interface to Lua and implementing the method in Lua
score: 0
has comment: http://stackoverflow.com/comment/136492460

http://stackoverflow.com/a/77243961
type: Answer
upvote count: 1
has body: Since require is just a variable and therefore can be reassigned just like any other variables, I think you can monkeypatch it as follow: local _require = require require = function(name) local modified_name = name:gsub('__base__', 'C:/Temp') print(modified_name) return _require(modified_name) end Try it: local bar = require('__base__/bar') print(bar) -- 'C:/Temp/bar' -- table: 0x1ffffff
downvote count: 0
has comment: http://stackoverflow.com/comment/136179180
score: 1
answers question: http://stackoverflow.com/q/77239619

http://stackoverflow.com/comment/136315117
has text: From cursory glance, [this](https://github.com/yuin/gopher-lua#sharing-lua-byte-code-between-lstates) looks like what you're after, no?
comment on: http://stackoverflow.com/q/77322628
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77244580
upvote count: 1
type: AcceptedAnswer
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/77239619
has body: Your idea is correct, but you incorrectly defined the searcher, as stated in the document The function can return another function (the module loader) plus an extra value that will be passed to that loader, or a string explaining why it did not find that module (or nil if it has nothing to say). Since you returned a string, it is equivalent to telling require that your search failed. Here's a working version: local function custom_loader(name) return function(name) local modified_name = name:gsub("__base__", "C:/Temp") modified_name = package.searchpath(modified_name, "?.lua") package.loaded[name] = dofile(modified_name) end end
downvote count: 0
answers question: http://stackoverflow.com/q/77239619

http://stackoverflow.com/a/77277202
type: Answer
has body: I made a small test and seems to be working fine here. local t = { blah = "hello" } function string.insert(originalString, insertString, position) position = math.min(math.max(position, 1), #originalString + 1) return originalString:sub(1, position - 1) .. insertString .. originalString:sub(position) end print("Before -> " ..t.blah) t.blah = t.blah:insert(" ", 3) print("After -> " ..t.blah) -- output: Before -> hello -- output: After -> he llo
has comment: http://stackoverflow.com/comment/136235114
has comment: http://stackoverflow.com/comment/136237962
score: 0
answers question: http://stackoverflow.com/q/77277130

http://stackoverflow.com/a/77377054
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77355213
answers question: http://stackoverflow.com/q/77355213
has body: I see you're using the CFrame.lookAt function, if you read the documentation, you can find out the following: 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). And if you read a little bit more up: At high pitch angles (around 82 degrees), you may experience numerical instability. If this is an issue, or if you require a different "up" vector, use CFrame.fromMatrix() to more accurately construct the CFrame. Additionally, if lookAt is directly above pos (pitch angle of 90 degrees), the "up" vector switches to the X axis. This would mean it is expected behavior, as the numerical instability, combined with the velocity settings in your bodygyro, cause this flinging. 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.
score: 0

http://stackoverflow.com/comment/136409336
comment on: http://stackoverflow.com/a/77370216
type: Comment
score: 0
has text: Please edit your comment to add the modified code where you swapped the variable, and defined the hit variable.
type: AnswerComment

http://stackoverflow.com/comment/136443458
type: Comment
comment on: http://stackoverflow.com/q/77395261
type: QuestionComment
score: 0
has text: Got it. So, I am going to change my approach and store the fn on the class instead of passing it as void *. Thanks!

http://stackoverflow.com/comment/136238052
has text: 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.
comment on: http://stackoverflow.com/q/77277130
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/136191180
type: AnswerComment
has text: 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
comment on: http://stackoverflow.com/a/77252531
score: 2
type: Comment

wireshark
type: Tag
tags question: http://stackoverflow.com/q/77302646
tag name: wireshark
tags question: http://stackoverflow.com/q/78283791
tags question: http://stackoverflow.com/q/78432428
tags question: http://stackoverflow.com/q/78709542
tags question: http://stackoverflow.com/q/79020824
tags question: http://stackoverflow.com/q/79138011
tags question: http://stackoverflow.com/q/79126377

http://stackoverflow.com/comment/136426038
score: 0
comment on: http://stackoverflow.com/q/77384795
type: QuestionComment
has text: 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
type: Comment

http://stackoverflow.com/a/77636876
answers question: http://stackoverflow.com/q/77327059
has body: I have found out that everything was client side and none of the data was being on the server. now it works fine.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/77327059

http://stackoverflow.com/a/77320646
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77320254
has body: Simply evoke the vector position you want to use. if you have two vectors: coord1 = vector3(11, 2, 0) coord2 = vector3(1, 1, 1) you can do mathematical operations as follow print(coord1.x - coord2.x) &gt;&gt;10
answers question: http://stackoverflow.com/q/77320254
score: 0

windows
tag name: windows
tags question: http://stackoverflow.com/q/77265289
type: Tag
tags question: http://stackoverflow.com/q/78349259
tags question: http://stackoverflow.com/q/78882864
tags question: http://stackoverflow.com/q/79059064
tags question: http://stackoverflow.com/q/79537123

http://stackoverflow.com/a/77342417
answers question: http://stackoverflow.com/q/77340179
score: 1
has body: 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. 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. 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. 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. 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.
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/136170911
type: Comment
score: 1
has text: I assume you can monkeypatch `require()`? If so, would a `_require = require`/`require = fucntion() ... end` solution work for you?
comment on: http://stackoverflow.com/q/77239619
type: QuestionComment

http://stackoverflow.com/a/79085480
has body: What I did is just added neotest-jest.lua file: return { "haydenmeade/neotest-jest", }
answers question: http://stackoverflow.com/q/77405690
score: 0
type: Answer

http://stackoverflow.com/comment/136262506
type: Comment
score: 0
has text: 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?
comment on: http://stackoverflow.com/q/77291788
type: QuestionComment

openresty
type: Tag
tag name: openresty
tags question: http://stackoverflow.com/q/77270819
tags question: http://stackoverflow.com/q/78225022
tags question: http://stackoverflow.com/q/78383151
tags question: http://stackoverflow.com/q/78466371
tags question: http://stackoverflow.com/q/78678801
tags question: http://stackoverflow.com/q/78677462
tags question: http://stackoverflow.com/q/78673757
tags question: http://stackoverflow.com/q/78778829
tags question: http://stackoverflow.com/q/78909274
tags question: http://stackoverflow.com/q/79063646
tags question: http://stackoverflow.com/q/79370237
tags question: http://stackoverflow.com/q/79338135
tags question: http://stackoverflow.com/q/79516773

mysql
type: Tag
tags question: http://stackoverflow.com/q/77341061
tag name: mysql
tags question: http://stackoverflow.com/q/77879660
tags question: http://stackoverflow.com/q/78544712
tags question: http://stackoverflow.com/q/78504603
tags question: http://stackoverflow.com/q/79285284

http://stackoverflow.com/a/77313568
accepted answer of: http://stackoverflow.com/q/77312058
answers question: http://stackoverflow.com/q/77312058
type: AcceptedAnswer
type: Answer
has body: You can define a special error handler location that will route a request to the approriate error page: location /error-handler { content_by_lua_block { local var_value = os.getenv('YOUR_ENV_VAR') if var_value == 'some_condition' then ngx.exec('/error-pages/404.html') else ngx.exec('/error-pages/404-2.html') end } } error_page 404 /error-handler; }
downvote count: 0
upvote count: 1
score: 1

mediawiki-extensions
tags question: http://stackoverflow.com/q/77383213
type: Tag
tag name: mediawiki-extensions

http://stackoverflow.com/comment/136235114
type: AnswerComment
score: 0
has text: Oops, I meant inserting a string only containing spaces (like this: " ") in a table, not inserting a space in a string in a table.
comment on: http://stackoverflow.com/a/77277202
type: Comment

go
tags question: http://stackoverflow.com/q/77322628
tags question: http://stackoverflow.com/q/77388159
type: Tag
tag name: go
tags question: http://stackoverflow.com/q/77533955
tags question: http://stackoverflow.com/q/79166496
tags question: http://stackoverflow.com/q/79360326

http://stackoverflow.com/comment/136321512
type: Comment
type: AnswerComment
score: 0
has text: @Oka - Ahhh, yeah. I looked right past that.
comment on: http://stackoverflow.com/a/77326403

package
tags question: http://stackoverflow.com/q/77240666
tag name: package
type: Tag

http://stackoverflow.com/a/77274979
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/77274978
upvote count: 2
type: Answer
has body: Using a temporary table: local function reverse(...) local n = select(&quot;#&quot;, ...) local t = {...} -- Reverse the table for i = 1, n/2 do local j = n - i + 1 t[i], t[j] = t[j], t[i] end return unpack(t, 1, n) end or using a helper function which picks the n-th element, prepends that to a new vararg, and recurses until n = 0: local function h(n, ...) if n == 0 then return end return select(n, ...), h(n - 1, ...) end local function reverse(...) return h(select(&quot;#&quot;, ...), ...) end

http://stackoverflow.com/comment/136320277
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/77325669
score: 0
type: QuestionComment

http://stackoverflow.com/a/77308279
has body: local tool=script.Parent local char=tool.Parent;char=char:IsA"Model"and char or char.Parent.Character local v=Instance.new("SelectionBox",char) v.Visible=false v.Adornee=char tool.Equipped:Connect(function() v.Visible=true end) tool.Unequipped:Connect(function() v.Visible=false end)
answers question: http://stackoverflow.com/q/77298079
has comment: http://stackoverflow.com/comment/136290860
score: 0
type: Answer

radius
tags question: http://stackoverflow.com/q/77302144
tag name: radius
type: Tag

http://stackoverflow.com/a/77252271
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77251948
answers question: http://stackoverflow.com/q/77251948
has body: It is working as intended, the reason it does not have the desired outcome is because "w" is not a valid parameter for the method IsModifierPressed() which (as the name implies) checks modifier keys not normal keys, thus it returns false for "w". The api reference is here and lists all valid modifiers for your convenience on page 17.
downvote count: 0
type: AcceptedAnswer
type: Answer

config
tags question: http://stackoverflow.com/q/77341991
tag name: config
type: Tag
tags question: http://stackoverflow.com/q/77490875
tags question: http://stackoverflow.com/q/78831855
tags question: http://stackoverflow.com/q/79407984

http://stackoverflow.com/comment/136437621
type: Comment
has text: 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`.)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77391686

wireshark-dissector
tags question: http://stackoverflow.com/q/77302646
tag name: wireshark-dissector
type: Tag
tags question: http://stackoverflow.com/q/78283791
tags question: http://stackoverflow.com/q/78709542
tags question: http://stackoverflow.com/q/78672665
tags question: http://stackoverflow.com/q/79020824
tags question: http://stackoverflow.com/q/79138011
tags question: http://stackoverflow.com/q/79278778

http://stackoverflow.com/comment/136320296
has text: @Luatic - How do I pass the Lua array in if it's too big? What is the cutoff for `lua_State` stacks?
type: Comment
comment on: http://stackoverflow.com/q/77325669
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136430497
type: Comment
score: 0
type: QuestionComment
has text: @UliSchlachter You were right, check my answer.
comment on: http://stackoverflow.com/q/77384048

http://stackoverflow.com/a/79053304
score: 0
type: Answer
has body: In case you have not yet found a solution, it appears there is an error in your move_player() function. box_hit(p.x,newy, p.w,p.h, w.wx,w.wy, w.ww,w.wh) 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: for w in all(walls) do box_hit(p.x,newy, p.w,p.h, w.wx,w.wy, w.ww,w.wh) end
answers question: http://stackoverflow.com/q/77247864

http://stackoverflow.com/a/78694686
answers question: http://stackoverflow.com/q/77255648
score: 0
type: Answer
has body: It's unfortunately not very easy to discover in the neovim helpfiles (yet), but abbreviations can be set from lua by using vim.keymap.set or nvim_set_keymap, just like normal mappings. The special modes "ia", "ca" or "!a" are the equivalent of iabbrev, cabbrev or both. These are shown in :h nvim_set_keymap (v0.10.0): Parameters: • {mode} Mode short-name (map command prefix: "n", "i", "v", "x", …) or "!" for :map!, or empty string for :map. "ia", "ca" or "!a" for abbreviation in Insert mode, Cmdline mode, or both, respectively What you want to do can be achieved with: :=vim.keymap.set("ia", "r80=", "repeat('=', 80)", { expr = true })

http://stackoverflow.com/comment/136349563
type: Comment
comment on: http://stackoverflow.com/a/77341135
score: 0
has text: @Md.SaifulIslam It's really tricky to handle all types of errors. I have updated my answer with more information.
type: AnswerComment

http://stackoverflow.com/a/77402796
has body: So I found out what to do. I have search for Intellisense settings and disable there. Easy (once you know what to look for)!
answers question: http://stackoverflow.com/q/77369921
score: 0
type: Answer

http://stackoverflow.com/comment/136424994
has text: 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.
comment on: http://stackoverflow.com/q/77384795
type: Comment
score: 0
type: QuestionComment

awesome-wm
type: Tag
tag name: awesome-wm
tags question: http://stackoverflow.com/q/77384048
tags question: http://stackoverflow.com/q/78394057
tags question: http://stackoverflow.com/q/79217152
tags question: http://stackoverflow.com/q/79298598

http://stackoverflow.com/a/77386995
has body: Include both variants in the condition: (arg == 1 and IsMouseButtonPressed(3) or arg == 2 and IsMouseButtonPressed(1)) function OnEvent(event, arg) if event == "PROFILE_ACTIVATED" then EnablePrimaryMouseButtonEvents(true) elseif event == "MOUSE_BUTTON_PRESSED" and (arg == 1 and IsMouseButtonPressed(3) or arg == 2 and IsMouseButtonPressed(1)) then repeat MoveMouseRelative(1, 1) Sleep(10) until not IsMouseButtonPressed(1) end end
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77381239

function
tags question: http://stackoverflow.com/q/77240666
type: Tag
tags question: http://stackoverflow.com/q/77255197
tag name: function
tags question: http://stackoverflow.com/q/77438652
tags question: http://stackoverflow.com/q/77745823
tags question: http://stackoverflow.com/q/77789995
tags question: http://stackoverflow.com/q/78633143
tags question: http://stackoverflow.com/q/78863937
tags question: http://stackoverflow.com/q/78927835
tags question: http://stackoverflow.com/q/79358250

http://stackoverflow.com/comment/136321505
type: Comment
comment on: http://stackoverflow.com/a/77326403
has text: Operators: `new` and `delete`. And technically `nullptr`, until [C23](https://en.cppreference.com/w/c/language/nullptr).
score: 0
type: AnswerComment

generate
type: Tag
tags question: http://stackoverflow.com/q/77252496
tag name: generate
tags question: http://stackoverflow.com/q/79386149

http://stackoverflow.com/comment/136436979
type: Comment
comment on: http://stackoverflow.com/q/77391686
score: 0
has text: `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...)
type: QuestionComment

http://stackoverflow.com/comment/136320275
comment on: http://stackoverflow.com/q/77325669
type: Comment
has text: @user253751 - Yes, I am aware of that.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/136321606
comment on: http://stackoverflow.com/a/77326403
type: Comment
score: 0
has text: Update - I've switched over to C++.
type: AnswerComment

http://stackoverflow.com/comment/136352389
type: Comment
comment on: http://stackoverflow.com/a/77307361
score: 0
has text: Thx! Apparently I had tmux binding on those keys.
type: AnswerComment

http://stackoverflow.com/comment/136439657
type: Comment
score: 0
has text: 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.
comment on: http://stackoverflow.com/q/77388159
type: QuestionComment

http://stackoverflow.com/comment/136321339
has text: @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
type: Comment
comment on: http://stackoverflow.com/q/77325669
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136316918
score: 0
type: QuestionComment
has text: 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. :-)
comment on: http://stackoverflow.com/q/77322628
type: Comment

http://stackoverflow.com/comment/136293280
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/77302646
score: 0
type: QuestionComment

vim
tags question: http://stackoverflow.com/q/77311853
type: Tag
tag name: vim
tags question: http://stackoverflow.com/q/77255648
tags question: http://stackoverflow.com/q/77429315
tags question: http://stackoverflow.com/q/77671751
tags question: http://stackoverflow.com/q/78305561
tags question: http://stackoverflow.com/q/79303030

http://stackoverflow.com/comment/136297851
score: 0
type: QuestionComment
has text: 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
comment on: http://stackoverflow.com/q/77312520
type: Comment

http://stackoverflow.com/comment/136281528
comment on: http://stackoverflow.com/q/77301309
score: 1
type: Comment
has text: You may not add new keys while traversing the table. Your `probe` function currently exhibits undefined behavior.
type: QuestionComment

computercraft
type: Tag
tag name: computercraft
tags question: http://stackoverflow.com/q/77291788
tags question: http://stackoverflow.com/q/77497940
tags question: http://stackoverflow.com/q/77704605
tags question: http://stackoverflow.com/q/78400232
tags question: http://stackoverflow.com/q/78693947

boost
tags question: http://stackoverflow.com/q/77252080
type: Tag
tag name: boost

mediawiki-templates
type: Tag
tags question: http://stackoverflow.com/q/77383213
tag name: mediawiki-templates

performance
type: Tag
tag name: performance
tags question: http://stackoverflow.com/q/77403589
tags question: http://stackoverflow.com/q/77902368
tags question: http://stackoverflow.com/q/78209189
tags question: http://stackoverflow.com/q/78863937

fluent-bit-rewrite-tag
tag name: fluent-bit-rewrite-tag
type: Tag
tags question: http://stackoverflow.com/q/77292433

http://stackoverflow.com/a/77312918
answers question: http://stackoverflow.com/q/77312520
score: 0
has body: So it turns out my main mistake was using LUA_HOOKLINE instead of LUA_MASKLINE. I needed to use lua_resume instead of lua_pcallk. 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. The example below (assuming no errors are raised) will print Executing line: 1 2... 3... and so on as the script executes. and at any moment between line you have full control in c again. void hookfunc(lua_State* L, lua_Debug* ar) { lua_getinfo(L, "l", ar); // Get ar->currentline printf("Executing line: %d\n", ar->currentline); lua_yield(L, 0); // Yield, only works when using `lua_resume` and with 0 return values } int main() { // Create state lua_State* L = luaL_newstate(); luaL_openlibs(L); // Create thread/coroutine lua_State* L1 = lua_newthread(L); // Set hook lua_sethook(L1, &hookfunc, LUA_MASKLINE, 1); // Load lua script luaL_loadfile(L1, "script.lua"); // Execute the thread until it either completes or raises an error do { int nres; // Number of return values, should be 0 when using inside hooks status = lua_resume(L1, 0, 0, &nres); // Start/resume thread // The thread may be yielded, completed or have an error, but you get full control back in c, after every line of lua execution } while (status == LUA_YIELD); lua_close(L); }
type: Answer

boost-spirit
tags question: http://stackoverflow.com/q/77252080
type: Tag
tag name: boost-spirit

mousemove
tag name: mousemove
tags question: http://stackoverflow.com/q/77536487
type: Tag

http://stackoverflow.com/comment/136552080
type: Comment
has text: `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.
comment on: http://stackoverflow.com/q/77455606
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136553091
score: 0
type: QuestionComment
type: Comment
has text: Is [this](https://play.google.com/store/apps/details?id=com.quseit.qlua5pro2&hl=zh) the "QLua" you are referring to?
comment on: http://stackoverflow.com/q/77455606

http://stackoverflow.com/q/77497940
tagged with: computercraft
has comment: http://stackoverflow.com/comment/136624809
type: UnansweredQuestion
tagged with: lua
tagged with: minecraft
has comment: http://stackoverflow.com/comment/136868600
answer count: 0
has title: CC: Tweaked with ThermalDynamics' ducts move from storage chests to a deposit chest
score: 0
type: Question
has body: 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 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. I was expecting it to pull a specific number of specified items from the network to the depot chest next to the computer

markdown
type: Tag
tag name: markdown
tags question: http://stackoverflow.com/q/77508314
tags question: http://stackoverflow.com/q/77951212
tags question: http://stackoverflow.com/q/78495314
tags question: http://stackoverflow.com/q/78522027
tags question: http://stackoverflow.com/q/79151316
tags question: http://stackoverflow.com/q/79508464

http://stackoverflow.com/comment/136723094
comment on: http://stackoverflow.com/a/77551374
has text: i change the v1beta3 into v1beta2 nothing change except for an error
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/77443231
score: 2
tagged with: lua
has answer: http://stackoverflow.com/a/77443353
upvote count: 2
type: AnsweredQuestion
answer count: 1
accepted answer: http://stackoverflow.com/a/77443353
has comment: http://stackoverflow.com/comment/136531316
tagged with: arguments
favorite count: 0
has title: passing an argument through assert(loadfile(play.lua))(argument) doesnt assign anything to arg[1] inside play.lua
tagged with: parameter-passing
has body: I have a script play.lua 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 jukebox.lua that will run play.lua with various arguments based on an input, but the global argument table wont hold the arguments i assign using loadfile play.lua (section that errors) local name = "file " .. arg[1] for line in io.lines(arg[1]) do --note playing code-- print(".") end My first attempt looked like this, but would return an error saying arg[1] was the nil value when trying to assign arg[1] to a variable in play.lua jukebox.lua assert(loadfile("play.lua"))("file1") Then I tried assigning arg[1] in jukebox.lua arg[1] = "file1" assert(loadfile("play.lua") this ran the code with no errors, but using lua jukebox.lua would play nothing and print nothing while lua play.lua file1 would play the file as normal and would print(".") for each line in the file file1. I also tried dofile and require with similar results My question: Is writing assert(loadfile("play.lua"))("file1") in the script not identical to writing lua play.lua file1 in the console? Edit: I made a new script play1.lua with the entirety of the code provided below. play.lua local name = "file " .. arg[1] for line in io.lines(arg[1]) do print(".") end jukebox.lua arg[1] = "file1" assert(loadfile("play.lua"))()
type: Question
downvote count: 0

http://stackoverflow.com/comment/136607259
type: Comment
comment on: http://stackoverflow.com/q/77477233
type: QuestionComment
score: 0
has text: Is it anchored?

http://stackoverflow.com/a/77508380
score: 0
type: Answer
has body: "Tap" event listeners don't have event phases. If you wanna control phases you should use "touch" listener. It's fine to remove your object like this; local function popBalloon( event ) local tappedBalloon = event.target display.remove(tappedBalloon) end Also your game loop only works once because performWithDelay's third argument is 1 by default, if you want to create balloons repeatedly, use; gameLoopTimer = timer.performWithDelay( 500, gameLoop, 0 ) You can also remove the object from your table in popBalloon function. First create an index counter globally; local index = 1 Give your index to balloon and also increment it; newBalloon.index = index index = index + 1 Now back to your popBalloon function, you can see tapped balloon's index by tappedBalloon.index so you can manage your table there.
answers question: http://stackoverflow.com/q/77439054

http://stackoverflow.com/comment/136682938
type: AnswerComment
comment on: http://stackoverflow.com/a/77472849
score: 0
type: Comment
has text: EnablePrimaryMouseButtonEvents (true); function OnEvent(event,arg) if IsKeyLockOn("CapsLock")then if IsMouseButtonPressed(4) then repeat MoveMouseRelative(0,30) Sleep(10) PressAndReleaseMouseButton(1) Sleep(10) PressAndReleaseMouseButton(1) Sleep(10) until not IsMouseButtonPressed(4) end end end

http://stackoverflow.com/q/77539622
tagged with: lua
type: UnansweredQuestion
score: 1
has title: Proximity Prompt can be clicked but does nothing in roblox studio
upvote count: 1
answer count: 1
favorite count: 0
type: Question
tagged with: roblox
has body: I have a proximity prompt that when I hold "e" 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 "E" it does nothing. here is my code for the proximity part: local Players = game:GetService("Players") local shopMan = game.ReplicatedStorage.shopMan local clonedShopMan = shopMan:Clone() local username = Players.Name local money = _G.publicPlayerSession.Money local level = _G.publicPlayerSession.Level local purchased = false function loadData() if level == 1 then --new stand for free elseif level == 2 then --stand with another worker end end script.Parent.Triggered:Connect(function(player) print(money) print(level) if level > 0 then purchased = true loadData() else purchased = false end if purchased == false then if money >= 150 then money -= 150 level += 1 clonedShopMan.Parent = workspace.Stand script.Parent:Destroy() end end end) 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
downvote count: 0
has answer: http://stackoverflow.com/a/77541899

http://stackoverflow.com/comment/136645867
type: QuestionComment
has text: @tehtmi Thank you so much. I rechecked the apk and indeed found an encryption function.
type: Comment
comment on: http://stackoverflow.com/q/77507409
score: 0

http://stackoverflow.com/comment/136650695
comment on: http://stackoverflow.com/q/77512688
has text: Their code: ``local players = game:WaitForChild("Players") local function createLeaderboard(player) local stats = Instance.new("Folder") stats.Name = "leaderstats" local cash = Instance.new("IntValue", stats) cash.Name = "Cash" stats.Parent = player end players.PlayerAdded:connect(createLeaderboard)``
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/77546645
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/77546708
has answer: http://stackoverflow.com/a/77550327
has body: 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. 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: &lt;space&gt;&lt;space&gt;if(a&lt;space&gt;==&lt;space&gt;b)&lt;space&gt;then must become &lt;tab&gt;&lt;tab&gt;if(a&lt;space&gt;==&lt;space&gt;b)&lt;space&gt;then 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.
tagged with: editor
tagged with: lua-patterns
accepted answer: http://stackoverflow.com/a/77550327
answer count: 2
score: -1
favorite count: 0
type: AnsweredQuestion
has title: Lua: Convert spaces at the beginning of each line to tabs
downvote count: 2
possible better answer: http://stackoverflow.com/a/77546708
tagged with: lua

http://stackoverflow.com/comment/136728799
has text: @ESkri Don't chunks always only have one upvalue?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77545233

http://stackoverflow.com/comment/136552129
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77455606

http://stackoverflow.com/comment/136774794
score: 0
type: AnswerComment
type: Comment
has text: `hour = hour-5; min=min-30;`
comment on: http://stackoverflow.com/a/77537699

http://stackoverflow.com/q/77497743
score: 0
type: Question
has title: Why doesnt my accessory attach to the player in roblox?
tagged with: roblox
tagged with: lua
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77504978
has body: The custom Accessory does not attach to the player and spawns away from him Here is my script local player = game.Players.LocalPlayer player.CharacterAdded:Wait() local human = player.Character:WaitForChild("Humanoid") local asset = game.ReplicatedStorage.UnionAccessory:Clone() human:AddAccessory(asset) I was expecting that the player would just have Accessory equiped and would walk with it, but that didnt happen
answer count: 1

http://stackoverflow.com/q/77449495
has body: Executing the MakeFile of LuaHPDF (this one), it complains that #include &lt;hpdf.h&gt; directive has failed. I've installed it (v. 2.3.0) using apt . Despite of a hpdf.so taking place in the system, no header (hpdf.h) was added. This means such installation wasn't have effect. I'm working with Debian 11 and lua 5.4. How to install hpdf in my computer in order to such header being reachable to gcc? Should I create one by my self? If yes, how to do it? Thanks in advance.
score: 0
type: Question
tagged with: lua-5.4
tagged with: lua
has answer: http://stackoverflow.com/a/77449955
accepted answer: http://stackoverflow.com/a/77449955
answer count: 1
tagged with: http://stackoverflow.com/tag/pdf
has title: hpdf not found by LuaHPDF MakeFile (but I've already installed it)
type: AnsweredQuestion
tagged with: libharu

parsing
tags question: http://stackoverflow.com/q/77527148
tag name: parsing
type: Tag
tags question: http://stackoverflow.com/q/77852628
tags question: http://stackoverflow.com/q/78951239
tags question: http://stackoverflow.com/q/79190029

http://stackoverflow.com/comment/136683828
comment on: http://stackoverflow.com/q/77520256
has text: The printout for type(myData) right after the light of assignment is "userdata".
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/77561246
has answer: http://stackoverflow.com/a/77561402
has title: How to pass an arbitrary iterator as a function argument?
upvote count: 3
downvote count: 0
tagged with: iterator
tagged with: lua
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136739601
has body: Question If I write a generic walk routine, why can I pass in my own iterators but not pairs? Example Here's a simple walk that does something for each item in src. function walk(src) for n,i in src do print(n, i[1]+i[#i]) end end If I call this with walk(items(x)) then walk works fine. function items(lst, n) n=0 return function() if lst and n &lt; #lst then n=n+1 return n,lst[n] end end end x={ {1,2}, {3,4}, {5,6}, {5,6}} walk(items(x)) --&gt; prints out (1,3),(2,7),(3,11),etc But I try the same with pairs(x), I get a crash. walk(pairs(x)) lua: x.lua: bad argument #1 to 'for iterator' (table expected, got nil) stack traceback: [C]: in function 'next' x.lua:7: in function 'walk' x.lua:31: in main chunk [C]: in ? So what is different about pairs and my own iterator items?
answer count: 1
accepted answer: http://stackoverflow.com/a/77561402
type: Question
score: 3
favorite count: 0

http://stackoverflow.com/q/77536487
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77538184
score: 0
has body: I am trying to create a local function in Lua (GHUB) to move the mouse to a specific coordiinates on the screen. However the pointer moves suddenly at the end of the function call ... and does not even go to the right position. Also .. is there anyway I can debug Lua ... in GHUB is practically impossible from what I see. Not even syntax errors. Thank you! local function MouseMoveToSlower(x, y, speed) current_x, current_y = GetMousePosition() distance = math.sqrt((x - current_x)^2 + (y - current_y)^2) steps = math.floor(distance / speed) for i = 1, steps do new_x = current_x + (x - current_x) * i / steps new_y = current_y + (y - current_y) * i / steps MoveMouseRelative(new_x - current_x, new_y - current_y) Sleep(math.random(102,125)) end end
type: Question
has title: GHUB Lua - Slow Mouse Movement Function
tagged with: lua
tagged with: logitech-gaming-software
tagged with: mousemove

http://stackoverflow.com/comment/136706614
has text: 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
type: Comment
comment on: http://stackoverflow.com/a/77538184
score: 0
type: AnswerComment

http://stackoverflow.com/a/77438825
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136523680
answers question: http://stackoverflow.com/q/77438652
has body: table:function(arguments) is purely syntactic sugar for table.function(table, arguments). (In the body of the function definition table is the implicit self, when defined with colon syntax.) As you have seen, this assignment funct2_object1 = object1.PrintString does not carry any information about object1 with it, and so this function call funct2_object1() errors out, looking for an explicit first argument to fill the role of self. If you had called funct2_object1(object1) the function would behave as expected. Given this callback-style function function Example(funct) funct() -- calls it here end it sounds like what you want is to create a closure around your OOP-style call, which you can do by enclosing it with a function (anonymous or otherwise). For example: local Object = {} function Object:new(data) return setmetatable({ data = data }, { __index = self }) end function Object:do_something() print('Hello from', self, self.data) end local thing = Object:new(42) ---- local function Example(funct) funct() end Example(function () thing:do_something() end) Hello from table: 0x55c65be628c0 42
score: 1
upvote count: 1
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77438652

filter
type: Tag
tags question: http://stackoverflow.com/q/77504584
tag name: filter
tags question: http://stackoverflow.com/q/78633861
tags question: http://stackoverflow.com/q/79020824

http://stackoverflow.com/a/77546708
upvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/136717591
has body: Use ^ to match the beginning of the string string.gsub(' if(a == b) then', '^ +', function (spaces) return ('\t'):rep(#spaces) end)
type: Answer
has comment: http://stackoverflow.com/comment/136712791
answers question: http://stackoverflow.com/q/77546645
downvote count: 1

http://stackoverflow.com/q/77585062
answer count: 1
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/77586847
downvote count: 1
type: AnsweredQuestion
has title: Part not deleting idk why nothing happens
type: Question
upvote count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/136779532
tagged with: roblox
has body: game:WORKSPACE:Part:Destroy() what is the issue 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.
accepted answer: http://stackoverflow.com/a/77586847

http://stackoverflow.com/comment/136550174
type: QuestionComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/77455606
score: 0

http://stackoverflow.com/comment/136553141
comment on: http://stackoverflow.com/q/77455606
has text: 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)?
type: QuestionComment
score: 2
type: Comment

http://stackoverflow.com/q/77437533
has body: enter image description here I want suggestions in the command, like shown in the screenshot. When i am typing ":term" it is not showing suggestions. I am using the base NvChad configuration on my windows system. github FYI 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. i am expecting suggestion for commands.
has title: I want suggestions in the command line in Neovim - NvChad
tagged with: neovim-plugin
answer count: 1
favorite count: 0
score: 0
type: Question
upvote count: 1
tagged with: lua
downvote count: 1
has answer: http://stackoverflow.com/a/77441327
tagged with: neovim
type: UnansweredQuestion

http://stackoverflow.com/comment/136779532
type: Comment
has text: using colons between elements in the path makes the game think you are trying to call functions. Use periods : `game.Workspace.Part:Destroy()`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77585062

http://stackoverflow.com/q/77505557
answer count: 1
type: UnansweredQuestion
has body: 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. 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? Here's what I'm working with. dtable = setmetatable(os.date('!*t'), {__call = function(self) self.tz=os.date('%z') self.ampam = os.date('%p') return self end}) dtable = dtable() dir = function(tab) for k, v in pairs(tab) do print(k, '=&gt;', v) end end
favorite count: 0
has title: Splitting an os.date() table into multiple variables?
has comment: http://stackoverflow.com/comment/136638351
has comment: http://stackoverflow.com/comment/136640687
type: Question
downvote count: 0
score: 1
tagged with: lua
has answer: http://stackoverflow.com/a/77510149
upvote count: 1

http://stackoverflow.com/q/77551269
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/136728691
has body: ok... i solve my problem. the problem is on my self. i forgot to add the return response which is stupid on my side lol here's the fixed code --google palm-- --roblox lua local Players = game:GetService("Players"); local HttpService = game:GetService("HttpService"); local LocalPlayer = Players.LocalPlayer; local RequestFunctiom = request; local function MakeRequest(Prompt) local success, response = pcall(function() return RequestFunctiom({ Url = "https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=KEY_HERE", Method = "POST", Headers = { ["Content-Type"] = "application/json", }, Body = HttpService:JSONEncode({ prompt = { text = Prompt }, temperature = 0.7, candidateCount = 1, topP = 0.95, topK = 5, maxOutputTokens = 100, stopSequences = {"Human:", "Ai:"}, }) }) end) print(response) return response end print("MakeRequest sending") print("test1") local HttpRequest = MakeRequest("Human: Hello how are you today \n\nAI:"); --wait(3) -- if this added the local Response will errored the error is "attempt to index nil with the Body" local Response = ". " .. string.sub(HttpService:JSONDecode(HttpRequest["Body"]).candidates[1].output, 2); print(Response)
tagged with: roblox
type: Question
has answer: http://stackoverflow.com/a/77551374
has comment: http://stackoverflow.com/comment/136751196
has answer: http://stackoverflow.com/a/77557580
tagged with: palm-api
tagged with: lua
has title: PaLM API json not workings
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136720432
has comment: http://stackoverflow.com/comment/136725033

http://stackoverflow.com/comment/136745050
type: QuestionComment
comment on: http://stackoverflow.com/q/77566514
type: Comment
score: 1
has text: What is the code you are using to tell you that the return value is empty?

http://stackoverflow.com/a/77525989
upvote count: 1
answers question: http://stackoverflow.com/q/77513429
type: Answer
downvote count: 0
score: 1
has body: 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. First, add a RemoteEvent to ReplicatedStorage. Then, the LocalScript should look something like this: local rs = game:GetService("ReplicatedStorage") local player = game.Players.LocalPlayer script.Parent.MouseClick:Connect(function() rs.Event:FireServer() end) Now, for the serverscript: local rs = game:GetSerivce("ReplicatedStorage") rs.Event.OnServerEvent:Connect(function(plr) player.TeamColor = BrickColor.new("Really blue") local character = plr.Character if character then local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid.Health = 0 end end end

http://stackoverflow.com/q/77441092
upvote count: 2
type: AnsweredQuestion
has body: 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: Error: could not find or load main class CSC-101.Proj.4.Hangman Caused by: Java.lang.NoClassDefFoundError: Hangman (wrong name: CSC-101/Proj/4/Hangman) [process exited 1] When I try with python, even when I run it from the same working directory I get nothing but: [process exited 0]' Which I don't understand because when I type ":term python3 %" in nvim, it works perfectly. Here is the function I'm using: funcs.run_code = function() local filename = vim.fn.expand("%") local basename = vim.fn.expand("%:r") local filetype = vim.bo.filetype local cmd = nil if filetype == "python" then cmd = "term: python3 "..filename elseif filetype == "java" then cmd = "term: javac "..filename.." && java "..basename end if cmd then vim.cmd("w") vim.cmd(cmd) else print("No interpreter or compiler defined for filetype: '"..filetype.."'") end end Thanks!
answer count: 1
tagged with: neovim
has answer: http://stackoverflow.com/a/77441277
score: 2
type: Question
downvote count: 0
tagged with: python
tagged with: lua
tagged with: java
has title: nvim: compile/run code based on filetype in function from keymap using lua
favorite count: 0
accepted answer: http://stackoverflow.com/a/77441277

http://stackoverflow.com/q/77549895
has title: installing neovim plugins on windows
answer count: 1
type: UnansweredQuestion
tagged with: neovim
favorite count: 0
upvote count: 3
downvote count: 0
score: 3
tagged with: lua
type: Question
has body: 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. Here's my init.vim file: call plug#begin() Plug 'windwp/nvim-autopairs' lua require("nvim-autopairs").setup {} call plug#end() and here is the error that I'm getting: Error detected while processing C:\Users\eidhn\AppData\Local\nvim\init.vim: line 6: E5108: Error executing lua [string ":lua"]:1: module 'nvim-autopairs' not found: no field package.preload['nvim-autopairs'] no file '.\nvim-autopairs.lua' no file 'C:\Program Files\Neovim\bin\lua\nvim-autopairs.lua' no file 'C:\Program Files\Neovim\bin\lua\nvim-autopairs\init.lua' no file '.\nvim-autopairs.dll' no file 'C:\Program Files\Neovim\bin\nvim-autopairs.dll' no file 'C:\Program Files\Neovim\bin\loadall.dll' stack traceback: [C]: in function 'require' [string ":lua"]:1: in main chunk
has answer: http://stackoverflow.com/a/77551808

http://stackoverflow.com/a/77541899
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/136706057
has body: The variables will not update dynamically when the table's content change.
type: Answer
has comment: http://stackoverflow.com/comment/136711516
answers question: http://stackoverflow.com/q/77539622

http://stackoverflow.com/q/77429315
tagged with: lua
has comment: http://stackoverflow.com/comment/136691028
accepted answer: http://stackoverflow.com/a/77432563
has body: I have commentted out all of my vimrc file, in my macOS (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), it cannot find tag with the folloing commands and source $ cat x.lua function test () end $ ctags -R x.lua $ cat tags !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ !_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ !_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ !_TAG_PROGRAM_NAME Exuberant Ctags // !_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ !_TAG_PROGRAM_VERSION 5.8 // test x.lua /^function test ()$/;" f $ vim -t test # vim reports the error like "E257: cstag: Tag not found" If I removed the space after the function name test, like function test(), then it could work. I also test this in my EC2 ubuntu, it could work even tough there is a space after the function name test. I dont know how to debug after this, I also asked it to ChatGPT 3.5, but it could not resolve this.
tagged with: macvim
answer count: 1
has answer: http://stackoverflow.com/a/77432563
tagged with: tags
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136504254
type: Question
has title: vim ctags:tags not found if one space after lua function name
tagged with: vim

http://stackoverflow.com/a/77531643
type: Answer
has body: local DataStore,DataStore2,DataStore3,DataStore4,DataStore5,DataStore6 game.Players.PlayerAdded:Connect(function(plr) while not DataStore6 do task.wait()end local leaderstats = Instance.new("Folder", plr) leaderstats.Name = "leaderstats" local plrstats = Instance.new("Folder", plr) plrstats.Name = "Multipliers" local cash = Instance.new("IntValue", leaderstats) cash.Name = "Jump" cash.Value = DataStore:GetAsync(plr.UserId) or 1 local cash1 = Instance.new("IntValue", leaderstats) cash.Name = "Run" cash.Value = DataStore5:GetAsync(plr.UserId) or 1 local cash2 = Instance.new("IntValue", leaderstats) cash.Name = "Climb" cash.Value = DataStore6:GetAsync(plr.UserId) or 1 local Upgrade = Instance.new("IntValue", plrstats) Upgrade.Name = "ClimbMultiplier" Upgrade.Value = DataStore4:GetAsync(plr.UserId) or 1 local multi = Instance.new("IntValue", plrstats) multi.Name = "RunMultiplier" multi.Value = DataStore2:GetAsync(plr.UserId) or 1 local cost = Instance.new("IntValue", plrstats) cost.Name = "JumpMultiplier" cost.Value = DataStore3:GetAsync(plr.UserId) or 1 cash.Changed:Connect(function() DataStore:SetAsync(plr.UserId, cash.Value) end) Upgrade.Changed:Connect(function() DataStore4:SetAsync(plr.UserId, Upgrade.Value) end) cost.Changed:Connect(function() DataStore3:SetAsync(plr.UserId, cost.Value) end) multi.Changed:Connect(function() DataStore2:SetAsync(plr.UserId, multi.Value) end) cash1.Changed:Connect(function() DataStore5:SetAsync(plr.UserId, cash1.Value) end) cash2.Changed:Connect(function() DataStore6:SetAsync(plr.UserId, cash2.Value) end) end) game.Players.PlayerRemoving:Connect(function(plr) DataStore:SetAsync(plr.UserId, plr.leaderstats.Cash.Value) DataStore4:SetAsync(plr.UserId, plr.Multipliers.Upgrade.Value) DataStore3:SetAsync(plr.UserId, plr.Multipliers.Cost.Value) DataStore2:SetAsync(plr.UserId, plr.Multipliers.multi.Value) DataStore5:SetAsync(plr.UserId, plr.leaderstats.cash1.Value) DataStore6:SetAsync(plr.UserId, plr.leaderstats.cash2.Value) end) DataStore =…
answers question: http://stackoverflow.com/q/77515602
score: 0

http://stackoverflow.com/comment/136688493
has text: @CeriseLimón hi, i edited the question and uploaded a screenshot https://i.sstatic.net/Wlq5h.png
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77533955
type: Comment

http://stackoverflow.com/a/77594025
downvote count: 0
has comment: http://stackoverflow.com/comment/136830236
has comment: http://stackoverflow.com/comment/136823779
type: Answer
answers question: http://stackoverflow.com/q/77584516
has body: Since core.response.hold_body_chunk receives the raw response body, it does receive cases that contain non-alphabets and symbols. 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. You need to check if this is the case (including but not limited to gzip)
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/136830230

http://stackoverflow.com/q/77443399
type: Question
has answer: http://stackoverflow.com/a/77446288
has body: 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? I'm guessing something like local players = game.Players:GetPlayers() local status = game.ReplicatedStorage.Status while true do for i = 10, 0, -1 do status.Value = "Starting in "..i wait(1) end local player1 = players[math.random(1,#players)] local player2 = players[math.random(1, #players)] print("Player 1 is "..tostring(player1)) print("Player 2 is "..tostring(player2)) end 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
tagged with: roblox
tagged with: lua
type: UnansweredQuestion
has title: ROBLOX - how to pick two random players
answer count: 1
has comment: http://stackoverflow.com/comment/136532020
score: 0

http://stackoverflow.com/comment/139482555
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77546153
has text: I spent hours trying to figure out why neovim wasn't loading the init.lua script... This solution got things working properly. Thanks!

http://stackoverflow.com/comment/136572250
type: Comment
score: 0
type: QuestionComment
has text: 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).
comment on: http://stackoverflow.com/q/77464667

http://stackoverflow.com/comment/136688376
comment on: http://stackoverflow.com/q/77533955
score: 0
type: QuestionComment
has text: Edit the question to show how the `InviteInfo` value is passed to the Redis server.
type: Comment

http://stackoverflow.com/comment/136650246
has text: 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. The suffix "-dev" was the great new to me! Thank you for your decisive help!
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77449955
score: 0

http://stackoverflow.com/comment/136708030
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/77545233
has text: "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)

http://stackoverflow.com/q/77517930
type: Question
downvote count: 0
has body: How to Change nvim-tree's "s" Keymap to "ss" in Neovim and Issues with Disabling "s" Keymap? I'm working with the nvim-tree plugin in Neovim and am trying to change the default keymap for opening the system file viewer from "s" to "ss". I've attempted the following steps, but haven't been successful yet: I tried to unmap the original "s" key by using: vim.api.nvim_set_keymap("n", "s", "<nop>", {noremap = true, silent = true}) Then, I tried to set up a custom attachment function to map "ss" to the desired action: local function my_on_attach(bufnr) local api = require "nvim-tree.api" local function opts(desc) return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } end -- default mappings api.config.mappings.default_on_attach(bufnr) -- custom mappings vim.keymap.del("n", "s") end -- pass to setup along with your other options require("nvim-tree").setup { --- on_attach = my_on_attach, --- } Despite these attempts, the "s" key is still performing its original action, and I haven't been able to map "ss" to the function that "s" was performing. I also encountered an error when trying to modify the nvim-tree settings directly, as it mentioned "Unknown option: view.mappings". Can anyone advise me on what I might be doing wrong or what I should do to successfully remap "s" to "ss" in nvim-tree and disable the original "s" keymap?
score: 2
tagged with: lua
has title: How to Change nvim-tree's "s" Keymap to "ss" in Neovim and Issues with Disabling "s" Keymap?
tagged with: neovim-plugin
type: UnansweredQuestion
tagged with: neovim
favorite count: 0
upvote count: 2
answer count: 0

macvim
tag name: macvim
tags question: http://stackoverflow.com/q/77429315
type: Tag

http://stackoverflow.com/q/77539961
has comment: http://stackoverflow.com/comment/136699030
possible better answer: http://stackoverflow.com/a/77541600
tagged with: neovim
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/77546153
type: AnsweredQuestion
has title: Neovim init.lua sourcing not working when trying to install Lazy.nvim
has comment: http://stackoverflow.com/comment/136699041
has comment: http://stackoverflow.com/comment/136698925
answer count: 3
type: Question
has answer: http://stackoverflow.com/a/77789470
has comment: http://stackoverflow.com/comment/136699039
has answer: http://stackoverflow.com/a/77541600
accepted answer: http://stackoverflow.com/a/77546153
has comment: http://stackoverflow.com/comment/136699032
upvote count: 4
has comment: http://stackoverflow.com/comment/136699049
tagged with: lua
downvote count: 0
has comment: http://stackoverflow.com/comment/136699074
has comment: http://stackoverflow.com/comment/136699100
has body: 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. I've got a super simple setup and I am only trying to install Lazy but my init.lua file is giving me init.lua:1: number expected whenever I try to source it. Here's my ~/.config/nvim directory: ╰─❯ tree . ├── init.lua └── lua ├── config │ └── init.lua ├── plugins └── util 5 directories, 2 files Here is my ~/.config/nvim/init.lua require("config") And here is my ~/.config/nvim/lua/config/init.lua local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) vim.g.mapleader = " " -- Make sure to set `mapleader` before lazy so your mappings are correct -- Initialise Lazy by installing some basic plugins require("lazy").setup({ "folke/which-key.nvim", { "folke/neoconf.nvim", cmd = "Neoconf" }, "folke/neodev.nvim", }) 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.

http://stackoverflow.com/q/77484441
type: Question
has answer: http://stackoverflow.com/a/78273917
has comment: http://stackoverflow.com/comment/136607226
tagged with: roblox
has body: 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?
tagged with: lua
type: UnansweredQuestion
answer count: 1
score: 0
has title: ROBLOX - how to tell who killed an enemy

http://stackoverflow.com/a/77586167
has body: 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. So just put all the resizing logic into one tween and make it take the full length of time : local BURN_RATE = 1.0 -- studs/second local cigLength = bit.Size.X local tweenInfo = TweenInfo.new(cigLength * BURN_RATE) -- take more time based on how long the cig is local goal = { Size = Vector3.new(0, bit.Size.Y, bit.Size.Z), Position = (bit.Position - Vector3.new(cigLength / 2, 0, 0)), } local tween = TweenService:Create(bit, tweenInfo, goal) tween:Play() -- TODO : if the tool is put away, simply cancel the tween
score: 2
upvote count: 2
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/77581354
accepted answer of: http://stackoverflow.com/q/77581354

http://stackoverflow.com/comment/136751196
has text: 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.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77551269
type: Comment

http://stackoverflow.com/q/77490875
downvote count: 0
answer count: 0
tagged with: config
type: Question
tagged with: lua
has body: I'd like to permanently set the scroll option in my Neovim config to a set value, but the option doesn't persist when I set it in my init.lua file. ~/.config/nvim/init.lua: vim.o.scroll = 20 The docs have this to say about the scroll property: "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" 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. Is there a workaround for this? Or something I'm missing? My config file for reference (based on the kickstart config):
has title: Neovim scroll option not persisting from config
tagged with: editor
tagged with: neovim
upvote count: 1
type: UnansweredQuestion
score: 1
favorite count: 0

http://stackoverflow.com/comment/137002216
comment on: http://stackoverflow.com/q/77550367
score: 0
type: QuestionComment
has text: @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.
type: Comment

http://stackoverflow.com/q/77527148
upvote count: 3
downvote count: 0
type: UnansweredQuestion
tagged with: lua
tagged with: neovim
type: Question
score: 3
answer count: 0
tagged with: parsing
has body: I haven't used NeoVim in quite a while so excuse my poor explanation, but essentially my autocomplete A.K.A LSP No longer works. I use LSP Zero and a custom completions config that has worked for me up until now, but no longer works. Here is the section within my plugins.lua file which uses packer.nvim -- LSP Configuration use({ "VonHeikemen/lsp-zero.nvim", branch = "v1.x", requires = { -- LSP Support { "neovim/nvim-lspconfig" }, -- Required { "williamboman/mason.nvim" }, -- Optional { "williamboman/mason-lspconfig.nvim" }, -- Optional -- Autocompletion { "hrsh7th/nvim-cmp" }, -- Required { "hrsh7th/cmp-nvim-lsp" }, -- Required { "hrsh7th/cmp-buffer" }, -- Optional { "hrsh7th/cmp-path" }, -- Optional { "saadparwaiz1/cmp_luasnip" }, -- Optional { "hrsh7th/cmp-nvim-lua" }, -- Optional { "onsails/lspkind.nvim" }, -- Snippets { "L3MON4D3/LuaSnip" }, -- Required { "rafamadriz/friendly-snippets" }, -- Optional }, }) And my completion.lua file local luasnip = require("luasnip") local cmp = require("cmp") local lspkind = require("lspkind") cmp.setup({ formatting = { format = lspkind.cmp_format({ with_text = true, -- do not show text alongside icons maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) -- The function below will be called before any actual modifications from lspkind -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) before = function(entry, vim_item) return vim_item end, }), }, snippet = { expand = function(args) require("luasnip").lsp_expand(args.body) end, }, mapping = { ["<C-p>"] = cmp.mapping.select_prev_item(), ["<C-n>"] = cmp.mapping.select_next_item(), ["<C-d>"] = cmp.mapping.scroll_docs(-4), ["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-Space>"] = cmp.mapping.complete(), ["<C-e>"] = cmp.mapping.close(), ["<CR>"] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true, }), ["<Tab>"] = f…
has title: Neovim LSP Not working after not using for a few months. (LSP Zero)
favorite count: 0

http://stackoverflow.com/a/77510149
type: Answer
upvote count: 1
has body: To get more experience i suggest to play around with this... 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}}) ...this adds the dir function as method. Also you have to know that ampam depends on the locale... &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}}) &gt; os.setlocale('en_US.UTF8', 'time') en_US.UTF8 &gt; dtable():dir() table: 0x566035c0 sec =&gt; 33 min =&gt; 45 hour =&gt; 10 ampam =&gt; AM year =&gt; 1965 day =&gt; 9 isdst =&gt; false yday =&gt; 221 wday =&gt; 2 month =&gt; 8 tz =&gt; +0100 &gt; os.setlocale('de_DE.UTF8', 'time') de_DE.UTF8 &gt; dtable():dir() table: 0x566047b0 sec =&gt; 33 min =&gt; 45 hour =&gt; 10 ampam =&gt; year =&gt; 1965 day =&gt; 9 isdst =&gt; false yday =&gt; 221 wday =&gt; 2 month =&gt; 8 tz =&gt; +0100 &gt; os.setlocale('ja_JP.utf8', 'time') ja_JP.utf8 &gt; dtable:dir() table: 0x565c1cc0 year =&gt; 1965 wday =&gt; 2 yday =&gt; 221 hour =&gt; 10 month =&gt; 8 min =&gt; 45 isdst =&gt; false sec =&gt; 33 day =&gt; 9 &gt; dtable():dir() table: 0x565c1cc0 year =&gt; 1965 wday =&gt; 2 yday =&gt; 221 hour =&gt; 10 ampam =&gt; 午前 month =&gt; 8 tz =&gt; +0100 min =&gt; 45 isdst =&gt; false sec =&gt; 33 day =&gt; 9 (On Linux bash i getting the locale strings with: locale -a) ...and OS and Lua Version (maybe) in this case: &gt; os.execute('uname -a') Linux Microknoppix 5.2.5-64 #10 SMP PREEMPT Sat Aug 3 20:57:52 CEST 2019 x86_64 GNU/Linux &gt; _VERSION Lua 5.4
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/77505557

http://stackoverflow.com/q/77436024
has body: I have a script in ServerScriptService and I do a 60 second countdown while the game is happening: for i = 60, 0, -1 do status.Value = "Game: "..i wait(1) end 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? I tried this: while true do while wait(0.1) do if (spawnCheese and #cheeseTable < 100) then local c = cheese:Clone() c.Parent = workspace local spacing = 2 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)) table.insert(cheeseTable, c) collectCheese(c) end end end but it only runs for one frame before or after the countdown.
tagged with: roblox
answer count: 1
type: Question
has title: ROBLOX - How do I run my code at the same time as this?
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/77449631
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: lua

http://stackoverflow.com/a/77607636
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/136841797
has comment: http://stackoverflow.com/comment/136841810
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77504584
has body: 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. A Pandoc solution would be 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. To replace just a command name this is fairly easy, though longer than the third solution below. A LaTeX solution is to redefine \caption as \sidecaption: \renewcommand{\caption}{\sidecaption} You can keep this in groups ({...}) to ensure that the redefinition only applies locally. A hybrid Pandoc/LaTeX solution is a Lua filter that insert LaTeX code to redefine \caption around figures: if FORMAT:match 'latex' then function Figure (elem) return { pandoc.RawBlock('latex','{\\renewcommand{\\caption}{\\subcaption}'), elem, pandoc.RawBlock('latex','}') } end end This replaces any 'Figure' block element by a list (succession) of three raw LaTeX blocks. The output should look like: {\renewcommand{\caption}{\subcaption} ... Pandoc's LaTeX for the figure ... }

http://stackoverflow.com/comment/136528779
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77443353
has text: @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?

http://stackoverflow.com/q/77511329
type: Question
tagged with: lua
answer count: 1
type: UnansweredQuestion
has body: 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! local Objective = game.StarterGui.BtnLbl.RealObjective wait(5) Objective.Text = "Explore the Home" wait(15) Objective.Text = "What is that?" wait(4) Objective.Text = "RUN!!!" Objective.TextColor3 = Color3.new(1, 0, 0) I am using a serverside script! 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 "Explore the Home" then after 15 seconds "What is that?" then after 4 seconds "RUN!!" with the Text being Red, I am using a serverside script!
tagged with: roblox
score: 0
has title: Roblox Lua Story Text Code does not change the text locally on the device?
has answer: http://stackoverflow.com/a/77536011

http://stackoverflow.com/q/77534396
has body: (this is roblox studio by the way) I run the following script: local tower = script.Parent local enemy = workspace.Enemy local distance = tower.Position - enemy.Position print(distance) It says: "Position is not a valid member of Model "Workspace.Tower"" Tower is just a union of simple parts This script is the child of the Tower Position is a property of Tower Tower is named Tower Enemy is named Enemy it is .Postion, not .position I'm not sure what to do. Any ideas? I expected the difference between the Tower Position and the Enemy position to appear in the Output as a print. What happened was nothing appeared in the Output besides the error message.
tagged with: roblox
score: 0
answer count: 2
type: Question
has answer: http://stackoverflow.com/a/77537791
has title: Position is not a valid member of Model "Workspace.Tower"
has answer: http://stackoverflow.com/a/77535093
type: UnansweredQuestion
tagged with: lua

http://stackoverflow.com/comment/136752003
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/77568002
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136739601
has text: The iterator function could return more than two values, btw. For example consider `("aaa"):gmatch"(a)(a)(a)"`.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77561246
type: QuestionComment

http://stackoverflow.com/q/77440589
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/77441200
type: Question
has title: ROBLOX - Why isn't my while loop working?
tagged with: lua
tagged with: roblox
has body: I'm trying to grow berries on a tree but it's not working local berries = {} local growTime = 3 local grew = false while grew == false do wait(growTime) for i = 1, 3, 1 do local berry = Instance.new("Part") berry.Shape = Enum.PartType.Ball berry.BrickColor = BrickColor.new("Really red") end grew = true end 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)
type: UnansweredQuestion

http://stackoverflow.com/q/77566514
has comment: http://stackoverflow.com/comment/136745050
accepted answer: http://stackoverflow.com/a/77568002
type: AnsweredQuestion
has body: 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. local function test() local t1 = {11,11,22,33,33,44,55,66,77,88,99} local t = {} for i, v in ipairs(t1) do t[v] = v end return t end This function is supposed to return unique elements from t1 but it's returning empty array. I think I am doing something wrong but can't figure out what. Can someone help? Read lot about Lua Sets still couldn't figure out issue. Tried running script locally in docker with different modifications/approaches but nothing helped
has comment: http://stackoverflow.com/comment/136789614
answer count: 1
has comment: http://stackoverflow.com/comment/136745791
has title: Lua Set in Redis is not working as expected
score: 0
has answer: http://stackoverflow.com/a/77568002
has comment: http://stackoverflow.com/comment/136745164
type: Question
tagged with: lua
tagged with: spring-data-redis
tagged with: redis

http://stackoverflow.com/comment/136778216
type: QuestionComment
comment on: http://stackoverflow.com/q/77567066
has text: @mandy8055 I already wrote regarding this point in the question itself.
type: Comment
score: 0

http://stackoverflow.com/a/77561402
accepted answer of: http://stackoverflow.com/q/77561246
answers question: http://stackoverflow.com/q/77561246
score: 2
has body: The pairs function returns 3 values: The next function The table The initial key nil The for-in statement uses the 3 values in an equivalent process as follows: local f, t, k = pairs(x) local v repeat k, v = f(t, k) if k then -- for body end until not k Since the 3rd value is always nil, if you want the walk function to be effective on pairs, you need at least 2 arguments: function walk(itor, t) for n,i in itor, t do print(n, i[1]+i[#i]) end end You need 3 if you want it to be effective on any iterator functions.
downvote count: 0
has comment: http://stackoverflow.com/comment/136739587
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/a/77547672
has body: This is a well-known Minetest "footgun". The table passed to set_player_privs is treated as a set of privileges. Unlike ObjRef:set_properties, set_player_privs is not "incremental": It does not "modify" the player privileges, it replaces ("sets") them. Let's look at the first example: minetest.set_player_privs("singleplayer", {interact = false}) Minetest treats the table as a set: It only looks at the keys. The only key is interact, so it sets the privileges of singleplayer to a just interact. Similarly, in local privs = minetest.get_player_privs("singleplayer") privs.interact = false minetest.set_player_privs("singleplayer", privs) interact is still a table key; it does not matter that its value is false (or "foobar", or 42.101...) - Minetest only looks at the keys, never at the values. So the new set will contain all previous privileges as keys, as well as interact. This will grant interact if the player doesn't already have it. To revoke interact, you need to remove it from the table by setting it to nil: local privs = minetest.get_player_privs("singleplayer") privs.interact = nil minetest.set_player_privs("singleplayer", privs) Similarly, to grant interact, you just add it to the table by setting it to a non-nil value (ideally true): local privs = minetest.get_player_privs("singleplayer") privs.interact = true minetest.set_player_privs("singleplayer", privs)
score: 3
upvote count: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/77547671

http://stackoverflow.com/comment/136557082
score: 0
type: AnswerComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/77449955

http://stackoverflow.com/comment/136745791
comment on: http://stackoverflow.com/q/77566514
type: Comment
score: 0
type: QuestionComment
has text: 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.

http://stackoverflow.com/comment/136780637
comment on: http://stackoverflow.com/q/77581354
score: 0
type: QuestionComment
type: Comment
has text: +Buzzyy, this is a custom thing for me and my friends, so I hope it doesn't get me banned.

http://stackoverflow.com/q/77442333
tagged with: lua
has title: ROBLOX - why isn't a boolValue being created in the player's Character?
has answer: http://stackoverflow.com/a/77544277
type: UnansweredQuestion
score: 0
answer count: 2
type: Question
tagged with: roblox
has answer: http://stackoverflow.com/a/77452444
has body: So I write: local BoolValue = Instance.new("BoolValue") BoolValue.Parent = game:GetService("Players").LocalPlayer.Character In a starter player script (local Script) But it's not doing anything seemingly, I can't find a BoolValue in the player's character

http://stackoverflow.com/comment/136996547
score: 1
type: Comment
comment on: http://stackoverflow.com/q/77550367
has text: 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.
type: QuestionComment

http://stackoverflow.com/comment/136719512
comment on: http://stackoverflow.com/a/77551374
type: AnswerComment
type: Comment
has text: i think local Response have an problem because it yield idk why
score: 0

http://stackoverflow.com/comment/136830230
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/77594025
score: 0
type: AnswerComment

http://stackoverflow.com/q/77587456
score: 0
has title: Create Channel discord.js
type: Question
has answer: http://stackoverflow.com/a/77606567
tagged with: lua
tagged with: javascript
tagged with: discord
tagged with: fivem
answer count: 1
type: UnansweredQuestion
tagged with: discord.js
has body: 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: exports('runJS', (data) => { console.log(data.name); client.channels.cache.get(`ID`).send(data.name); let role = client.guilds.cache.get("id"); //member.roles.cache.has if (data != null) { client.guild.channels.create("││" + data.name, { type: "GUILD_TEXT", // syntax has changed a bit parent: "1157076981159034880", permissionOverwrites: [ { id: role.id, allow: [Permissions.FLAGS.VIEW_CHANNEL], }, { id: data.id, allow: [Permissions.FLAGS.VIEW_CHANNEL], }, { id: client.guild.roles.everyone, //To make it be seen by a certain role, user an ID instead //allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], //Allow permissions deny: ['VIEW_CHANNEL'] //Deny permissions , 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY' }, ], }); } }); 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: I tried replacing message.guild.channels.create with client.guild.channels.create but it didn't work, I get an error like guild is not a function or does not exist.

http://stackoverflow.com/a/77509868
answers question: http://stackoverflow.com/q/77508314
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: I figured out that my resulting list was processed again. So I decided to work around that in the Plain clause upon walking the tree. I also only return strings now as plain text instead of wrapping it in pandoc elements again: function map(xs, f) local ys = {} for i,x in pairs(xs) do ys[i] = f(x) end return ys end function startswith(str, sub) return string.sub(str, 1, string.len(sub)) == sub end function processBulletList (bl) inner = bl:walk { BulletList = function (bl) processBulletList(bl.content) end, Plain = function (p) str = pandoc.utils.stringify(p) if startswith(str, '[list]') then return p else return string.format('[*] %s', str) end end, } return string.format('[list]%s[/list]', pandoc.utils.stringify(inner)) end function Writer (doc, opts) local filter = { BulletList = processBulletList } return pandoc.write(doc:walk(filter), 'plain') end The output looks as follows: [list][*] Europe[list][*] Germany[list][*] Berlin[*] Hamburg[/list][/list][/list]
accepted answer of: http://stackoverflow.com/q/77508314
upvote count: 1

proximity
tags question: http://stackoverflow.com/q/77594510
tag name: proximity
type: Tag

http://stackoverflow.com/comment/136728691
type: Comment
has text: i fixed lol i stared the code for 10 minutes and realize i accidentally delete the return response i feel pain right now
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77551269

http://stackoverflow.com/q/77594510
has body: 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? I tried with click detector but nothing happened. Then tried with WaitForChild "proximity prompt" again nothing happened. Even proximity prompt UI not appear.
tagged with: lua
type: UnansweredQuestion
score: 0
answer count: 2
tagged with: proximity
has answer: http://stackoverflow.com/a/77595268
type: Question
has answer: http://stackoverflow.com/a/77594607
tagged with: prompt
tagged with: roblox
has title: Roblox Studio Proximity Prompt Invisible Model

http://stackoverflow.com/comment/136833058
has text: 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
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77616174
type: AnswerComment

http://stackoverflow.com/q/77508314
has title: Custom Pandoc Writer/Filter: Output BulletList as BBCode
has body: I'd like to convert this markdown list (list.md): - Europe - Germany - Berlin - Hamburg To the following output (BBCode): [list] [*]Europe [list] [*]Germany [list] [*]Berlin [*]Hamburg [/list] [/list] [/list] And wrote this script (list.lua): function processBulletList (bl) inner = bl:walk { BulletList = processBulletList, Plain = function (p) return string.format('\n[*]%s', pandoc.utils.stringify(p)) end, } return pandoc.RawBlock('markdown', string.format('[list]\n%s\n[/list]', inner)) end function Writer (doc, opts) local filter = { BulletList = processBulletList } return pandoc.write(doc:walk(filter)) end I run pandoc as follows: $ pandoc list.md -t list.lua -o list.txt Which results in list.txt: [list] BulletList [[Plain [SoftBreak,Str "[*]Europe"],RawBlock (Format "markdown") "[list]\nBulletList [[Plain [SoftBreak,Str \"[*]Germany\"],RawBlock (Format \"markdown\") \"[list]\\nBulletList [[Plain [SoftBreak,Str \\\"[*]Berlin\\\"]],[Plain [SoftBreak,Str \\\"[*]Hamburg\\\"]]]\\n[/list]\"]]\n[/list]"]] [/list] This contains everything that is needed, but I have two major issues: The tree is not converted to plain text. There is a lot of escaping with \. I guess the two problems are related. However, I have no clue what's going on. It looks like walk does not traverse the tree as I'd like it to. Can anybody tell me what I got wrong?
tagged with: lua
score: 1
favorite count: 0
tagged with: bbcode
type: AnsweredQuestion
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/77509868
type: Question
accepted answer: http://stackoverflow.com/a/77509868
tagged with: pandoc
downvote count: 0
tagged with: markdown

http://stackoverflow.com/q/77515602
answer count: 1
type: UnansweredQuestion
has body: 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: local DataStore = game:GetService("DataStoreService"):GetDataStore("ValueSave") local DataStore2 = game:GetService("DataStoreService"):GetDataStore("ValueSave2") local DataStore3 = game:GetService("DataStoreService"):GetDataStore("ValueSave3") local DataStore4 = game:GetService("DataStoreService"):GetDataStore("ValueSave4") local DataStore5 = game:GetService("DataStoreService"):GetDataStore("ValueSave5") local DataStore6 = game:GetService("DataStoreService"):GetDataStore("ValueSave6") game.Players.PlayerAdded:Connect(function(plr) local leaderstats = Instance.new("Folder", plr) leaderstats.Name = "leaderstats" local plrstats = Instance.new("Folder", plr) plrstats.Name = "Multipliers" local cash = Instance.new("IntValue", leaderstats) cash.Name = "Jump" cash.Value = DataStore:GetAsync(plr.UserId) or 1 local cash1 = Instance.new("IntValue", leaderstats) cash.Name = "Run" cash.Value = DataStore5:GetAsync(plr.UserId) or 1 local cash2 = Instance.new("IntValue", leaderstats) cash.Name = "Climb" cash.Value = DataStore6:GetAsync(plr.UserId) or 1 local Upgrade = Instance.new("IntValue", plrstats) Upgrade.Name = "ClimbMultiplier" Upgrade.Value = DataStore4:GetAsync(plr.UserId) or 1 local multi = Instance.new("IntValue", plrstats) multi.Name = "RunMultiplier" multi.Value = DataStore2:GetAsync(plr.UserId) or 1 local cost = Instance.new("IntValue", plrstats) cost.Name = "JumpMultiplier" cost.Value = DataStore3:GetAsync(plr.UserId) or 1 cash.Changed:Connect(function() DataStore:SetAsync(plr.UserId, cash.Value) end) Upgrade.Changed:Connect(function() DataStore4:SetAsync(plr.UserId, Upgrade.Value) end) cost.Changed:Connect(function() DataStore3:SetAsync(plr.UserId, cost.Value) end) multi.Changed:Connect(function() DataStore2:SetAsync(plr.UserId, multi.Value) end) cash1.Changed:Connect(function() DataStore5:SetAsync(plr.UserId, cash1.Value) end) cas…
type: Question
tagged with: roblox
tagged with: lua
has answer: http://stackoverflow.com/a/77531643
has title: Leaderstats Isn't Loading in when the Player joins
score: 0

http://stackoverflow.com/q/77584516
score: 2
tagged with: data-masking
answer count: 1
has comment: http://stackoverflow.com/comment/136791139
has body: 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 article and I have also tried using the out-of-the-box plugin response-rewrite provided by APISIX. In both cases I am receiving the response turned into complete gibberish, in the following manner: Postman response screenshot The expected response would be a json like: { "success": {}, "timeStamp": "2023-12-01 10:03:12.0", "version": "21.2.0.0" } The code being used to filter response: function _M.body_filter(conf, ctx) if conf.filters then local body = core.response.hold_body_chunk(ctx) if not body then return end local err for _, filter in ipairs(conf.filters) do body, _, err = re_gsub(body, filter.regex, filter.replace, "jo") if err ~= nil then core.log.error("regex \"" .. filter.regex .. "\" substitutes failed:" .. err) end end ngx.arg[1] = body return end end I tried to log the response body: local body = core.response.hold_body_chunk(ctx) if not body then return end core.log.error(body) 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.
favorite count: 0
tagged with: apache-apisix
tagged with: redaction
downvote count: 0
type: Question
has title: Seemingly random non ascii characters in response body when using APISIX plugin to rewrite response
tagged with: plugins
has answer: http://stackoverflow.com/a/77594025
tagged with: lua
type: UnansweredQuestion
upvote count: 2

http://stackoverflow.com/q/77467266
score: 0
has title: Model not cloning
has body: I grouped parts together as a Model and it's not cloning, here's my code local space = workspace.Space --the model while wait(1) do for i = 1, 10, 1 do local s = space:Clone() s.Parent = workspace s:MoveTo(Vector3.new(space.Fl.Position.x+i, space.Fl.Position.y, space.Fl.Position.Z)) print(i) wait() end end
type: Question
tagged with: lua
tagged with: roblox
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77471577

libharu
type: Tag
tag name: libharu
tags question: http://stackoverflow.com/q/77449495

http://stackoverflow.com/a/77539621
type: Answer
has body: You can do it like this way... #!/usr/local/bin/lua -- dtref.lua local raindate, raintime, dtab, conv = arg[1] or 19-JAN-38, arg[2] or [[03.14]], {}, "" -- DEBUG! - Disable os library os = nil dtab["day"] = tonumber(raindate:sub(1, 2)) dtab["month"] = tonumber((raindate:gsub("%u+", {["JAN"] = "01", ["FEB"] = "02", ["MAR"] = "03", ["APR"] = "04", ["MAY"] = "05", ["JUN"] = "06", ["JUL"] = "07", ["AUG"] = "08", ["SEP"] = "09", ["OCT"] = "10", ["NOV"] = "11", ["DEC"] = "12"})):sub(4, 5)) dtab["year"] = tonumber(("20%s"):format(raindate:sub(8,9))) dtab["hour"] = tonumber(raintime:sub(1, 2)) dtab["min"] = tonumber(raintime:sub(4, 5)) dtab["sec"] = 0 -- If os Library is present use it else use string.format() if os ~= nil then print("os.date()") conv = os.date("%Y-%m-%dT%H:%M:00.000000Z", os.time(dtab)) else print("string.format()") conv = ("%d-%d-%dT%d:%d:00.000000Z"):format(dtab.year, dtab.month, dtab.day, dtab.hour, dtab.min) end if #arg == 0 then print(conv) elseif #arg == 2 then print(conv) end return(conv) Example of use when os Library is disabled... € chmod +x dtref.lua € ./dtref.lua string.format() 2038-1-19T3:14:00.000000Z € ./dtref.lua 24-DEC-99 23.59 string.format() 2099-12-24T23:59:00.000000Z Known *nix Bug (Y2K38) when using os Library: Cant get Date above 19. Jan 2038 04:14 here (CET) (At UTC 03:14:07) € ./dtref.lua 19-JAN-38 04.14 os.date() 2038-01-19T04:14:00.000000Z € ./dtref.lua 19-JAN-38 04.15 os.date() /usr/local/bin/lua: ./dtref.lua:28: time result cannot be represented in this installation stack traceback: [C]: in function 'os.time' ./dtref.lua:28: in main chunk [C]: in ? ( I change hardcoded values as a warning and border :-) )
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/77536882
downvote count: 0

http://stackoverflow.com/comment/136550918
comment on: http://stackoverflow.com/q/77455606
score: 1
type: Comment
type: QuestionComment
has text: 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.

http://stackoverflow.com/q/77473680
has title: Pathfinding script
tagged with: lua
has answer: http://stackoverflow.com/a/77477155
type: AnsweredQuestion
answer count: 1
accepted answer: http://stackoverflow.com/a/77477155
score: 0
type: Question
has body: I try to make a script for pathfinding but it doesn't work. It says "MoveTo() is not a valid member Path "Instance"" Is it because MoveTo() doesn't work and more importantly, what alternatives do I have? local PathFindingService = game:GetService("PathfindingService") local Agent = game.Workspace.StarterCharacter.Humanoid AgentRadius = 2 -- Settings Agent AgentHeight = 5 AgentCanJump = false AgentCanClimb = false AgentSlope = 10 AgentMaxAcceleration = 1000 AgentMaxSpeed = 16 AgentArrivalDistance = 1 -- end settings agent print(type(PathFindingService)) while true do if Agent then local destination= Vector3.new(math.random(-571,165),5.5,math.random(-495,361)) print(true) if destination then local path = PathFindingService:CreatePath() if path then print(true) start = Agent.HumanoidRootPart.Position if start then path:ComputeAsync(start, destination) path:MoveTo(Agent) --error else print (false) end end end end wait(5) end
tagged with: roblox

http://stackoverflow.com/a/77537993
type: Answer
has body: local _,victim = pcall(nearestenemy)
answers question: http://stackoverflow.com/q/77521327
score: 0

http://stackoverflow.com/q/77495184
tagged with: neovim
has answer: http://stackoverflow.com/a/77575033
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/79232720
has title: nvim "failed to run config for nvim-dap", loader.lua:369 attemp to call field 'setup' (a nil value)
tagged with: configuration
tagged with: lua
tagged with: debugging
score: 2
has body: I am getting the following error when I startup nvim, not sure why? "nvim "failed to run config for nvim-dap", loader.lua:369 attemp to call field 'setup' (a nil value)" I started off using lazyvim, and my lua config has the following entry { "mfussenegger/nvim-dap" }, I managed to setup JS/TypeScript debugging and it seems to be working fine. I just want this startup error message fix.
type: UnansweredQuestion
favorite count: 0
upvote count: 2
answer count: 2

http://stackoverflow.com/q/77520256
has comment: http://stackoverflow.com/comment/136664349
has comment: http://stackoverflow.com/comment/136673526
type: UnansweredQuestion
tagged with: zerobrane
has comment: http://stackoverflow.com/comment/136675146
has body: 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). In the below Lua script if I have the SomeMethod() call commented out then it runs through and the output is "userdata (2)". 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? require "SciApiLuaExtLib" local myData = MyData({0.1, 0.2}, 2) print(type(myData) .. " (" .. myData:GetNumPoints() .. ")") function SomeMethod() end --SomeMethod() 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: assert (lua_isuserdata (L, 1)); // warn on security bypass I use ZeroBrane for debugging (if that helps anyhow).
tagged with: luabridge
answer count: 0
score: 0
type: Question
has comment: http://stackoverflow.com/comment/136683828
has title: Getting Assertion Failed error when debugging Lua script
tagged with: lua

http://stackoverflow.com/comment/136650701
comment on: http://stackoverflow.com/q/77512688
type: Comment
score: 0
has text: and my code: ``function Onplrjoined(plr) local leaderstats = Instance.new("Folder") leaderstats.Parent = plr leaderstats.Value = 0 leaderstats.Name = "leaderstats" local stat = Instance.new("IntValue", leaderstats) stat.Name = "Coins" stat.Value = 0 end local players = game:WaitForChild("Players") players.PlayerAdded:Connect(Onplrjoined)``
type: QuestionComment

http://stackoverflow.com/comment/136684902
comment on: http://stackoverflow.com/a/77472849
has text: пункт 1 выполнил? проверить можно, нажав кнопку P в игре, это должно дать такой же эффект, как и выстрел левой кнопкой мыши. после того, как сможешь кнопкой P стрелять, ставь скрипт
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/136707506
has text: You should recalculate the remaining distance on every step.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77538184
type: Comment

http://stackoverflow.com/q/77518115
has title: Teachers, I have a question about Logitech g-hub
tagged with: logitech-gaming-software
upvote count: 1
answer count: 1
type: UnansweredQuestion
has body: 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 "8," it will only be pressed once. I hope that if I hold the button "8" 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? EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 8 then repeat PressMouseButton(1) Sleep(math.random(70,120)) PressKey("q","s") Sleep(math.random(70,120)) ReleaseMouseButton(1) ReleaseKey("q","s") until not IsMouseButtonPressed(8) end end If I press the "8" button just once and touch it, I hope it keeps clicking randomly and continuously. And hope the macro stops once I press the button "8" again. I'd really appreciate it if you could answer me. I tried to delete "repeat", but when I deleted it, I got an error, so I can't do this or that. And I tried to change it to "PressAndReleaseMouseButton()" but not only did I get a random value, but rather the speed of pressing the button was faster.
favorite count: 0
downvote count: 0
tagged with: logitech
score: 1
type: Question
has answer: http://stackoverflow.com/a/77520385
tagged with: lua

http://stackoverflow.com/comment/136682846
type: AnswerComment
has text: autoclick does not work, and caps lock
type: Comment
comment on: http://stackoverflow.com/a/77472849
score: 0

http://stackoverflow.com/comment/136673526
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77520256
type: Comment

http://stackoverflow.com/comment/136795828
type: Comment
score: 2
type: QuestionComment
comment on: http://stackoverflow.com/q/77582051
has text: Isn't there a `then` missing as well?

http://stackoverflow.com/comment/136938221
type: Comment
score: 1
has text: Standard Lua uses lowercase keywords.
type: QuestionComment
comment on: http://stackoverflow.com/q/77582051

http://stackoverflow.com/comment/136525723
comment on: http://stackoverflow.com/a/77441277
has text: Thanks, it’s always the silliest little mistakes.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/77426782
score: 0
tagged with: world-of-warcraft
has comment: http://stackoverflow.com/comment/136500185
answer count: 0
has comment: http://stackoverflow.com/comment/136500368
type: Question
has body: In Warcraft Vanilla 1.12 Lua there's no built-in support for ("foo %s"):format("xyz") (there's only format("foo %s", "xyz")). So I thought to add a polyfill of sorts like so: local _format = assert(format or string.format) -- vanilla-wow-lua does have format on the global scope so we can use it here local _getmetatable = assert(getmetatable) local _setmetatable = assert(setmetatable) local _stringMetatable = _getmetatable(string) if not _stringMetatable then _stringMetatable = { __index = {} } -- standard-lua returns a metatable but wow-lua returns nil _setmetatable(string, _stringMetatable) end function _stringMetatable:format2(formatString, ...) if not unpack then return _format(self, formatString, ...) -- official lua end return _format(self, formatString, unpack(arg)) -- warcraft end _stringMetatable.__index.format2 = _stringMetatable.format2 This gets loaded just fine both in official lua (https://www.lua.org/cgi-bin/demo) and on the World of Warcraft 1.12. However if we try to use it like so: local foobar = ("foo %s"):format2("abc") print(foobar) This only works on the official lua. Warcraft throws an error which says "attempt to index a string value". If I switch over to function-call style then it works on both standard-lua and wow-lua: local foobar = string.format2("foo %s", "abc") print(foobar) I can't understand why Warcraft fails to cooperate in this regard when it comes to strings. Any ideas on how to fix this?
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136500203
has title: Adding an additional method to lua's string works in official Lua but it doesn't work on Warcraft 1.12 Lua
has comment: http://stackoverflow.com/comment/136500222

http://stackoverflow.com/q/77439054
tagged with: coronasdk
tagged with: addeventlistener
answer count: 1
type: UnansweredQuestion
has title: Unable to specify a table object to a event listener in Lua
score: 0
has answer: http://stackoverflow.com/a/77508380
has body: I'm following a Solar2d tutorial (https://docs.coronalabs.com/guide/programming/index.html) 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: How can I make a tap remove the balloon image? Where should I add code to remove a tapped balloon from table? Is a for-loop inside gameloop? Thanks in advance! `----------------------------------------------------------------------------------------- -- -- main.lua -- ----------------------------------------------------------------------------------------- --prep the physics local physics = require("physics") physics.start() physics.setGravity(0, -20) --seed the random number generator math.randomseed( os.time() ) --prep the graphic groups local backGroup = display.newGroup() local mainGroup = display.newGroup() local uiGroup = display.newGroup() --prep variables local newBalloon local tappedBalloon local balloonTable = {} --load background local background = display.newImageRect(backGroup, "pictures/mainGroup/background.png", 360, 570) background.x = display.contentCenterX background.y = display.contentCenterY --load boundaries local border = display.newImageRect(mainGroup, "pictures/mainGroup/border.png", 281, 35) border.x = display.contentCenterX border.y = display.contentHeight-440 physics.addBody( border, "static" ) local function popBalloon( event ) local tappedBalloon = event.target if event.phase == "began" then display.remove(tappedBalloon) --removing balloon from table? end end --creating and storing balloons local function createBalloon () local newBalloon = display.newImageRect(mainGroup, "pictures/mainGroup/balloon2.png", 118, 118) if newBalloon then table.insert(balloonTable, newBalloon) physics.addBody( newBalloon, "dynamic", { radius=50, bounce=0.2 } )…
tagged with: lua
type: Question

http://stackoverflow.com/q/77547671
favorite count: 0
answer count: 1
has answer: http://stackoverflow.com/a/77547672
type: Question
score: 3
has title: Minetest: Revoking and granting player privileges
downvote count: 0
tagged with: minetest
upvote count: 3
tagged with: lua
has body: I want to revoke the interact privilege from a player (let's call him singleplayer). I tried minetest.set_player_privs("singleplayer", {interact = false}) But this revokes all other privileges, and grants interact. I then tried local privs = minetest.get_player_privs("singleplayer") privs.interact = false minetest.set_player_privs("singleplayer", privs) But this does not revoke interact; it even grants interact if the player doesn't already have it. For granting the interact privilege, I tried minetest.set_player_privs("singleplayer", {interact = true}). This worked, but revoked all other privileges.
type: UnansweredQuestion

http://stackoverflow.com/comment/136698925
has text: I'm trying to reproduce your error but i'm not able to, could you provide your output of `:echo stdpath('config')` inside neovim?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77539961

http://stackoverflow.com/comment/136500526
comment on: http://stackoverflow.com/q/77427482
has text: 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?
score: 2
type: Comment
type: QuestionComment

sorting
tag name: sorting
type: Tag
tags question: http://stackoverflow.com/q/77427482
tags question: http://stackoverflow.com/q/78739507

http://stackoverflow.com/comment/136699030
score: 0
type: QuestionComment
has text: Result is `/Users/wmoorby/.config/nvim` so my nvim is pointing to the correct location to be picking up the config
comment on: http://stackoverflow.com/q/77539961
type: Comment

http://stackoverflow.com/comment/136500203
has text: @ESkri it uses a trimmed down version of Lua 5.1 - certain features are missing
comment on: http://stackoverflow.com/q/77426782
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/77443353
score: 1
accepted answer of: http://stackoverflow.com/q/77443231
answers question: http://stackoverflow.com/q/77443231
upvote count: 1
has comment: http://stackoverflow.com/comment/136528779
downvote count: 0
has comment: http://stackoverflow.com/comment/136528481
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/136536094
has comment: http://stackoverflow.com/comment/136547624
has body: The Lua standalone interpreter both puts the command-line arguments into the global arg and passes them to the chunk that it calls. In other words, when you do lua play.lua file1, something like this happens: arg = {"file1"} assert(loadfile("play.lua"))("file1") And the script can then use either the varargs syntax ... or the global arg to access them. Your play.lua uses the latter. assert(loadfile("play.lua"))("file1") gives an error because it's only setting up the former. assert(loadfile("play.lua")) isn't doing anything because it's only loading the chunk, not actually calling it. Adding an extra set of empty parentheses, i.e., assert(loadfile("play.lua")(), will fix that, and in combination with you setting arg[1], will make it work.
has comment: http://stackoverflow.com/comment/136535811

editor
tag name: editor
type: Tag
tags question: http://stackoverflow.com/q/77490875
tags question: http://stackoverflow.com/q/77546645

http://stackoverflow.com/comment/136719503
score: 0
has text: its roblox lua lol
comment on: http://stackoverflow.com/a/77551374
type: AnswerComment
type: Comment

http://stackoverflow.com/a/77457935
accepted answer of: http://stackoverflow.com/q/77455606
type: AcceptedAnswer
type: Answer
has body: My question was: What does "7:0" mean as the representation of a number whose value is at least close to 7. The answer seems to be: It's a quirk of QLua. I tried the online parser at JDoodle: the 5.3 versions all produced "2.0" the 5.4 version produced "2" If I pursue this, I think it will have to be with the people associated with QLua.
answers question: http://stackoverflow.com/q/77455606
score: 0

http://stackoverflow.com/q/77567066
answer count: 0
has title: Nginx Lua module for redirecting based on proxy and access headers
type: Question
tagged with: lua
has comment: http://stackoverflow.com/comment/136775270
has body: 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 if it does not. For user with access app creates string isprotectedfalse and for guests I get isprotected add_header X-User-Access-Flag $userinfo$arg_limit$upstream_http_x_doc_protection; #this works if ($http_x_user_access_flag = "isprotected") { #this doesnt return 302 $scheme://$http_host$uri?limit=true; } and similar code but in lua: rewrite_by_lua_block { local params = ngx.req.get_uri_args() local limit = params["limit"] local headers = ngx.resp.get_headers() local useraccesss = headers["X-User-Access-Flag"] if useraccesss == "isprotected" and limit == nil then local delimiter = (ngx.var.is_args == "" or ngx.var.is_args == nil) and "?" or "&" local new_url = ngx.var.request_uri .. delimiter .. "limit=true" return ngx.redirect(new_url) end } why is it not redirecting as expected? Edit: From using header_filter_by_lua_block I have managed to access them from ngx.var['upstream_http_x_user_access_flag'] 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...) I can not access such ngx.var from rewrite_by_lua_block as this has not performed proxy_pass yet. How could I access this variables after auth + proxy_pass and redirect based on aquired headers?
has comment: http://stackoverflow.com/comment/136778216
score: 1
upvote count: 1
downvote count: 0
type: UnansweredQuestion
tagged with: nginx
favorite count: 0
tagged with: webserver

http://stackoverflow.com/q/77427482
has comment: http://stackoverflow.com/comment/136500526
answer count: 1
type: UnansweredQuestion
has title: Lua sorting a table twice by different fields
score: 0
has answer: http://stackoverflow.com/a/77427604
tagged with: sorting
tagged with: multidimensional-array
has body: Below is a sample table structure of what I am wanting to sort. Data = { ["C1_RN1::F1"] = { ["class"] = "Hunter", ["name"] = "C1", ["faction"] = "Faction", ["race"] = "Human", ["realm"] = "RN1", }, ["C2_RN1::F1"] = { ["class"] = "Priest", ["name"] = "C2", ["faction"] = "Faction", ["race"] = "Undead", ["realm"] = "RN1", }, ["C3_RN1::F1"] = { ["class"] = "Hunter", ["name"] = "C3", ["faction"] = "Faction", ["race"] = "Human", ["realm"] = "RN1", } } So for example I would like to sort by race alphabetically, and sort all the "Human" race characters by class also alphabetically, and sort any other "races" also by alphabetically independent of another "race". I know how to sort by just one by dumping all the character names into a 2nd table with the same keys as the data table, and then comparing data in the data table using table.sort and a that compares data with the less than operator such as data[a].race < data[b].race. 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 = after the <. local function SortThis() local temp = {} for c in pairs(Data) do table.insert(temp, c); end table.sort(temp, function(a, b) return Data[a].race < RestXP_Data[b].race; end) end
type: Question
has comment: http://stackoverflow.com/comment/136501624
tagged with: lua
tagged with: lua-table

http://stackoverflow.com/q/77582051
has comment: http://stackoverflow.com/comment/136772540
tagged with: syntax-error
type: Question
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136938221
tagged with: pico-8
answer count: 1
has title: How do I fix this PICO-8 error? ')' expected near '='
has answer: http://stackoverflow.com/a/77674710
has comment: http://stackoverflow.com/comment/136832545
has body: 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. So I began by using a boolean variable to keep track of whether the player was touching the edge of the screen: INBOUNDS. Then I tried using an if statement to determine whether the x coordinate was in the limits: -- CHECK IF PLAYER IS IN THE SCREEN IF (X = 0 OR X = 128) INBOUNDS = FALSE END When the program ran, however, I got an error in the console that read: SYNTAX ERROR LINE 22 (TAB 0) IF (X = 0 OR X = 128) ')' EXPECTED NEAR '=' Here is the link to the cartridge file: https://drive.google.com/file/d/1H0snkt8oza1tXiy0__kTVUX7DMYvdJSr/view?usp=sharing If you need any more info, please ask. Thanks!
has comment: http://stackoverflow.com/comment/136795828
score: 0

http://stackoverflow.com/comment/136736817
type: AnswerComment
comment on: http://stackoverflow.com/a/77545233
has text: @JosephSible - Yes.
type: Comment
score: 0

http://stackoverflow.com/q/77513429
has title: Team a player on button click (roblox studio)
has body: I am trying this code local player = game.Players.LocalPlayer script.Parent.MouseClick:Connect(function() -- Change team color to "Really Blue" player.TeamColor = BrickColor.new("Really blue") -- Kill the player local character = player.Character if character then local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid.Health = 0 end end end) But for some reason when I press the button I do not get teamed. I am new to coding the language is lua (roblox studio) I've tried changing the color a couple times to different things all same result.
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/77525989
tagged with: roblox
type: Question
tagged with: lua
type: UnansweredQuestion

http://stackoverflow.com/comment/136675146
type: Comment
score: 0
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77520256

http://stackoverflow.com/comment/136613903
type: Comment
has text: 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).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77452444

http://stackoverflow.com/a/77537699
answers question: http://stackoverflow.com/q/77536882
has comment: http://stackoverflow.com/comment/136774348
has comment: http://stackoverflow.com/comment/136774794
has comment: http://stackoverflow.com/comment/136701213
has body: you need to match each date and time element, get the numeric value of the month, set it all as a table and then convert it to a formatted string: local a='07-NOV-23' --self.value['raindate'].value local b='16.30' --self.value['raintime'].value local dd, mm, yy = string.match(a,'(%d+)%-(%w+)%-(%d+)') local hour, min = string.match(b,'(%d+)%.(%d+)') local months = { ["jan"]=1, ["feb"]=2, ["mar"]=3, ["apr"]=4, ["may"]=5, ["jun"]=6, ["jul"]=7, ["aug"]=8, ["sep"]=9, ["oct"]=10, ["nov"]=11, ["dec"]=12 } local month = months[string.lower(mm)] -- 1) with os library: local t = {year='20'..yy, month=month, day=dd,hour =hour , min=min, sec=0 } print (os.date ("%Y-%m-%dT%X.000000Z",os.time(t)) ) -- 2) or simply: print( string.format('20%d-%02d-%02dT%02d:%02d:00.000000Z', yy,month, dd, hour, min ) ) -- 2023-11-07T16:30:00.000000Z
has comment: http://stackoverflow.com/comment/136701607
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136764583
has comment: http://stackoverflow.com/comment/136768020
upvote count: 2
type: Answer

http://stackoverflow.com/comment/136699074
comment on: http://stackoverflow.com/q/77539961
type: Comment
score: 0
type: QuestionComment
has text: keep your config but go to /Users/wmoorby/.local/share/ and delete the nvim folder, then restart your terminal, start nvim and it should load up lazyvim, you could also delete your lazy-lock.json for good measure

http://stackoverflow.com/comment/136607226
comment on: http://stackoverflow.com/q/77484441
score: 0
type: QuestionComment
has text: 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.
type: Comment

http://stackoverflow.com/q/77553609
has title: Sublime Text: embedding Lua code in html with highlighting
upvote count: 1
tagged with: sublimetext
favorite count: 0
has body: 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? Something like this: Test <? local n = 3 ?> Test number <? print(n) ?>
has comment: http://stackoverflow.com/comment/136732471
type: Question
downvote count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/136726675
tagged with: lua
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/136722219
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/77429985
tagged with: lua
answer count: 0
has body: 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. 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. 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)
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/136504913
type: UnansweredQuestion
favorite count: 0
has title: "Type hints" for Lua
upvote count: 2
type: Question

http://stackoverflow.com/comment/136728060
score: 0
type: AnswerComment
has text: проверь по каждому из пунктов: 1) можно стрелять ЛКМ, 2) можно стрелять кнопкой P, 3) при нажатой ЛКМ можно стрелять кнопкой P, 4) при нажатой кнопке P можно стрелять ЛКМ. какие пункты работают, какие нет?
comment on: http://stackoverflow.com/a/77472849
type: Comment

http://stackoverflow.com/comment/136712791
has text: 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.
comment on: http://stackoverflow.com/a/77546708
type: AnswerComment
score: 0
type: Comment

world-of-warcraft
tags question: http://stackoverflow.com/q/77426782
type: Tag
tag name: world-of-warcraft
tags question: http://stackoverflow.com/q/77789995
tags question: http://stackoverflow.com/q/77860780
tags question: http://stackoverflow.com/q/78293342
tags question: http://stackoverflow.com/q/78852175
tags question: http://stackoverflow.com/q/78927835
tags question: http://stackoverflow.com/q/79206391
tags question: http://stackoverflow.com/q/79409178

http://stackoverflow.com/q/77536882
has answer: http://stackoverflow.com/a/77539621
tagged with: lua
type: UnansweredQuestion
has body: The current date and time format we're getting from the device is (DD-MON-YY) 07-NOV-23 and (HH.MM) 16.30. SO we need to re-format as &quot;2023-11-07T16:30:00.000000Z before pushing into the payload. We tried below LUA local a=self.value['raindate'].value\nlocal b=self.value['raintime'].value\nvalue=string.format('%sT%s',a,b) and the result was 23-NOV-23T16:30 we're trying to achieve the output as 2023-11-07T16:30:00.000000Z Requesting anyone help on this? Thanks in advance
answer count: 2
upvote count: 1
has title: To convert time stamp in lua
favorite count: 0
downvote count: 1
score: 0
has answer: http://stackoverflow.com/a/77537699
type: Question

http://stackoverflow.com/a/77546153
has body: keep your config but go to ~/.local/share/ and delete the nvim folder, then restart your terminal, start nvim and it should load up lazyvim.
accepted answer of: http://stackoverflow.com/q/77539961
type: AcceptedAnswer
upvote count: 13
type: Answer
answers question: http://stackoverflow.com/q/77539961
score: 13
downvote count: 0
has comment: http://stackoverflow.com/comment/139482555

http://stackoverflow.com/comment/137179496
comment on: http://stackoverflow.com/a/77789470
type: AnswerComment
type: Comment
score: 0
has text: 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)

http://stackoverflow.com/q/77544656
has body: 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 https://stackoverflow.com/a/61684333/22979136 I modified this result and eventualy end up with this local file_env = {} local file_chunk = {} function AddScript(ScriptLocation, index, Nd) file_env[index] = setmetatable({}, {__index = _G}) file_chunk[index] = loadfile(ScriptLocation) _ENV = file_env[index] file_chunk[index]() file_env[index].InitNode(Nd) file_env[index].Start() end function UpdateScript(index) print(file_env[index]) file_env[index].Update() end but there is some issue when I call the "UpdateScript" function in my c++ program I get no result and "print(file_env[index])" just gives me the "nill" result how can I fix this? I tried to call the "UpdateScript" function inside the "AddScript" function but that didnt seem to help
answer count: 1
has comment: http://stackoverflow.com/comment/136708461
score: 0
type: Question
linked to: http://stackoverflow.com/q/61683579
has title: Using multiple Lua scripts with c++
tagged with: lua
linked to: http://stackoverflow.com/q/14290527
has answer: http://stackoverflow.com/a/77545233
tagged with: c++
type: UnansweredQuestion

http://stackoverflow.com/q/77572462
has title: Logitech Lua detect double click or hold
tagged with: lua
tagged with: logitech-gaming-software
type: UnansweredQuestion
favorite count: 0
score: -1
downvote count: 1
answer count: 1
upvote count: 0
has answer: http://stackoverflow.com/a/77576539
type: Question
has body: 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. 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. Here is my first attempt at a hold program: function OnEvent(G_PRESSED, G5) Sleep(500) if IsMouseButtonPressed(5) then MoveMouseTo(0,0) end end

http://stackoverflow.com/a/77789470
downvote count: 2
upvote count: 0
score: -2
type: Answer
has body: 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
answers question: http://stackoverflow.com/q/77539961
has comment: http://stackoverflow.com/comment/137179496

http://stackoverflow.com/a/77537791
has body: local tower,enemy=script.Parent,workspace.Enemy local distance=(tower:GetBoundingBox().p-enemy.Humanoid.Torso.Position).magnitude print(distance)
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/136695202
answers question: http://stackoverflow.com/q/77534396

http://stackoverflow.com/comment/136723087
has text: still not working
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77551374
type: Comment

http://stackoverflow.com/comment/136562805
type: Comment
comment on: http://stackoverflow.com/q/77462458
type: QuestionComment
score: 0
has text: Nothing is inside `if event == "MOUSE_BUTTON_PRESSED" and arg == 9 then`; `elseif` closes it.

http://stackoverflow.com/q/77533955
has comment: http://stackoverflow.com/comment/136688376
tagged with: redis
has comment: http://stackoverflow.com/comment/136688493
has title: why can't get value from lua in redis
favorite count: 0
has answer: http://stackoverflow.com/a/77534466
type: Question
answer count: 1
has body: I use lua to save. the data to redis. redis.call('SET', KEYS[1], cjson.encode(ARGV[1])) ARGV1 is the go struct. The go code to pass the struct to redis lua here is my struct looks like type InviteInfo struct { ... MaxPeers int32 `json:"maxPeers"` RouteVersion int32 `json:"routeVersion"` ... } and use below lua to query the data. local data = redis.call('GET', KEYS[1]) -- Parse JSON local inviteInfo = cjson.decode(data) -- Compare routeVersion if tonumber(inviteInfo['routeVersion']) ~= tonumber(ARGV[1]) then return "route version mismatch" end the inviteInfo['routeVersion'] is always nil I expect the inviteInfo['routeVersion'] should be number value instead of nil. I tried the lua in local redis and works, weird why don't work in staging.. enter image description here Update, issue fixed the previous flow is pass go struct to lua -> cjson.encode -> save get data from redis -> cjson.decode -> invite.routeVersion (this don't work) -> save changed to go struct -> json.marshal -> pass string to lua -> save get data from redis -> cjson.decode -> invite.routeVersion (this works) -> save The difference. i queried the saved data in redis. previously the saved data looks like {\"routeVersion\":1}. after change, the saved data looks like {"routeVersion"}
tagged with: go
downvote count: 0
upvote count: 1
tagged with: lua
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/136719539
has text: or maybe the url
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77551374
type: AnswerComment

zerobrane
type: Tag
tags question: http://stackoverflow.com/q/77520256
tag name: zerobrane

http://stackoverflow.com/comment/136739587
score: 2
type: Comment
comment on: http://stackoverflow.com/a/77561402
type: AnswerComment
has text: [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.

iterator
type: Tag
tag name: iterator
tags question: http://stackoverflow.com/q/77561246
tags question: http://stackoverflow.com/q/78219522

http://stackoverflow.com/a/77544277
score: 0
type: Answer
has body: Your code needs to be a script, not a local script. A local script runs on client side, meaning that it only affects the client. Just change this to a script (which runs on server side) in ServerScriptService. Which will need a couple of adjustments Here's the code: --this runs when a player connects to the server game:GetService("Players").PlayerAdded:Connect(function(player) --create the BoolValue local BoolValue = Instance.new("BoolValue") --this runs when the player's character is created --this is used so that the BoolValue parent is the character and not null player.CharacterAdded:Connect(function(character: Model) --Move the BoolValue to the character! BoolValue.Parent = character end) end) Basically, client side (local scripts) only run on the client (only the player) And server side (scripts) run for everyone on the server And another way to do this is by creating an instance of BoolValue and moving it into StarterCharacterScripts (which also works)
answers question: http://stackoverflow.com/q/77442333

arguments
tags question: http://stackoverflow.com/q/77443231
type: Tag
tag name: arguments

http://stackoverflow.com/q/77472284
tagged with: logitech-gaming-software
tagged with: lua
has answer: http://stackoverflow.com/a/77472849
has body: 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. EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then repeat MoveMouseRelative(0,10) Sleep(15) PressAndReleaseMouseButton(1) Sleep(15) until not IsMouseButtonPressed(5) end end.
answer count: 1
type: UnansweredQuestion
score: 0
has title: How do I make an Auto Clicker Macro in Lua script inside Logitech ghub? please
tagged with: logitech
type: Question

http://stackoverflow.com/comment/136832545
score: 0
type: QuestionComment
has text: Yes, but I fixed that by doing compact if `IF (X == 0 OR X == 128) INBOUNDS = FALSE`
type: Comment
comment on: http://stackoverflow.com/q/77582051

http://stackoverflow.com/tag/pdf
type: Tag
tags question: http://stackoverflow.com/q/77449495
tag name: pdf
tags question: http://stackoverflow.com/q/78567123
tags question: http://stackoverflow.com/q/79386149
tags question: http://stackoverflow.com/q/79387197

unluac
tag name: unluac
tags question: http://stackoverflow.com/q/77507409
type: Tag

http://stackoverflow.com/comment/136676912
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77521327
has text: Yes, they have a humanoid and the first few enemies on the track die before the error occurs
type: Comment

http://stackoverflow.com/comment/136567804
comment on: http://stackoverflow.com/q/77464631
type: QuestionComment
type: Comment
has text: 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
score: 0

http://stackoverflow.com/a/77446288
score: 0
type: Answer
has body: local Players=Game.Players local function NEWGAME() repeat players=Players:players()until#players&gt;1 or not Players.PlayerAdded:Wait() table.foreachi(players,function(i,v)getfenv()["player"..i]=table.remove(players,math.random(1,#players))end) for i = 10, 0, -1 do status.Text = "Starting in "..i wait(1) end print("Player 1 is "..tostring(player1)) print("Player 2 is "..tostring(player2)) end;status=Instance.new("Hint",Workspace)NEWGAME()
answers question: http://stackoverflow.com/q/77443399

http://stackoverflow.com/a/77538184
has comment: http://stackoverflow.com/comment/136711668
has comment: http://stackoverflow.com/comment/136706614
answers question: http://stackoverflow.com/q/77536487
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/136723334
has comment: http://stackoverflow.com/comment/136707506
upvote count: 1
has body: MoveMouseRelative expects distance in 1 pixel units (screen width = 1920 units) GetMousePosition returns distance in (screen_size)/64K units (screen width = 65536 units) You should convert values correctly.
score: 1

http://stackoverflow.com/comment/136745164
type: QuestionComment
score: 0
has text: 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
type: Comment
comment on: http://stackoverflow.com/q/77566514

http://stackoverflow.com/q/77464631
has comment: http://stackoverflow.com/comment/136567804
has comment: http://stackoverflow.com/comment/136574578
score: 0
type: Question
tagged with: roblox
answer count: 0
tagged with: lua
tagged with: lua-table
has body: 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. The (relevant) part of the script executing: local userRankInGroup = plr:GetRankInGroup(32494019) for _, division in pairs(config) do local groupIdToCheck = division["Group Id"] if userRankInGroup and userRankInGroup >= division["Minimum RankId"] and userRankInGroup <= division["Maximum RankId"] then clonedUI.DivRank.Text = division["Regiment Name"] clonedUI.DivRankShadow.Text = division["Regiment Name"] clonedUI.regimentFrame.regimentIcon.Image = division["Image Id"] clonedUI.regimentFrame.BackgroundColor3 = division["Regiment Color"] print("Overhead GUI for".. plr .."has loaded successfully.") break else end end The moduleScript: local regiments = { ["Office of The Inspector General"] = { ["Regiment Name"] = "OIG", ["Group Id"] = 32921091, ["Image Id"] = "http://www.roblox.com/asset/?id=14412072617", ["Regiment Color"] = Color3.new(0.435294, 0.372549, 0.0117647), ["Minimum RankId"] = 5, ["Maximum RankId"] = 250, }, ["Naval Special Warfare Command"] = { ["Regiment Name"] = "NSWC", ["Group Id"] = 32954415, ["Image Id"] = "http://www.roblox.com/asset/?id=15186922222", ["Regiment Color"] = Color3.new(0.129412, 0.129412, 0.129412), ["Minimum RankId"] = 5, ["Maximum RankId"] = 250, }, } return regiments I tried pulling local userRankInGroup = plr:GetRankInGroup(32494019) down after if userRankInGroup and userRankInGroup >= division["Minimum RankId"] and userRankInGroup <= division["Maximum RankId"] then 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.
has title: Pulling GroupId from moduleScript
type: UnansweredQuestion

http://stackoverflow.com/q/77527042
type: Question
tagged with: lua
has title: Can't run /usr/bin/demo from lua scripts
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136680555
has comment: http://stackoverflow.com/comment/136681074
score: 0
has comment: http://stackoverflow.com/comment/136884153
answer count: 0
has body: lua version = 5.3.4. I want to run os.excute(/usr/bin/demo &amp;) in lua，it will occur attempt to call a nil value (field 'execute') But when I am in Lua interactive mode, it is normal to execute os.execute(&quot;/usr/bin/demo &amp;&quot;). Does the Lua script have no permission to execute shell instructions? Or is there any other better way to execute shell instructions? I need it running in lua scripts file

http://stackoverflow.com/a/77432563
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77429315
score: 1
has comment: http://stackoverflow.com/comment/136516939
answers question: http://stackoverflow.com/q/77429315
has body: When parsing your file, ctags created a test tag, note the trailing space, not a test 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. Since the actual tag is test , a search for test with -t test or :tag test won't work because the search is literal. You would have to… search for test , with the space, in Vim: :tag test , or search for the regexp test: :tag /test inside Vim, or: search for the regexp test from your shell: $ vim -t /test. See :help tag-regexp. 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 $ man ctags) or try Universal Ctags, as mentioned in the comments, which might or might not be smarter than Exuberant Ctags in this particular scenario.
upvote count: 1

http://stackoverflow.com/comment/136695202
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77537791
score: 1
has text: This answer is missing an explanation

http://stackoverflow.com/a/77705959
accepted answer of: http://stackoverflow.com/q/77504584
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/77504584
has body: There seems to be no easy way to alter or substitute the \caption 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 Haskell Latex writer. But there is another Lua solution using Lua(la)tex 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 --template flag in pandoc: \ifLuaTeX \usepackage{luacode} \begin{luacode*} local count = 0 function replace_caption_with_sidecaption(line) if string.find(line, "\\begin{figure}.*") then in_figure_env = true end if string.find(line, "\\end{figure}") then in_figure_env = false end if in_figure_env and string.find(line, "^(%s*)\\caption") then if count == 0 then line = line:gsub("\\caption", "\\sidecaption", 1) local count = count + 1 end end return line end \end{luacode*} \directlua{luatexbase.add_to_callback("process_input_buffer", replace_caption_with_sidecaption, "replace_caption_with_sidecaption")} \fi This code substitutes evert \caption string with \sidecaption as long as it is located inside a figure environment and there the first macro of the line. It works great, but, of course, makes Lualatex the mandatory compilation program.

http://stackoverflow.com/comment/136723085
score: 0
has text: local Response = " " .. string.gsub(HttpService:JSONDecode(response.Body).candidates[1].output, "\n", " ")
type: Comment
comment on: http://stackoverflow.com/a/77551374
type: AnswerComment

http://stackoverflow.com/comment/136532020
comment on: http://stackoverflow.com/q/77443399
type: QuestionComment
has text: 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.
type: Comment
score: 0

http://stackoverflow.com/a/77576539
upvote count: 1
answers question: http://stackoverflow.com/q/77572462
downvote count: 0
score: 1
has body: "DPI shift" action can be assigned to any physical mouse button. So, I don't know which button you are talking about. Assuming you want to simulate key "A" press when mouse button 5 ("Forward") is pressed: function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then PressAndReleaseKey("A") end end
type: Answer

http://stackoverflow.com/comment/136700612
score: 0
comment on: http://stackoverflow.com/a/77534466
has text: changed to save string instead of go struct, works thanks
type: AnswerComment
type: Comment

http://stackoverflow.com/q/77550367
has title: How to automating title and filename synchronization in Quarto Markdown with Lua filters?
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/136996547
tagged with: lua
tagged with: yaml
tagged with: quarto
has comment: http://stackoverflow.com/comment/137002216
type: UnansweredQuestion
type: Question
upvote count: 1
tagged with: pandoc
has body: 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 title and output-file fields is excessively verbose and cumbersome. Is there a method, perhaps through a Lua filter, to reference the value of title and apply it to output-file? --- title: "\\Large \\textbf{Awesome title but Hanc marginis exiguitas non caperet}" format: pdf: output-ext: "pdf" output-file: "Awesome title but Hanc marginis exiguitas non caperet" --- foo bar MWE I have attempted to create a Lua filter named set-output-file.lua, but I am concerned that it may not successfully access the value of meta.format.pdf['output-file']. -- file: set-output-file.lua function Meta(meta) if meta.title then -- Remove LaTeX commands and special characters to create a valid filename local filename = pandoc.utils.stringify(meta.title) filename = filename:gsub("\\%a+", ""):gsub("[^%w%s]", ""):gsub("%s+", "_") -- Check if format.pdf exists, if not create it if not meta.format then meta.format = pandoc.MetaMap({}) end if not meta.format.pdf then meta.format.pdf = pandoc.MetaMap({}) end -- Set the output-file within the pdf sub-table meta.format.pdf['output-file'] = filename end return meta end --- title: "\\Large \\textbf{Awesome title but Hanc marginis exiguitas non caperet}" format: pdf: output-ext: "pdf" filters: - set-output-file.lua --- foo bar
favorite count: 0
answer count: 0

http://stackoverflow.com/a/77557580
score: 0
type: Answer
has body: fixed version answered my own question. i feel dumb --google palm-- --roblox lua local Players = game:GetService("Players"); local HttpService = game:GetService("HttpService"); local LocalPlayer = Players.LocalPlayer; local RequestFunctiom = request; local function MakeRequest(Prompt) local success, response = pcall(function() return RequestFunctiom({ Url = "https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=KEY_HERE", Method = "POST", Headers = { ["Content-Type"] = "application/json", }, Body = HttpService:JSONEncode({ prompt = { text = Prompt }, temperature = 0.7, candidateCount = 1, topP = 0.95, topK = 5, maxOutputTokens = 100, stopSequences = {"Human:", "Ai:"}, }) }) end) print(response) return response end print("MakeRequest sending") print("test1") local HttpRequest = MakeRequest("Human: Hello how are you today \n\nAI:"); --wait(3) -- if this added the local Response will errored the error is "attempt to index nil with the Body" local Response = ". " .. string.sub(HttpService:JSONDecode(HttpRequest["Body"]).candidates[1].output, 2); print(Response)
answers question: http://stackoverflow.com/q/77551269

multidimensional-array
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/77427482
type: Tag

http://stackoverflow.com/a/77551374
has comment: http://stackoverflow.com/comment/136719506
has comment: http://stackoverflow.com/comment/136719503
has body: I'm not sure what language that is but the proper JSon body for the request should be something like this You defiantly have prompt and stop_sequences wrong. { "prompt": "Write a poem about an adventure in an underwater castle\n\n", "model_name": "models/text-bison-001", "temperature": 0.7, "candidate_count": 1, "top_k": 40, "top_p": 0.95, "max_output_tokens": 1024, "stop_sequences": [] } candidate_count you have candidate_count set to three which means that HttpService:JSONDecode(response.Body).candidates is an array. It may be failing on that
score: 0
has comment: http://stackoverflow.com/comment/136719544
has comment: http://stackoverflow.com/comment/136719512
has comment: http://stackoverflow.com/comment/136719539
has comment: http://stackoverflow.com/comment/136723085
type: Answer
has comment: http://stackoverflow.com/comment/136723098
has comment: http://stackoverflow.com/comment/136723087
has comment: http://stackoverflow.com/comment/136723094
answers question: http://stackoverflow.com/q/77551269

http://stackoverflow.com/comment/136723098
type: Comment
has text: candidateCount set to 1
comment on: http://stackoverflow.com/a/77551374
type: AnswerComment
score: 0

http://stackoverflow.com/a/77616174
score: 0
answers question: http://stackoverflow.com/q/77595211
has comment: http://stackoverflow.com/comment/136833058
type: Answer
has body: 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. First off, the main thing you need to work on is how to join two tables toghether. I would do this by writing for i=1,#table2,1 do table1[#table1+1]=table2[i] end assuming your tables are 1-indexed. This will go through table2 and add each item to the end of table1. Use another for-loop to do this vertically. 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. 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. I would personally use a "pointer" to indicate the top line of the currently-modified matrix.

http://stackoverflow.com/q/77549930
tagged with: lua
downvote count: 0
has answer: http://stackoverflow.com/a/77549998
score: 1
has title: Lua formatting returns unexpected results
tagged with: string-formatting
answer count: 1
tagged with: string
accepted answer: http://stackoverflow.com/a/77549998
favorite count: 0
tagged with: formatting
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136717177
type: Question
has body: 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 local minutes, hours = 60, 3600 local s = 5400 -- output is 2h30m when it should be 1h30m if s >= hours then print(string.format("%.0fh%.0fm", s / hours, (s % hours) / minutes)) end -- output is 45m0s when it should be 45m if s >= minutes then print(string.format("%.0fm%.0fs", s / minutes, s % minutes)) end Even though the amount of seconds (s) is 5400 which is 1 hour and 30 minutes, the first if-statement will ouput 2h30m which is one hour more, whereas the second if-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!
upvote count: 1

http://stackoverflow.com/comment/136611705
has text: No, is not anchored, I checked the model and the only thing that is anchored is the humanoid that the anchor cannot be removed.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77477233

http://stackoverflow.com/q/77556950
answer count: 1
type: UnansweredQuestion
tagged with: logitech
score: 0
has body: 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 local counter = 0 function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then counter = counter+1 if counter % 2 == 1 then clickingEnabled = true else clickingEnabled = false end end while clickingEnabled and IsMouseButtonPressed(1) do PressMouseButton(1) Sleep(10) ReleaseMouseButton(1) Sleep(10) end end
tagged with: lua
has title: logitech ghub autoclicker lua fix
type: Question
has answer: http://stackoverflow.com/a/77557454

http://stackoverflow.com/comment/136789614
score: 0
has text: 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```
type: QuestionComment
comment on: http://stackoverflow.com/q/77566514
type: Comment

minetest
type: Tag
tags question: http://stackoverflow.com/q/77547671
tag name: minetest

concatenation
type: Tag
tag name: concatenation
tags question: http://stackoverflow.com/q/77595211

http://stackoverflow.com/comment/136689327
type: Comment
has text: 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.
type: AnswerComment
comment on: http://stackoverflow.com/a/77534466
score: 0

http://stackoverflow.com/comment/136724353
has text: я так и сделал , после этого он выстреливает один и ведет мышь вниз это окей. Но мне надо чтобы он постоянно кликал по левай кнопкой мышы и вел вниз
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77472849
type: Comment

http://stackoverflow.com/q/77581354
tagged with: tween
has body: I'm making a cigarette in Roblox and I want it to work correctly it made the cig resize to the front. you can get it yourself here: https://filetransfer.io/data-package/qKBHvHxS#link and for people who want the code all you really need to see is this: for i = bit.Size.X, 0, -0.1 do local tweenInfo = TweenInfo.new(0.1) local goal = {} goal.Size = Vector3.new(i, bit.Size.Y, bit.Size.Z) local tween = TweenService:Create(bit, tweenInfo, goal) tween:Play() wait(0.1) bit.CFrame = bit.CFrame + bit.CFrame.LookVector * -0.1 end But seriously, I do recommend downloading the RBXM file and actually testing it. Also its a tool, so this accounts for rotations.
has answer: http://stackoverflow.com/a/77586167
has title: How to resize a cylinder from one end and move it backwards in Roblox
has comment: http://stackoverflow.com/comment/136777411
tagged with: 3d
tagged with: roblox
answer count: 1
tagged with: lua
type: AnsweredQuestion
tagged with: physics
score: 0
has comment: http://stackoverflow.com/comment/136780637
type: Question
accepted answer: http://stackoverflow.com/a/77586167

addeventlistener
tags question: http://stackoverflow.com/q/77439054
type: Tag
tag name: addeventlistener

http://stackoverflow.com/comment/137178169
type: AnswerComment
comment on: http://stackoverflow.com/a/77477155
type: Comment
has text: I just edited my answer. Try running the code.
score: 0

http://stackoverflow.com/comment/136500222
comment on: http://stackoverflow.com/q/77426782
type: Comment
type: QuestionComment
score: 0
has text: If you are not allowed to index a string then the critical feature is missed.

http://stackoverflow.com/q/77455606
has body: I printed a value using print(v) and got 7:0. I can't find any reference to a representation format with a colon-zero at the end. (or with a colon-number) 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? lua -v -e 'a="2" ; b=1 ; c=a*b ; print( c, type(c), tostring(c) ) ;' Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio 2:0 number 2:0 This is QLua 5.3.5 under Android. Lua 5.4.2 under Windows (lua-5.4.2_Win32_bin.zip, probably from SourceForge) does not do this: It just prints "2".
has comment: http://stackoverflow.com/comment/136551334
has comment: http://stackoverflow.com/comment/136554169
has comment: http://stackoverflow.com/comment/136552080
answer count: 1
has comment: http://stackoverflow.com/comment/136554143
has comment: http://stackoverflow.com/comment/136550918
has comment: http://stackoverflow.com/comment/136550174
has comment: http://stackoverflow.com/comment/136553141
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77457935
score: 0
type: Question
tagged with: tostring
has comment: http://stackoverflow.com/comment/136552150
has title: What is "n:0" as a number representation?
tagged with: lua
has answer: http://stackoverflow.com/a/77457935
has comment: http://stackoverflow.com/comment/136552100
has comment: http://stackoverflow.com/comment/136553091
has comment: http://stackoverflow.com/comment/136552129
has comment: http://stackoverflow.com/comment/136551310

http://stackoverflow.com/a/77575033
upvote count: 4
downvote count: 0
score: 4
has body: It seems like nvim-dap is trying to call the field config, but it's not defined. Worked for me to just add an empty function for this config field. { "mfussenegger/nvim-dap", config = function() end, },
answers question: http://stackoverflow.com/q/77495184
type: Answer

http://stackoverflow.com/comment/136681074
comment on: http://stackoverflow.com/q/77527042
type: QuestionComment
has text: 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.
type: Comment
score: 0

http://stackoverflow.com/comment/136689372
comment on: http://stackoverflow.com/a/77534466
has text: cjson.encode do the same thing as json.Marshal. decode-> modify -> encode -> save, yes this is what i do, but failed to get the inviteInfo['routeVersion'] after decode
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/136764583
comment on: http://stackoverflow.com/a/77537699
type: Comment
has text: 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
score: 0
type: AnswerComment

http://stackoverflow.com/comment/136791139
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77584516
has text: 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.
type: Comment

http://stackoverflow.com/comment/136624809
type: QuestionComment
comment on: http://stackoverflow.com/q/77497940
score: 1
has text: 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. Please 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!
type: Comment

http://stackoverflow.com/comment/136723315
has text: @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")
comment on: http://stackoverflow.com/a/77545233
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/136682957
type: Comment
has text: this is how everything works only through button 4
comment on: http://stackoverflow.com/a/77472849
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137117971
score: 0
type: AnswerComment
has text: Can you explain what you mean? (Also sorry for answering so late I didn't have acces to my account)
type: Comment
comment on: http://stackoverflow.com/a/77477155

http://stackoverflow.com/q/77477233
answer count: 0
has title: The Humanoid does not move
score: 0
tagged with: methods
type: Question
type: UnansweredQuestion
tagged with: roblox
has comment: http://stackoverflow.com/comment/136611705
has comment: http://stackoverflow.com/comment/136607259
has body: So I have this dummy on Roblox Studio welded to a P90 model (a gun). I need this dummy to move, but when I call :MoveTo to the humanoid of this dummy it just does not move Any help is appreciated, Thank You! Code: local RS = game:GetService("ReplicatedStorage") local npcSettings = require(RS.Settings) local npcVariables = require(RS.Variables) local NPC = workspace:FindFirstChild("NPC Gun System") local NPCRootPart = npcVariables.NPCRootPart local NPCTorso = npcVariables.NPCTorso local NPCHumanoid = npcVariables.NPCHumanoid local Players = game:GetService("Players") local npcProperties = { agroDistance = 100, fireRate = 0.1, bulletDamage = 15, bulletSpeed = 100, bulletMag = 50 } game.Players.PlayerAdded:Connect(function(plr) local char = plr.Character or plr.CharacterAdded:Wait() local hum = char:FindFirstChild("Humanoid") local torso = char:FindFirstChild("Torso") local humRootPart = char:FindFirstChild("HumanoidRootPart") local function chaseTarget() NPCHumanoid:MoveTo(humRootPart.Position) end local function Reload() npcSettings.Guns.P90.Sounds.ReloadSound:Play() --Put an animation here if you wish! end local function fireP90() if hum.Health == 0 then return end local newBullet = npcSettings.Guns.P90.BulletTrail:Clone() newBullet.Parent = workspace newBullet.CFrame = npcSettings.Guns.P90.Model.FirePart.CFrame * CFrame.new(0, 0, -1) newBullet.CFrame = newBullet.CFrame * CFrame.Angles(0, math.rad(90), 0) local Att0 = Instance.new("Attachment") Att0.Parent = newBullet local LinearVelocity = Instance.new("LinearVelocity") LinearVelocity.Parent = newBullet LinearVelocity.MaxForce = math.huge LinearVelocity.Attachment0 = Att0 LinearVelocity.VectorVelocity = npcSettings.Guns.P90.Model.FirePart.CFrame.LookVector * npcProperties.bulletSpeed game.Debris:AddItem(newBullet, 3) newBullet.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("HumanoidRootPart") then hum:TakeDamage(npcProperties.bulletDamage) newBullet:Destroy() end end) npcSettings.Guns.P90.Sounds.GunShot…
tagged with: lua

http://stackoverflow.com/q/77507409
tagged with: unluac
has comment: http://stackoverflow.com/comment/136641412
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/136645867
tagged with: lua
score: 0
has comment: http://stackoverflow.com/comment/136641521
tagged with: decompiling
type: UnansweredQuestion
has title: Garbled characters encountered when decompiling Lua
has comment: http://stackoverflow.com/comment/136645366
has body: The lua file was from an apk using luajava and andlua, lua version seems to be 5.3.3 After I used unluac to decompile and obtain the lua file, I found that all the strings became garbled characters. local L0_0, L1_1, L2_2, L3_3, L4_4, L5_5, L6_6, L7_7 L0_0 = _ENV L1_1 = L0_0["]$"] L2_2 = L0_0["u\229\136\006\133\020\186"] L3_3 = "u\v\138\027\133\002" L2_2 = L2_2(L3_3) L3_3 = L0_0["u\229\136\006\133\020\186"] L4_4 = "i\020\1460" L3_3 = L3_3(L4_4) L4_4 = L0_0["u\229\136\006\133\020\186"] L5_5 = "x\230k\237`\247,\227\145\015\158" L4_4 = L4_4(L5_5) L5_5 = L4_4 function L6_6(A0_8, A1_9, A2_10, A3_11) local L4_12 L4_12 = L0_0 return L4_4["d\030\181(\213x\241"](A0_8, A1_9, A2_10, A3_11, "m\031\1878") end L5_5["k\028\176$\208B\248\195"] = L6_6 function L6_6(A0_13, A1_14, A2_15, A3_16) local L4_17 L4_17 = L0_0 return L4_4["d\030\181(\213x\241"](A0_13, A1_14, A2_15, A3_16, "l\029\132$\136") end L5_5["k\028\176$\208B\248\193"] = L6_6 function L6_6(A0_18, A1_19, A2_20) local L3_21, L4_22, L5_23, L6_24, L7_25 L3_21 = L0_0 if A0_18 == "+" then A0_18 = "7\016E\130\2115b" end L4_22 = L4_4["g\004\162"] L4_22 = L4_22["l\024\155\003\176#\203E\240w\236"] L5_23 = A0_18 L5_23 = L4_22(L5_23) if not L4_22 then L6_24 = nil L7_25 = L5_23 return L6_24, L7_25 end L6_24, L7_25 = nil, nil L5_23 = "|\2533\250z\242z\181y\2487\246|\252k\252i\233" for _FORV_11_, _FORV_12_ in L1_1["o\005\133=\177@"](L4_22) do if _FORV_12_["`\019\179\"\219]"] == "m\031\1878" then L6_24, L5_23 = L4_4["p\031\132Y"]() else L6_24, L5_23 = L4_4["p\031\132["]() end if not L6_24 then return nil, L5_23 end L6_24["z\224v\017\138\003\154\031\130"](L6_24, "{\225u\b\147\019\137\r\150", true) L7_25, L5_23 = L6_24["f\003\190S"](L6_24, _FORV_12_["e\r\170F"], A1_19) if not L7_25 then L6_24["f\001\186M\195"](L6_24) else L7_25, L5_23 = L6_24["j\017\153)\170,"](L6_24, A2_20) if not L7_25 then L6_24["f\001\186M\195"](L6_24) else return L6_24 end end end return nil, L5_23 end I tried hard to find the original file of one of the lua files o…

http://stackoverflow.com/comment/136523680
has text: Thanks for reply. Awesome. Now it works. I really appreciate it. At the moment I didn't realise that inserting `function () thing:do_something() end` is possible. Now I only need to tweak some things and hopefuly the code will work.
comment on: http://stackoverflow.com/a/77438825
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/77549655
tagged with: lua
score: 2
favorite count: 0
upvote count: 2
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/77549866
accepted answer: http://stackoverflow.com/a/77549866
tagged with: code-structure
type: Question
has body: 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? Exhibit A (pseudocode): backwards(code(reading(like(not(do(I)))))) Exhibit B (pseudocode): local all = foo(...) local this = bar(all) local variables = baz(this) local obscure_a_simple_idea = quux(variables) In F# this code (source) let numbers = [0..100] let evenNumbers = List.filter isEven numbers let doubledNumbers = List.map double evenNumbers List.iter printNumber doubledNumbers can be rewritten like this: [0..100] |&gt; List.filter isEven |&gt; List.map double |&gt; List.iter printNumber In clojure this code (source) (defn calculate [] (reduce + (map #(* % %) (filter odd? (range 10))))) Can be written like this (defn calculate* [] (-&gt;&gt; (range 10) (filter odd? ,,,) (map #(* % %) ,,,) (reduce + ,,,))) I am aware that fennel has threading macros. 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?
downvote count: 0
tagged with: functional-programming
has title: How to thread, pipe or compose functions in lua?

http://stackoverflow.com/comment/136717591
score: 0
comment on: http://stackoverflow.com/a/77546708
has text: 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.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/136701213
comment on: http://stackoverflow.com/a/77537699
type: Comment
has text: Thanks Mike this helps a lot, but in our edge we can't use function or os library, so we're still stuck :(
score: 0
type: AnswerComment

http://stackoverflow.com/a/79232720
type: Answer
downvote count: 0
has body: In my case, I solve this issue by installing dap.core plugin. In Lazyvim GUI, press x, move cursor down to dap.core and press x again. Restart Nvim to take the effect.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/77495184

http://stackoverflow.com/comment/136708461
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77544656
has text: Can you please provide a minimal example of how you call these functions from C++ which results in this error?
type: Comment

http://stackoverflow.com/comment/136664349
type: Comment
has text: 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).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77520256

palm-api
type: Tag
tag name: palm-api
tags question: http://stackoverflow.com/q/77551269

http://stackoverflow.com/a/77441327
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/77437533
has body: wilder.nvim 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.
downvote count: 0
score: 1

http://stackoverflow.com/comment/136516939
score: 0
type: AnswerComment
has text: Cool! Searching '/test' works for me. And at last I use `universal ctags` in my macOS to resolve this problem, ty!
type: Comment
comment on: http://stackoverflow.com/a/77432563

http://stackoverflow.com/comment/136841797
comment on: http://stackoverflow.com/a/77607636
type: AnswerComment
has text: 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.
score: 0
type: Comment

http://stackoverflow.com/comment/136711516
has text: just do: script.Parent.Triggered:Connect(function(player) money = _G.publicPlayerSession.Money level = _G.publicPlayerSession.Level print(money) print(level)
type: AnswerComment
comment on: http://stackoverflow.com/a/77541899
score: 0
type: Comment

http://stackoverflow.com/q/77438652
has answer: http://stackoverflow.com/a/77438825
has body: I'm experimenting with Lua OOP (Object Oriented Programming) but I'm experiencing some issues. Here is a sample code with comments: Object = {string = "Default"} function Object:new() local o = {} setmetatable(o, {__index = self}) -- o.string = "Default" return o end function Object:SayHi(input) if input == nil then input = "" else local temp = input input = " " .. temp end print("Hi!" .. input) end function Object:CallHiFunct() local temp = "Called from CallHiFunct" self:SayHi(temp) end function Object:PrintString() print(self.string) -- Variable named string from Object end object1 = Object:new() -- Returns new metatable to object1 object1:SayHi() -- Prints Hi! object1:CallHiFunct() -- Prints Hi! Called from CallHiFunct object1:PrintString() -- Prints Default print() print() funct_object1 = object1.SayHi funct_object1() -- Prints Hi! funct2_object1 = object1.PrintString funct2_object1() -- Error: attempt to index a nil value (local 'self') funct2_object1 = object1:PrintString() -- if object1:PrintString Error: function arguments expected near 'funct2_object1' funct2_object1() -- Error: attempt to call a nil value (global 'funct2_object1') I'm trying to save a function from an object/table but I'm having problems with self being nil. How can I properly do this to keep the function with the object? . The reason why I'm doing this is because I'm using a function specified in a library which accepts function as an argument. I think something like this: function Example(funct) funct() -- calls it here end To be exact the function is actually: GUI:AddButton(arguments...):AddEventHandler(event, funct) (event: when it is activated, funct: to call when activated) but I'm not exactly sure what is inside. Anyway. Ignoring this library is it possible to save a function from an "object" to variable to be called from this variable? (I was unable to find any answer. I it already has been asked then link the question with the answers please.) Thanks.
answer count: 1
tagged with: object
tagged with: function
type: AnsweredQuestion
has title: How to save a function of an Object/table to a variable to be called from this variable in Lua?
score: 0
accepted answer: http://stackoverflow.com/a/77438825
type: Question
tagged with: lua
tagged with: lua-table

http://stackoverflow.com/comment/136698454
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/77539566
has text: Why don't you just benchmark your ideas? I would expect the `match` to be fastest.

http://stackoverflow.com/a/77545233
has comment: http://stackoverflow.com/comment/136736817
type: Answer
has comment: http://stackoverflow.com/comment/136707814
downvote count: 0
has comment: http://stackoverflow.com/comment/136728799
score: 1
has body: In Lua, an environment is an internal property of a function. So, replace file_chunk[index] = loadfile(ScriptLocation) _ENV = file_env[index] with file_chunk[index] = loadfile(ScriptLocation, "t", file_env[index]) to embed environment into a function on its creation. You will be unable to set this function's environment later.
answers question: http://stackoverflow.com/q/77544656
has comment: http://stackoverflow.com/comment/136708030
upvote count: 1
has comment: http://stackoverflow.com/comment/136723315

http://stackoverflow.com/comment/136717177
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77549930
score: 3
has text: Why you dont use ```os.date()``` for this? Like: ```print(os.date("!%Hh %Mm %Ss", 5400))``` (printing: ```01h 30m 00s```)

prompt
type: Tag
tag name: prompt
tags question: http://stackoverflow.com/q/77594510

http://stackoverflow.com/q/77504584
score: 0
linked to: http://stackoverflow.com/q/71286208
type: Question
has title: pandoc md -> latex write lua-filter to change latex-macro used for caption
tagged with: caption
tagged with: lua
accepted answer: http://stackoverflow.com/a/77705959
has answer: http://stackoverflow.com/a/77607636
possible better answer: http://stackoverflow.com/a/77607636
has body: I have written a custom latex .cls 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 pandoc to LaTeX. I already have an elaborated pandoc template to produce the LaTeX preambel etc. So far its working great. But for the figures I need the caption from the Markdown file to be set with \sidecaption instead of \caption in LaTeX, as well as with an optional argument (short-caption) for the image attribution in the list of figures. To get the latter working I use the following template from a GitHub discussion in the pandoc repo: PANDOC_VERSION:must_be_at_least '3.1' if FORMAT:match 'latex' then function Figure(f) local short = f.content[1].content[1].attributes['short-caption'] if short and not f.caption.short then f.caption.short = pandoc.Inlines(short) end return f end end That works without any flaws. But now I need to figure out how to change the LaTeX macro used for the caption. The older approach of pre pandoc version 3.0 posted by @tarleb is really intuitive and I could have easily adapted it to my needs. But since pandoc 3.0 there is the new complex figures approach and, so far, I couldn't figure out how to change the LaTeX macro used for the captions with this new behaviour. I tried something like that (Adapted from here: if FORMAT:match 'latex' then function RawBlock (raw) local caption = raw.text:match('\\caption') if caption then raw:gsub('\\caption', '\\sidecaption') end return raw end end But nothing happened. 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 awk or sed to edit the .tex file itself using a regex-substitution, but that should remain an absolute stopgap, since it makes the whole workflow less portable. 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…
tagged with: filter
has answer: http://stackoverflow.com/a/77705959
answer count: 2
type: AnsweredQuestion
tagged with: pandoc

http://stackoverflow.com/a/77541600
has body: As TAEFFED told me to do in the comments + chat, I deleted my ~/.local/share/nvim directory. I then went and relaunched nvim and Lazy loaded just as expected. Thank you sir!
score: 3
type: Answer
answers question: http://stackoverflow.com/q/77539961
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/77557454
score: 1
has comment: http://stackoverflow.com/comment/136730470
downvote count: 0
answers question: http://stackoverflow.com/q/77556950
type: Answer
has body: In the game, in the "Controls Settings", introduce alternative key for "Shoot" action. For example, let it be keyboard key P. So, now in the game you can shoot either using Left Mouse Button or using Keyboard key P. Of course, you will use LMB for manual shooting as usually, but your GHub script will use P. Make sure: you can shoot with Left Mouse Button (as usual); you can shoot with key P; you can shoot with key P while Left Mouse Button is pressed; Set the script: local is_active function OnEvent(event, arg) if event == "PROFILE_ACTIVATED" then EnablePrimaryMouseButtonEvents(true) elseif event == "MOUSE_BUTTON_PRESSED" and arg == 4 then is_active = not is_active elseif is_active and event == "MOUSE_BUTTON_PRESSED" and arg == 1 then while PressKey("P") Sleep(10) ReleaseKey("P") Sleep(10) until not IsMouseButtonPressed(1) end end Method #2 If your game lacks ability to set an alternative key. Make sure mouse button 5 is ignored by the game. The game must do nothing when you press it while playing. In GHub, assign "Left click" action to some mouse button you usually never use. For example, button #8. This 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). Set the script. local is_active function OnEvent(event, arg) if event == "PROFILE_ACTIVATED" then EnablePrimaryMouseButtonEvents(true) elseif event == "MOUSE_BUTTON_PRESSED" and arg == 4 then is_active = not is_active elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 then PressMouseButton(1) if is_active then repeat Sleep(10) ReleaseMouseButton(1) Sleep(10) PressMouseButton(1) until not IsMouseButtonPressed(5) end elseif event == "MOUSE_BUTTON_RELEASED" and arg == 1 then ReleaseMouseButton(1) elseif event == "PROFILE_DEACTIVATED" then ReleaseMouseButton(1) end end In GHub, assign "Forward" action to physical LMB. ("Forward" is the default action for mouse button 5). Probably GHub will ask you "are you sure", say "yes".
upvote count: 1

http://stackoverflow.com/a/77606567
answers question: http://stackoverflow.com/q/77587456
score: 0
type: Answer
has body: You are trying to get the guild by using client.guild but guild does not exist on client. Looking at your code, I assume that data is the received interaction. To create a channel using this interaction object you can do the following: data.guild.channels.create("││" + data.user.username, { type: "GUILD_TEXT", // syntax has changed a bit parent: "1157076981159034880", permissionOverwrites: [ { id: role.id, allow: [Permissions.FLAGS.VIEW_CHANNEL], }, { id: data.id, allow: [Permissions.FLAGS.VIEW_CHANNEL], }, { id: client.guild.roles.everyone, //To make it be seen by a certain role, user an ID instead //allow: ['VIEW_CHANNEL', 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], //Allow permissions deny: ['VIEW_CHANNEL'] //Deny permissions , 'SEND_MESSAGES', 'READ_MESSAGE_HISTORY' }, ], }); I hope this answers your question

http://stackoverflow.com/q/77422104
tagged with: environment
tagged with: c++
has body: 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 I tried using lua_State* m_state from sol3 to another environment but it didn't help
has title: How to get the functionality of one lua environment from another
score: 0
type: Question
has comment: http://stackoverflow.com/comment/136492258
answer count: 0
has comment: http://stackoverflow.com/comment/136495806
tagged with: lua
type: UnansweredQuestion

http://stackoverflow.com/comment/136841810
comment on: http://stackoverflow.com/a/77607636
score: 0
type: Comment
type: AnswerComment
has text: 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!

http://stackoverflow.com/a/77472849
answers question: http://stackoverflow.com/q/77472284
has comment: http://stackoverflow.com/comment/136728060
has comment: http://stackoverflow.com/comment/136684902
has comment: http://stackoverflow.com/comment/136682957
has comment: http://stackoverflow.com/comment/136682938
has comment: http://stackoverflow.com/comment/136682998
has comment: http://stackoverflow.com/comment/136683518
has comment: http://stackoverflow.com/comment/136724353
has comment: http://stackoverflow.com/comment/136682846
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/136683521
has body: In the game, in the "Controls Settings", introduce alternative key for "Shoot" action. For example, let it be keyboard key P. So, now in the game you can shoot either using Left Mouse Button or using Keyboard key P. Of course, you will use LMB for manual shooting as usually, but your GHub script will use P. The script EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then repeat MoveMouseRelative(0,10) Sleep(15) PressAndReleaseKey("P") -- instead of PressAndReleaseMouseButton(1) Sleep(15) until not IsMouseButtonPressed(1) end end

3d
type: Tag
tags question: http://stackoverflow.com/q/77581354
tag name: 3d
tags question: http://stackoverflow.com/q/79084408

http://stackoverflow.com/comment/136528481
comment on: http://stackoverflow.com/a/77443353
type: Comment
score: 0
has text: after adding the () and setting `arg[1] = "file1"`, im still getting arg[1] is a nil value when using jukebox.lua
type: AnswerComment

http://stackoverflow.com/q/77462458
score: 0
type: Question
has title: Why am I able to adjust "vertical_speed" with all mouse buttons instead of only button "9"?
answer count: 0
has comment: http://stackoverflow.com/comment/136562805
has comment: http://stackoverflow.com/comment/136563205
tagged with: lua
type: UnansweredQuestion
has body: local vertical_speed = 1 function OnEvent(event,arg) if IsKeyLockOn("scrolllock") then EnablePrimaryMouseButtonEvents (true) if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsMouseButtonPressed(3) then local frac, x, y = 0, 2 repeat Sleep(10) x, y, frac = -x, math.modf(frac + vertical_speed) MoveMouseRelative(x * 2, y) until x > 0 and not IsMouseButtonPressed(1) end if event == "MOUSE_BUTTON_PRESSED" and arg == 9 then elseif IsModifierPressed("lshift") then vertical_speed = vertical_speed + 1 elseif IsModifierPressed("lalt") then vertical_speed = 1 end end end I want to be able to increase vertical_speed up with button "9" while holding "shift", and reset while holding "alt". The script works except it's adjustable with all mouse buttons instead of only button "9". I'm rather new to Lua, and I'm sure it's something very obvious that I can't see.

http://stackoverflow.com/comment/136689282
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77534466
has text: is it go instead of lua, right? yes, 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.
type: Comment

http://stackoverflow.com/comment/136732471
comment on: http://stackoverflow.com/q/77553609
has text: 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 ` ` rather than Lua).
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136803599
type: Comment
score: 1
has text: 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".
type: QuestionComment
comment on: http://stackoverflow.com/q/77595211

apache-apisix
tags question: http://stackoverflow.com/q/77584516
type: Tag
tag name: apache-apisix
tags question: http://stackoverflow.com/q/79378695

http://stackoverflow.com/comment/136772540
comment on: http://stackoverflow.com/q/77582051
type: Comment
has text: 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.
score: 4
type: QuestionComment

http://stackoverflow.com/a/77536011
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77511329
has body: The issue is that you are changing the text in the StarterGUI. 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. 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: local function updateText(text) for i, plr in game:GetService(“Players”):GetPlayers() do plr.PlayerGui.BtnLbl.RealObjective.Text = text end end

http://stackoverflow.com/comment/136691028
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77429315
has text: @Friedrich yea, after I switched to Universal Ctags, it worked as expected.

http://stackoverflow.com/a/77452444
has comment: http://stackoverflow.com/comment/136613903
has body: Even if the script is a localscript or serverscript, your code won't work. Alternatively, you can add a BoolValue in StarterCharacterScripts.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77442333

http://stackoverflow.com/comment/138008054
type: AnswerComment
comment on: http://stackoverflow.com/a/78273917
type: Comment
score: 0
has text: 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)

http://stackoverflow.com/a/77477155
has comment: http://stackoverflow.com/comment/136605232
score: 0
accepted answer of: http://stackoverflow.com/q/77473680
answers question: http://stackoverflow.com/q/77473680
has comment: http://stackoverflow.com/comment/136647653
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/136733807
has comment: http://stackoverflow.com/comment/137178169
has body: You have to use the MoveTo function on the agent humanoid not on the path variable. E.g Agent:MoveTo(Position) Edit: Instead of passing passing the path instance you have to loop through the points by calling the GetWayPoints() method on the path instance. local PathFindingService = game:GetService("PathfindingService") local Agent = script.Parent AgentRadius = 2 -- Settings Agent AgentHeight = 5 AgentCanJump = false AgentCanClimb = false AgentSlope = 10 AgentMaxAcceleration = 1000 AgentMaxSpeed = 16 AgentArrivalDistance = 1 -- end settings agent print(type(PathFindingService)) while true do if Agent~= nil then local destination= Vector3.new(math.random(-40,40), -8, math.random(-40, 40)) print(true) local path = PathFindingService:CreatePath() local waypoints = path:ComputeAsync(Agent.HumanoidRootPart.Position,destination) if path.Status == Enum.PathStatus.Success then local waypoints = path:GetWaypoints() for _, waypoint in pairs(waypoints) do Agent.Humanoid:MoveTo(waypoint.Position) --print(waypoint.Position) end end end wait(5) end
has comment: http://stackoverflow.com/comment/137117971

tween
tag name: tween
type: Tag
tags question: http://stackoverflow.com/q/77581354
tags question: http://stackoverflow.com/q/78885569
tags question: http://stackoverflow.com/q/79171090

http://stackoverflow.com/comment/136683521
type: Comment
has text: автоклик неработает
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77472849

http://stackoverflow.com/q/77539566
score: 0
tagged with: substring
type: Question
has title: lua use gsub or match for end substring deletion?
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/136708695
tagged with: optimization
has body: Let's have a /file/path/name 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? My ideas: gsub('[^/]+$','') gsub('/[^/]+$','/') match('^.+/')
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136698454
has comment: http://stackoverflow.com/comment/136698393

substring
tag name: substring
tags question: http://stackoverflow.com/q/77539566
type: Tag

http://stackoverflow.com/q/77512688
score: 0
has comment: http://stackoverflow.com/comment/136650701
answer count: 1
type: UnansweredQuestion
has title: Leaderboard not working even though i have looked over many posts
has answer: http://stackoverflow.com/a/77544466
tagged with: roblox
has comment: http://stackoverflow.com/comment/136650695
type: Question
has comment: http://stackoverflow.com/comment/136650684
has body: My leaderboard function Onplrjoined(plr) local leaderstats = Instance.new("IntValue") leaderstats.Parent = plr leaderstats.Value = 0 leaderstats.Name = "leaderstats" local stat = Instance.new("IntValue") stat.Name = "Coins" stat.Value = 0 end local players = game:WaitForChild("Players") players.PlayerAdded:Connect(Onplrjoined) but when i join in it does not show anything when i join in it does not show anything
tagged with: lua

http://stackoverflow.com/comment/136725033
score: 0
has text: 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?
comment on: http://stackoverflow.com/q/77551269
type: Comment
type: QuestionComment

http://stackoverflow.com/a/77568002
has body: 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. However, in your case, t[1] is nil, and Redis takes it as an empty array. In order to fix the problem, you need to convert t to an array: -- Your original code generating table `t` -- Then convert `t` to an array. local res = {} for k, v in pairs(t) do res[#res + 1] = v end return res
accepted answer of: http://stackoverflow.com/q/77566514
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/136752003
upvote count: 1
answers question: http://stackoverflow.com/q/77566514
downvote count: 0
score: 1

http://stackoverflow.com/a/77441200
has body: Well you first need to understand code structure. There exist Scripts (for the server), LocalScripts (for the client), and ModuleScripts (to import from either). 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: ReplicatedFirst StarterCharacterScripts (replicated into the player’s character in Workspace) StarterPlayerScripts StarterGui 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) See: https://create.roblox.com/docs/scripting/scripts
answers question: http://stackoverflow.com/q/77440589
score: 0
type: Answer

http://stackoverflow.com/comment/136830236
has text: 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. How 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)
score: 0
comment on: http://stackoverflow.com/a/77594025
type: AnswerComment
type: Comment

http://stackoverflow.com/a/77595268
type: Answer
downvote count: 0
has body: So first, make sure your Proximity Prompt is inside a part, if it isn't inisde a part, here is how to create one : 1 - Press CTRL + I 2 - Select "Part" Now select your part in the explorer. When you put your mouse pointer on it, a "+" button should appear. Click on it then search for "ProximityPrompt" and click on it. Once this is done, select your proximty prompt, and put your mouse pointer on it, then press the "+" button. Search for "Script" (NOT local script) and click on it. It should now open the script, if it don't, double click on the script you created. Now you can make a script like this to delete a model : script.Parent.Triggered:Connect(function(player) if game.Workspace:FindFirstChild("MyModel") then -- Change MyModel to the model / part name game.Workspace.MyModel:Destroy() -- Change MyModel to the model / part name you want to destroy print("Destroyed the model") elseif not game.Workspace:FindFirstChild("MyModel") then print("Couldn't find the model to destroy.") end end) If you want to make the model transparent, you can use this script : script.Parent.Triggered:Connect(function(player) if game.Workspace:FindFirstChild("MyModel") then -- Change MyModel to the model / part name for i, part in pairs(game.Workspace:FindFirstChild("MyModel"):GetDescendants()) do if part.ClassName == "Part" then part.Transparency = 1 print("Made a model part transparent") end end elseif not game.Workspace:FindFirstChild("MyModel") then print("Couldn't find the model to make transparent.") end end) I hope this help !
answers question: http://stackoverflow.com/q/77594510
upvote count: 1
score: 1

http://stackoverflow.com/comment/136501617
has text: I'm limited to using Lua 5.1 as the code is for a game, and they currently use that. As 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. I will give that a try.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77427604

http://stackoverflow.com/comment/136640687
type: QuestionComment
comment on: http://stackoverflow.com/q/77505557
type: Comment
has text: @shingo I didn't know you could do that. I probably can, yes. Thanks.
score: 0

http://stackoverflow.com/comment/136699049
comment on: http://stackoverflow.com/q/77539961
type: Comment
score: 0
type: QuestionComment
has text: @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?

code-structure
type: Tag
tags question: http://stackoverflow.com/q/77549655
tag name: code-structure

http://stackoverflow.com/comment/136699039
score: 0
has text: 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
type: Comment
comment on: http://stackoverflow.com/q/77539961
type: QuestionComment

http://stackoverflow.com/a/77520385
type: Answer
downvote count: 0
upvote count: 1
answers question: http://stackoverflow.com/q/77518115
score: 1
has body: The mistake: IsMouseButtonPressed(8) is incorrect: this function accepts only 1-5. How to fix: You should open GHub application and assign action "Back" to physical button 8. After that edit your script and use IsMouseButtonPressed(4) instead of 8. Explanation: mouse button 4 is "Backward" button, its default action is "Back", so this way button 8 acts as if it were button 4. Of course, your game should ignore button 4 press/release (check your game controls settings to be sure of it).

http://stackoverflow.com/a/77427604
upvote count: 3
answers question: http://stackoverflow.com/q/77427482
score: 3
downvote count: 0
has body: Currently there is nothing to sort, as you have associative-array type tables, which will always have arbitrarily ordered keys and values. You can only sort array-like tables (those with numerical indices). 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., < or >). Note that table.sort is not stable. local data = { ["C1_RN1::F1"] = { ["class"] = "Warrior", ["name"] = "C1", ["faction"] = "Faction", ["race"] = "Human", ["realm"] = "RN1", }, ["C2_RN1::F1"] = { ["class"] = "Priest", ["name"] = "C2", ["faction"] = "Faction", ["race"] = "Undead", ["realm"] = "RN1", }, ["C3_RN1::F1"] = { ["class"] = "Hunter", ["name"] = "C3", ["faction"] = "Faction", ["race"] = "Human", ["realm"] = "RN1", } } local collapsed = {} for key, value in pairs(data) do table.insert(collapsed, value) end table.sort(collapsed, function (a, b) if a.race == b.race then return a.class < b.class end return a.race < b.race end) for _, character in ipairs(collapsed) do print(character.name, character.race, character.class) end C3 Human Hunter C1 Human Warrior C2 Undead Priest If you have a lot of keys to compare, you can loop through them. table.sort(collapsed, function (a, b) local order = { 'race', 'class', 'realm' } for _, key in ipairs(order) do if a[key] ~= b[key] then return a[key] < b[key] end end end)
has comment: http://stackoverflow.com/comment/136501617
type: Answer

pandoc
tags question: http://stackoverflow.com/q/77504584
tags question: http://stackoverflow.com/q/77550367
tags question: http://stackoverflow.com/q/77508314
tag name: pandoc
type: Tag
tags question: http://stackoverflow.com/q/77648678
tags question: http://stackoverflow.com/q/77951212
tags question: http://stackoverflow.com/q/78056160
tags question: http://stackoverflow.com/q/78058185
tags question: http://stackoverflow.com/q/78063469
tags question: http://stackoverflow.com/q/78481889
tags question: http://stackoverflow.com/q/78531833
tags question: http://stackoverflow.com/q/78522027
tags question: http://stackoverflow.com/q/78563147
tags question: http://stackoverflow.com/q/78575468
tags question: http://stackoverflow.com/q/78495314
tags question: http://stackoverflow.com/q/78552455
tags question: http://stackoverflow.com/q/78567123
tags question: http://stackoverflow.com/q/78563491
tags question: http://stackoverflow.com/q/78744024
tags question: http://stackoverflow.com/q/78704192
tags question: http://stackoverflow.com/q/78616651
tags question: http://stackoverflow.com/q/78899163
tags question: http://stackoverflow.com/q/78874062
tags question: http://stackoverflow.com/q/78898300
tags question: http://stackoverflow.com/q/78858251
tags question: http://stackoverflow.com/q/78929050
tags question: http://stackoverflow.com/q/78941149
tags question: http://stackoverflow.com/q/79175075
tags question: http://stackoverflow.com/q/79137236
tags question: http://stackoverflow.com/q/79151316
tags question: http://stackoverflow.com/q/79190029
tags question: http://stackoverflow.com/q/79105654
tags question: http://stackoverflow.com/q/79140278
tags question: http://stackoverflow.com/q/79508464

http://stackoverflow.com/comment/136726675
score: 0
type: QuestionComment
has text: Thank you! Can you explain how?
comment on: http://stackoverflow.com/q/77553609
type: Comment

http://stackoverflow.com/comment/136707814
has text: 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
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77545233

http://stackoverflow.com/comment/136706057
type: AnswerComment
has text: im new to lua so how could i fix that
score: 0
comment on: http://stackoverflow.com/a/77541899
type: Comment

http://stackoverflow.com/q/77521327
has comment: http://stackoverflow.com/comment/136689920
has body: 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 "Humanoid is not a valid member of ". The tower script to find the closest enemy local Tower = script.Parent local enemies = game.Workspace.enemies local range = 20 local target= nil local Animator = Tower.Humanoid.Animator local Attack = Animator:LoadAnimation(Tower.AttackAnim) function nearestenemy() for i, enemy in ipairs(enemies:GetChildren()) do local distance = (Tower.HumanoidRootPart.Position - enemy.HumanoidRootPart.Position).Magnitude if (distance < range) and (enemy.Humanoid.Health > 0) then target = enemy range = distance end end range = 20 if target then return target.Humanoid else return nil end end while true do local victim = nearestenemy() if victim then victim:TakeDamage(3) end task.wait(.5) end the enemies despawn after 0.6 seconds of dying Please Help! I looked into the forums, nothing worked I made the tower not target dead enemies, no change I Checked if the enemies even had a humanoid, nothing worked (The specific enemy is cloned from an orginal clone enemy with a humanoid)
answer count: 1
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/136676912
has comment: http://stackoverflow.com/comment/136674264
has title: Error: Humanoid is not a valid member of model
tagged with: lua
type: Question
tagged with: roblox
has answer: http://stackoverflow.com/a/77537993

http://stackoverflow.com/comment/136647653
type: Comment
comment on: http://stackoverflow.com/a/77477155
type: AnswerComment
has text: I have done that but now, it says I can't get do "GetWayPoints" on the instance (probably the path),what do I do
score: 0

http://stackoverflow.com/a/77549998
accepted answer of: http://stackoverflow.com/q/77549930
answers question: http://stackoverflow.com/q/77549930
upvote count: 1
score: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: The problem stems from the fact that %.0f does not truncate: It rounds. print(("%.0f"):format(1.5)) prints 2, not 1. This is exactly the case here: You have 1h30m, or 1.5h (the "edge case"). This gets rounded up to two hours by %.0f. What you really want instead is floor division. Simply wrap the division in a math.floor; then you can use %d for integer formatting as well: print(string.format("%dh%dm", math.floor(s / hours), math.floor((s % hours) / minutes))) -- 1h30m as expected The second if suffers from the same issue. You should also use a math.floor there. I'm not sure why you expect the 0s to be omitted, given that there is no code for it. You'd have to implement that using another if.

http://stackoverflow.com/comment/136699032
type: Comment
comment on: http://stackoverflow.com/q/77539961
has text: 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
score: 0
type: QuestionComment

http://stackoverflow.com/a/77674710
answers question: http://stackoverflow.com/q/77582051
downvote count: 0
type: Answer
score: 2
has body: In this line, you are using the assignment operator = instead of equality operator ==: if (x = 0 or x = 128) inbounds = false And in these lines, you are using bit-wise &amp; operator instead of logical and: if (btn(0) &amp; inbounds) x -= 1 if (btn(1) &amp; inbounds) x += 1 Here is a version close to yours that runs correctly: sprite = 8 x = 1 y = 1 timer = 0.25 inbounds = true function _update() -- clear screen cls(1) -- check if player is in the screen if (x == 0 or x == 128) inbounds = false -- get keypresses if (btn(0) and inbounds) x -= 1 if (btn(1) and inbounds) x += 1 -- draw sprite spr(sprite, x, y) end You are clearing the screen and rendering the sprite in the _update function which is (I think) not correct. You should only change state in the _update function, and all graphics code (including cls and spr) should be called in the _draw function. Here is a slight rewrite which has the correct structure, clamping the player's dimensions to a fixed range using the mid function: sprite = 8 x = 64 y = 64 function _update() -- get keypresses if (btn(0)) x -= 1 if (btn(1)) x += 1 if (btn(2)) y -= 1 if (btn(3)) y += 1 -- clamp dimensions (factor in size of sprite) x = mid(0, x, 127-8) y = mid(0, y, 127-8) end function _draw() cls(1) spr(sprite, x, y) end Here's some more info on the mid function: https://pico-8.fandom.com/wiki/Mid
upvote count: 2

http://stackoverflow.com/comment/136682998
type: Comment
comment on: http://stackoverflow.com/a/77472849
score: 0
type: AnswerComment
has text: если я ставлю букву "P" то код вообще не работает , помоги пожалуйста

http://stackoverflow.com/a/77449955
upvote count: 2
has comment: http://stackoverflow.com/comment/136650246
has body: On Debian, you must also install the libhpdf-dev package to get the development files (headers) necessary to compile LuaHPDF (and then link against libhpdf-2.3.0.so). This is a general pattern when compiling from source. 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). You'll either need to compile and link against Lua 5.2, or port the source to Lua 5.4. That said, the only issue I ran into when compiling is that Lua 5.4 dropped the LUA_QS and LUA_QL macros from luaconf.h (present most recently in Lua 5.3 for compatibility). Adding them back near the top of hpdf.c #define LUA_QL(x) "'" x "'" #define LUA_QS LUA_QL("%s") does get this to compile cleanly, though I cannot comment on the stability of the library with this basic patch. For complete transparency, I tested this on Solus, where libHaru is available as libharu and libharu-devel. The process should be the same on Debian, even if the names are different - I just don't have a Debian machine on hand.
has comment: http://stackoverflow.com/comment/136557082
has comment: http://stackoverflow.com/comment/136540570
has comment: http://stackoverflow.com/comment/136561162
accepted answer of: http://stackoverflow.com/q/77449495
answers question: http://stackoverflow.com/q/77449495
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 2

http://stackoverflow.com/a/77551808
score: -1
answers question: http://stackoverflow.com/q/77549895
has body: If you are using Windows, I highly recommend using the WSL on it, which is more suitable to use the terminal-based applications.
downvote count: 2
type: Answer
upvote count: 1

http://stackoverflow.com/comment/136774348
score: 0
type: AnswerComment
has text: 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)?
comment on: http://stackoverflow.com/a/77537699
type: Comment

http://stackoverflow.com/comment/136500185
type: Comment
has text: What Lua version is used in WOW? `print(_VERSION)`
comment on: http://stackoverflow.com/q/77426782
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136719506
type: AnswerComment
has text: still can't figure it out still not working
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77551374

http://stackoverflow.com/comment/136733807
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77477155
has text: @WcThunder remember the p is lower in the `Getwaypoints`
type: Comment

http://stackoverflow.com/a/77441277
type: AcceptedAnswer
type: Answer
upvote count: 1
downvote count: 0
score: 1
has body: 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 ": python3" and obviously failing. Remove the colon and you should be good. https://neovim.io/doc/user/lua.html#vim.cmd()
accepted answer of: http://stackoverflow.com/q/77441092
has comment: http://stackoverflow.com/comment/136525723
answers question: http://stackoverflow.com/q/77441092

http://stackoverflow.com/comment/136501624
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77427482
has text: @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.
type: Comment

http://stackoverflow.com/a/77535093
score: 0
answers question: http://stackoverflow.com/q/77534396
type: Answer
has body: 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.

http://stackoverflow.com/a/77594607
score: 0
type: Answer
has body: model = workspace.Model model:Destroy(Instance.new("ClickDetector",model).MouseClick:Wait())
has comment: http://stackoverflow.com/comment/136822312
answers question: http://stackoverflow.com/q/77594510

http://stackoverflow.com/comment/136775270
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77567066

http://stackoverflow.com/comment/136605232
type: Comment
comment on: http://stackoverflow.com/a/77477155
score: 0
type: AnswerComment
has text: 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)

http://stackoverflow.com/comment/136680555
has text: How do you run the script? Simple `lua execute.lua` (or another filename)? Do you by any chance change `os` at any point?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77527042
score: 0

http://stackoverflow.com/a/77549866
score: 4
accepted answer of: http://stackoverflow.com/q/77549655
answers question: http://stackoverflow.com/q/77549655
upvote count: 4
downvote count: 0
type: AcceptedAnswer
type: Answer
has body: 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.) Let's start with function composition: function compose(f, g) return function(...) return g(f(...)) end end I've flipped f and g here, so f(g(x)) would be equivalent to compose(g, f)(x). Let's write a left fold on a vararg: function foldl(f, acc, ...) if select("#", ...) == 0 then return acc end local l = ... return foldl(f, f(acc, l), select(2, ...)) end Let's also define the identity function: function id(...) return ... end Now let's take care of Exhibit A: function chain(...) return foldl(compose, id, ...) end chain(dont, like, reading, code, backwards)(I) 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: function chaincall(arg, ...) return chain(...)(arg) end Now your Exhibit A becomes chaincall(I, dont, like, reading, code, backwards). Exhibit B is pretty much the same: You can do chain(foo, bar, baz, quux)(...). chaincall won't work with a vararg as first parameter, though: The vararg would be truncated to its first value. Voilà! Essentially we've implemented Clojure's ->> now: chaincall(x, ...) is equivalent to (->> x ...). F#'s |> is somewhat harder to do, because it requires us to somehow deal with a list of arguments to follow the "threaded" argument per function. One way to do it would be using a "right curry" which appends arguments to a function call: function curry_right(f, ...) local args, n_curried = {...}, select("#", ...) return function(...) local n = select("#", ...) local concat = {...} for i = 1, n_curried do concat[n + i] = args[i] end return f(table.unpack(concat, 1, n + n_curried)) end end Then you could just do: chaincall(range(0, 100), curry_right(List.filter, isEven,…

http://stackoverflow.com/comment/136701316
score: 0
type: Comment
comment on: http://stackoverflow.com/a/77534466
type: AnswerComment
has text: hi @shawn if my answer helped in fixing the issue, please mark it answered or helpful. thanks.

http://stackoverflow.com/q/77595211
type: Question
upvote count: 1
tagged with: concatenation
has body: 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. mX = { {X,0,0,0,X}, {0,X,0,X,0}, {0,0,X,0,0}, {0,X,0,X,0}, {X,0,0,0,X}, } mY = { {X,0,0,0,X}, {0,X,0,X,0}, {0,0,X,0,0}, {0,X,0,0,0}, {X,0,0,0,0}, } 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 mZ = mX, mY, mX, mY, mX, mY, mX mZ = { {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}, {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}, {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}, {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}, {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}, {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}, {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}, {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}, {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}, {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}, } 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 "row" of matrices it stops understanding what im trying to do. ive 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. i 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. edit 1: i 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 dire…
favorite count: 0
tagged with: arrays
downvote count: 0
score: 1
tagged with: matrix
tagged with: lua
tagged with: lua-table
has answer: http://stackoverflow.com/a/77616174
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136803599
has title: How to concatenate matrices in lua with wrapping

http://stackoverflow.com/comment/136638351
type: Comment
type: QuestionComment
has text: Can't you just do `year=dtable.year`, `month=dtable.month`, etc.? Where are you stuck?
score: 0
comment on: http://stackoverflow.com/q/77505557

coronasdk
tags question: http://stackoverflow.com/q/77439054
type: Tag
tag name: coronasdk
tags question: http://stackoverflow.com/q/78415986
tags question: http://stackoverflow.com/q/78325013
tags question: http://stackoverflow.com/q/78562440

http://stackoverflow.com/comment/136641521
comment on: http://stackoverflow.com/q/77507409
type: Comment
type: QuestionComment
score: 0
has text: What version of Lua was that code compiled with?

http://stackoverflow.com/comment/136868600
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77497940
has text: 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...
type: Comment

http://stackoverflow.com/comment/136531316
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77443231
has text: Replace `local name = "file " .. arg[1]` with `local arg = {...}; local name = "file " .. arg[1]`
type: Comment

http://stackoverflow.com/comment/136554169
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77455606

http://stackoverflow.com/a/77468515
has comment: http://stackoverflow.com/comment/136578927
has body: game.Players.PlayerAdded:Wait() wait()game.Players:players()[1].leaderstats.isKing.Value="Yes" game.Players.PlayerRemoving:Connect(function() game.Players:players()[1].leaderstats.isKing.Value="Yes" end)
type: Answer
answers question: http://stackoverflow.com/q/77464667
score: 0

http://stackoverflow.com/comment/136554143
score: 0
type: QuestionComment
has text: @Luatic I think that is the same QLua.
comment on: http://stackoverflow.com/q/77455606
type: Comment

http://stackoverflow.com/comment/136500368
type: Comment
comment on: http://stackoverflow.com/q/77426782
score: 1
type: QuestionComment
has text: 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).

http://stackoverflow.com/a/78273917
score: 0
has comment: http://stackoverflow.com/comment/138008054
has body: I believe you want to make a "creator tag" 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 local Handle = Tool.Handle local Damage = 10 Handle.Touched:Connect(function(Hit) local Player = game.Players:GetPlayerFromCharacter(Hit.Parent) if Player then Hit.Parent.Humanoid:TakeDamage(Damage) local Tagged = Instance.new("ObjectValue") Tagged.Name = "creator" Tagged.Value = Player Tagged.Parent = Hit.Parent.Humanoid game.Debris:AddItem(Tagged, 2) end end) So it sets a tag to a certain player and then in a server script in ServerScriptService that checks when a player dies. game.Players.PlayerAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) Character.Humanoid.Died:Connect(function() if Character.Humanoid:FindFirstChild("creator") then local Player = Character.Humanoid.creator.Value local Leaderstats = Player.leaderstats Leaderstats.Kills.Value += 1 end end) end) end)
type: Answer
answers question: http://stackoverflow.com/q/77484441

http://stackoverflow.com/comment/136822312
has text: 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?**
type: Comment
score: 1
comment on: http://stackoverflow.com/a/77594607
type: AnswerComment

http://stackoverflow.com/comment/136551334
score: 0
type: QuestionComment
has text: 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".
comment on: http://stackoverflow.com/q/77455606
type: Comment

http://stackoverflow.com/comment/136504254
has text: Probably not the cause of your problem but Exuberant Ctags has been abandoned a while ago. Consider switching to [Universal Ctags](https://ctags.io).
type: QuestionComment
comment on: http://stackoverflow.com/q/77429315
type: Comment
score: 2

data-masking
tag name: data-masking
tags question: http://stackoverflow.com/q/77584516
type: Tag

decompiling
type: Tag
tags question: http://stackoverflow.com/q/77507409
tag name: decompiling
tags question: http://stackoverflow.com/q/78444284
tags question: http://stackoverflow.com/q/78325013

minecraft
tags question: http://stackoverflow.com/q/77497940
type: Tag
tag name: minecraft
tags question: http://stackoverflow.com/q/78400232
tags question: http://stackoverflow.com/q/78693947

http://stackoverflow.com/comment/136650684
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77512688
type: QuestionComment
has text: Ok so i got it working now but how does my code vs another persons code compare?

http://stackoverflow.com/comment/136720432
has text: try seting candidate_count to 1
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77551269

http://stackoverflow.com/comment/136551310
has text: print(os.setlocale()) --> C.UTF-8
type: Comment
comment on: http://stackoverflow.com/q/77455606
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136552150
type: Comment
comment on: http://stackoverflow.com/q/77455606
type: QuestionComment
score: 0
has text: 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`.

http://stackoverflow.com/comment/136504913
score: 1
type: Comment
comment on: http://stackoverflow.com/q/77429985
type: QuestionComment
has text: 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")

http://stackoverflow.com/comment/136578927
type: Comment
has text: 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?**
comment on: http://stackoverflow.com/a/77468515
score: 0
type: AnswerComment

http://stackoverflow.com/comment/136674264
comment on: http://stackoverflow.com/q/77521327
score: 0
type: QuestionComment
has text: Are you sure you're reffering to the right model? Do the models have a humanoid?
type: Comment

http://stackoverflow.com/comment/136492258
comment on: http://stackoverflow.com/q/77422104
score: 2
type: Comment
has text: 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.
type: QuestionComment

http://stackoverflow.com/a/77471577
score: 0
has body: I am very sure that is because the model or one of the members has the Archivable property turned off, try using space.Archivable = true local s = space:Clone() space.Archivable = false
answers question: http://stackoverflow.com/q/77467266
type: Answer

tags
tag name: tags
tags question: http://stackoverflow.com/q/77429315
type: Tag
tags question: http://stackoverflow.com/q/78659386

http://stackoverflow.com/comment/136552100
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/77455606
type: QuestionComment
score: 0

http://stackoverflow.com/comment/136701607
type: Comment
comment on: http://stackoverflow.com/a/77537699
has text: I corrected the answer, with an example without os library
score: 0
type: AnswerComment

http://stackoverflow.com/comment/136723334
score: 1
type: Comment
has text: `MoveMouseRelative` is unexact, Windows "mouse acceleration" feature determines the real number of pixels, it is often different from the argument of `MoveMouseRelative`.
comment on: http://stackoverflow.com/a/77538184
type: AnswerComment

discord.js
tags question: http://stackoverflow.com/q/77587456
tag name: discord.js
type: Tag

http://stackoverflow.com/comment/136536094
score: 1
type: Comment
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/77443353

http://stackoverflow.com/comment/136683518
type: Comment
comment on: http://stackoverflow.com/a/77472849
has text: EnablePrimaryMouseButtonEvents (true); function OnEvent(event,arg) if IsKeyLockOn("CapsLock")then if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0,30) Sleep(10) PressAndReleaseKey("P") Sleep(10) PressAndReleaseKey("P") Sleep(10) until not IsMouseButtonPressed(1) end end end
score: 0
type: AnswerComment

http://stackoverflow.com/comment/136561162
score: 1
comment on: http://stackoverflow.com/a/77449955
has text: 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.
type: Comment
type: AnswerComment

javascript
tags question: http://stackoverflow.com/q/77587456
type: Tag
tag name: javascript
tags question: http://stackoverflow.com/q/78049090
tags question: http://stackoverflow.com/q/78111131
tags question: http://stackoverflow.com/q/78379717
tags question: http://stackoverflow.com/q/78317635
tags question: http://stackoverflow.com/q/78638625
tags question: http://stackoverflow.com/q/79151147
tags question: http://stackoverflow.com/q/79291948

http://stackoverflow.com/comment/136574578
type: Comment
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77464631
score: 0

formatting
type: Tag
tags question: http://stackoverflow.com/q/77549930
tag name: formatting
tags question: http://stackoverflow.com/q/77973700

http://stackoverflow.com/comment/136730470
type: Comment
score: 0
type: AnswerComment
has text: is it one and only way to do this, because in my game there is no alternative keys
comment on: http://stackoverflow.com/a/77557454

http://stackoverflow.com/comment/136535811
type: Comment
score: 0
has text: edited, even made a new script with nothing else but the above code to make sure `arg` or `...` were not used anywhere else.
type: AnswerComment
comment on: http://stackoverflow.com/a/77443353

http://stackoverflow.com/comment/136719544
score: 0
comment on: http://stackoverflow.com/a/77551374
type: Comment
has text: the document is kinda confusing ngl
type: AnswerComment

http://stackoverflow.com/comment/136777411
has text: Just wanted to mention that it might get you banned unless you have a verified 18+ account and mark the game as 18+
comment on: http://stackoverflow.com/q/77581354
type: Comment
score: 0
type: QuestionComment

syntax-error
tag name: syntax-error
type: Tag
tags question: http://stackoverflow.com/q/77582051
tags question: http://stackoverflow.com/q/77901201

http://stackoverflow.com/comment/136495806
type: Comment
comment on: http://stackoverflow.com/q/77422104
type: QuestionComment
has text: 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?
score: 0

http://stackoverflow.com/comment/136823779
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77594025
type: AnswerComment
has text: 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?

http://stackoverflow.com/a/77550327
accepted answer of: http://stackoverflow.com/q/77546645
score: 0
has body: 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: local function tabify(str) return str:gsub("%f[^\n]() + ()", function(i, j) return ("\t"):rep(j - i) end) end
answers question: http://stackoverflow.com/q/77546645
type: AcceptedAnswer
type: Answer

sublimetext
tags question: http://stackoverflow.com/q/77553609
type: Tag
tag name: sublimetext

http://stackoverflow.com/comment/136689920
type: QuestionComment
comment on: http://stackoverflow.com/q/77521327
score: 0
has text: by far of what i saw, when the tower cant target anything and an enemy gets on its range, it causes the error
type: Comment

http://stackoverflow.com/comment/136884153
comment on: http://stackoverflow.com/q/77527042
type: Comment
score: 0
has text: Yes, there is a sandbox limiting the standard lua api, thanks
type: QuestionComment

string-formatting
tag name: string-formatting
type: Tag
tags question: http://stackoverflow.com/q/77549930

http://stackoverflow.com/comment/136722219
has text: It's certainly possible, but you'll have to edit the grammar files.
type: Comment
comment on: http://stackoverflow.com/q/77553609
type: QuestionComment
score: 0

http://stackoverflow.com/a/77544466
has body: You forgot to put the stat object in leaderstats this is easily fixed by this line of code: stat.Parent = leaderstats Oh and by the way, use game:GetService("Players") instead of game:WaitForChild("Players") as this is more clean
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77512688

lua-5.4
tag name: lua-5.4
tags question: http://stackoverflow.com/q/77449495
type: Tag
tags question: http://stackoverflow.com/q/78302174
tags question: http://stackoverflow.com/q/78251628
tags question: http://stackoverflow.com/q/78209045
tags question: http://stackoverflow.com/q/78164268
tags question: http://stackoverflow.com/q/78243678
tags question: http://stackoverflow.com/q/78658586
tags question: http://stackoverflow.com/q/78736450
tags question: http://stackoverflow.com/q/78985193
tags question: http://stackoverflow.com/q/79090659
tags question: http://stackoverflow.com/q/79118768
tags question: http://stackoverflow.com/q/79509437

redaction
tag name: redaction
tags question: http://stackoverflow.com/q/77584516
type: Tag

http://stackoverflow.com/comment/136563205
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77462458
type: QuestionComment
has text: "I'm sure it's something very obvious that I can't see" thank you, I knew I was blind.

http://stackoverflow.com/a/77534466
has comment: http://stackoverflow.com/comment/136701316
has comment: http://stackoverflow.com/comment/136689372
upvote count: 1
answers question: http://stackoverflow.com/q/77533955
score: 1
has comment: http://stackoverflow.com/comment/136700612
downvote count: 0
has comment: http://stackoverflow.com/comment/136689327
has body: The good way to to do it, which will certianly work - when you are saving the data in redis, first initialize struct and fill data fields prior saving, use json.Marshal to get bytes and save that in redis using SET command and fetch using GET command you will get the data in bytes and then use json.Unmarshal to retrieve the data. local data = redis.call('GET', KEYS[1]) // data returned here in bytes inviteInfo := &InviteInfo {} err = json.Unmarshal(data, inviteInfo) if err != nil { // log err return err } // now you can access data fields of inviteInfo if no err Edit 1 when saving - type InviteInfo struct { ... MaxPeers int32 `json:"maxPeers"` RouteVersion int32 `json:"routeVersion"` ... } inviteInfo := &InviteInfo{ MaxPeers: 5, RouteVersion: 1, } inviteInfoBytes, err := json.Marshall(inviteInfo) if err != nil { // log err } // method can defer as per library func (c *Cache) saveInRedis(key string, inviteInfoBytes []byte) error { conn, err := c.getConnFromPool() if err != nil { return err } defer conn.Close() var luaScript = redis.NewScript(1, ` redis.call('SET', KEYS[1], ARGV[1]) `) _, err = luaScript.Do(conn, key, string(inviteInfoBytes)) return err } // atomic modification func ModifyInviteInfoAtomic(key string, updatedRouteVersion int32) error { conn, err := c.getConnFromPool() if err != nil { return err } defer conn.Close() var luaScript = redis.NewScript(1, ` local inviteInfo = redis.call('GET', KEYS[1]) if inviteInfo then: local metaData = cjson.decode(inviteInfo) if metaData['RouteVersion'] then metaData.RouterVersion = ARGV[1] local updatedMetaData = cjon.encode(metaData) redis.call('SET', KEYS[1], updatedMetaData) end end `) _, err = luaScript.Do(conn, key, updatedRouteVersion) return err }
has comment: http://stackoverflow.com/comment/136689282
type: Answer

http://stackoverflow.com/comment/136699041
has text: Yup, when I source my `init.lua`. ╰─❯ source init.lua init.lua:1: number expected
type: Comment
comment on: http://stackoverflow.com/q/77539961
score: 0
type: QuestionComment

luabridge
tag name: luabridge
type: Tag
tags question: http://stackoverflow.com/q/77520256

object
type: Tag
tags question: http://stackoverflow.com/q/77438652
tag name: object
tags question: http://stackoverflow.com/q/77639707
tags question: http://stackoverflow.com/q/77941484
tags question: http://stackoverflow.com/q/78262662

methods
tag name: methods
tags question: http://stackoverflow.com/q/77477233
type: Tag

functional-programming
type: Tag
tags question: http://stackoverflow.com/q/77549655
tag name: functional-programming
tags question: http://stackoverflow.com/q/79487664

http://stackoverflow.com/comment/136708695
type: Comment
comment on: http://stackoverflow.com/q/77539566
score: 0
has text: @lhf well, not very, considering it is a path, maybe 100-150 chars.
type: QuestionComment

matrix
tags question: http://stackoverflow.com/q/77595211
tag name: matrix
type: Tag
tags question: http://stackoverflow.com/q/78209189

http://stackoverflow.com/comment/136711668
has text: Thnaks! I thought about that and will clearly help - I willl. Out of curiositywhy is needed ?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77538184
type: AnswerComment

yaml
tag name: yaml
type: Tag
tags question: http://stackoverflow.com/q/77550367
tags question: http://stackoverflow.com/q/77882406

http://stackoverflow.com/a/77586847
accepted answer of: http://stackoverflow.com/q/77585062
upvote count: 1
answers question: http://stackoverflow.com/q/77585062
type: AcceptedAnswer
type: Answer
has body: :Workspace doesn't exist, instead try to replace it by .Workspace. With these changes the script should looks like this : game.Workspace.Part:Destroy(). Hope this help !
downvote count: 0
score: 1

environment
tags question: http://stackoverflow.com/q/77422104
type: Tag
tag name: environment

http://stackoverflow.com/comment/136698393
type: QuestionComment
has text: Define "most performant". How long are your strings?
score: 2
type: Comment
comment on: http://stackoverflow.com/q/77539566

http://stackoverflow.com/comment/136641412
score: 1
type: Comment
has text: Please upload the original file (Lua bytecode) you are trying to decompile. It might happen that this file is additionally obfuscated.
comment on: http://stackoverflow.com/q/77507409
type: QuestionComment

bbcode
tag name: bbcode
tags question: http://stackoverflow.com/q/77508314
type: Tag

tostring
tag name: tostring
tags question: http://stackoverflow.com/q/77455606
type: Tag

http://stackoverflow.com/comment/136645366
type: QuestionComment
has text: 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.)
type: Comment
comment on: http://stackoverflow.com/q/77507409
score: 0

spring-data-redis
tags question: http://stackoverflow.com/q/77566514
tag name: spring-data-redis
type: Tag

http://stackoverflow.com/a/77449631
has body: 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.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77436024

caption
type: Tag
tag name: caption
tags question: http://stackoverflow.com/q/77504584

http://stackoverflow.com/comment/136547624
type: Comment
comment on: http://stackoverflow.com/a/77443353
score: 0
type: AnswerComment
has text: @LucRiffault Huh, that is strange. What is the platform that you're using?

http://stackoverflow.com/comment/136540570
type: Comment
has text: See also https://github.com/lhf/lhpdf-fix
comment on: http://stackoverflow.com/a/77449955
score: 2
type: AnswerComment

http://stackoverflow.com/comment/136768020
type: Comment
comment on: http://stackoverflow.com/a/77537699
score: 0
has text: I didn't understand the question, just change the 'hour' and 'min' values
type: AnswerComment

parameter-passing
tags question: http://stackoverflow.com/q/77443231
tag name: parameter-passing
type: Tag

http://stackoverflow.com/a/77504978
has body: Most likely you forgot to add an attachment for the accessory. Without attachment it will just fall off.
answers question: http://stackoverflow.com/q/77497743
score: 0
type: Answer

java
tag name: java
type: Tag
tags question: http://stackoverflow.com/q/77441092
tags question: http://stackoverflow.com/q/77973700
tags question: http://stackoverflow.com/q/78308549
tags question: http://stackoverflow.com/q/78566604
tags question: http://stackoverflow.com/q/78481795
tags question: http://stackoverflow.com/q/79358250
tags question: http://stackoverflow.com/q/79353612

http://stackoverflow.com/q/77464667
has body: 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? I wrote this: local king while wait(1) do for i = 1, #game.Players:GetPlayers(), 1 do if (game.Players:GetPlayers()[i].leaderstats.isKing.Value == "Yes") then return end end for i, v in pairs(game.Players:GetPlayers()) do if (v.leaderstats.isKing.Value == "") then v.leaderstats.isKing.Value = "Yes" end end end But clearly this will make everyone become king So I wrote this local king while wait(1) do for i = 1, #game.Players:GetPlayers(), 1 do if (game.Players:GetPlayers()[i].leaderstats.isKing.Value == "Yes") then return end end for i, v in pairs(game.Players:GetPlayers()) do if (v.leaderstats.isKing.Value == "") then v.leaderstats.isKing.Value = "Yes" end end end But it makes player 1 AND 2 become king, but not player 3. It should only be player 1 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?
type: UnansweredQuestion
tagged with: lua
has title: How do I set the first player in the game to be king and no one else? (ROBLOX)
has comment: http://stackoverflow.com/comment/136572250
has answer: http://stackoverflow.com/a/77468515
tagged with: roblox
answer count: 1
score: 0
type: Question

http://stackoverflow.com/comment/136699100
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77539961
has text: Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/256045/discussion-between-taefed-and-mo0rby).
type: QuestionComment

http://stackoverflow.com/tag/html
tag name: html
tags question: http://stackoverflow.com/q/77553609
type: Tag
tags question: http://stackoverflow.com/q/77935205
tags question: http://stackoverflow.com/q/77951212
tags question: http://stackoverflow.com/q/78744024

http://stackoverflow.com/comment/136850179
type: Comment
comment on: http://stackoverflow.com/q/77625181
score: 0
type: QuestionComment
has text: 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. lua.x86_64 5.1.4-15.el7 anaconda lua-devel.i686 5.1.4-15.el7 base lua-devel.x86_64 5.1.4-15.el7 base lua53u.x86_64 5.3.4-1.ius.el7 ius lua53u-libs.x86_64 5.3.4-1.ius.el7 ius

http://stackoverflow.com/q/77734506
downvote count: 0
score: 3
has body: 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. My lua lspconfig lspconfig.lua_ls.setup( { on_init = function(client) local path = client.workspace_folders[1].name if not vim.loop.fs_stat(path .. "/.luarc.json") and not vim.loop.fs_stat(path .. "/.luarc.jsonc") then client.config.settings = vim.tbl_deep_extend( "force", client.config.settings.Lua, { runtime = { -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) version = "LuaJIT" }, diagnostics = { globals = { 'vim' } }, -- Make the server aware of Neovim runtime files workspace = { library = {vim.env.VIMRUNTIME} -- or pull in all of 'runtimepath'. NOTE: this is a lot slower -- library = vim.api.nvim_get_runtime_file("", true) } } ) client.notify("workspace/didChangeConfiguration", {settings = client.config.settings}) end return true end } ) Screenshot
answer count: 0
tagged with: lua
upvote count: 3
type: Question
tagged with: neovim-plugin
has title: How to hide Undefined global vim warning in Neovim?
type: UnansweredQuestion
tagged with: neovim
has comment: http://stackoverflow.com/comment/138383232
favorite count: 0

http://stackoverflow.com/a/77713457
answers question: http://stackoverflow.com/q/77712275
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/137007727
score: 1
has body: Oka has pointed out that a.b[o] = d 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 pf field for now, the basic principle is the same. Let's begin with a mistake: lua_pushlightuserdata(L, ms); luaL_getmetatable(L, "mystruct"); lua_setmetatable(L, -2); This looks quite reasonable, but I believe the result is not what you want, that's because from the manual you can read: 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, there is one single metatable for all numbers, one for all strings, etc. By default, a value has no metatable, but the string library sets a metatable for the string type. If you set the metatable mystruct 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. void newpointerud(lua_State* L, const char* mt, int nuv, const void* data) { auto p = (const void**)lua_newuserdatauv(L, sizeof(void*), nuv); luaL_setmetatable(L, mt); *p = data; } void* getpointerud(lua_State* L, int idx) { return *(void**)lua_touserdata(L, 1); } Next, you need to write the corresponding meta methods for int[] and create a metatable. // ..options[idx] int mt_c_int_array_index(lua_State* L) { int* options = (int*)getpointerud(L, 1); int idx = lua_tointeger(L, 2); if (idx >= 0 && idx < 20) lua_pushinteger(L, *(options + idx)); else lua_pushnil(L); return 1; } // ..options[idx] = value int mt_c_int_array_newindex(lua_State* L) { int* options = (int*)getpointerud(L, 1); int idx = lua_tointeger(L, 2); if (idx >= 0 && idx < 20) *(options + idx) = lua_tointeger…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/137010877
type: Answer
accepted answer of: http://stackoverflow.com/q/77712275

http://stackoverflow.com/q/77734716
has comment: http://stackoverflow.com/comment/137042848
answer count: 0
has comment: http://stackoverflow.com/comment/137042880
linked to: http://stackoverflow.com/q/45008253
has body: 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 "error loading module 'testlib' from file 'C:\lua\testlib.dll': The specified module could not be found." This happens when running require('testlib') from the command line, as well as from within an embedded script. 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. 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. This is my first time working with c++, so please let me know if there's any more important information I should include. #include "pch.h" #include <lua.hpp> extern "C" { static int add(lua_State* L) { lua_Number n1 = luaL_checknumber(L, 1); lua_Number n2 = luaL_checknumber(L, 2); lua_pushnumber(L, n1 + n2); return 1; } static const luaL_Reg mylib[] = { {"add", add}, {NULL, NULL} }; __declspec(dllexport) int luaopen_testlib(lua_State* L) { luaL_newlib(L, mylib); return 1; } } BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } 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). edit 1: This other question probably counts as a duplicate, but is unanswered and predates Lua 5.4. The comment "C++ dlls are a very particular kind of beast. If possible I recommed you to stick to C on DLL…
linked to: http://stackoverflow.com/q/65657883
upvote count: 2
tagged with: c++
has comment: http://stackoverflow.com/comment/137042940
type: Question
tagged with: visual-c++
has comment: http://stackoverflow.com/comment/137042888
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
score: 1
has comment: http://stackoverflow.com/comment/137043317
favorite count: 0
tagged with: lua
has title: Unable to load simple DLL module with Lua 5.4: "The specified module could not be found"
tagged with: dll
downvote count: 1
has comment: http://stackoverflow.com/comment/137045006

http://stackoverflow.com/a/77662332
has body: To write and read to and from an open file: Whenever you successfully perform any read or write operation on a file - regardless of the mode the file was opened with - the file position indicator for the file will have changed. For r+ (read extended), the file position indicator is initially set to the start of the file, and both reading and writing are allowed1. Starting by reading the entire file then places the indicator at the end of the file. Immediately following this with a write operation will then appear as an append, and the file position indicator will still be at the end of the file. Attempting to read at this point will not return any data from the file - you must first seek to a position with data. This can be done with file:seek. For example, file:seek('set') places the file position indicator at the start of the file. 1. Note that because Lua's I/O is a very thin wrapper around C's I/O, we should refer to documentation on fopen to learn the order in which operations may be performed on a file opened for both reading (input) and writing (output): In update mode ('+'), both input and output may be performed, but output cannot be followed by input without an intervening call to fflush, fseek, fsetpos or rewind, and input cannot be followed by output without an intervening call to fseek, fsetpos or rewind, unless the input operation encountered end of file. In update mode, implementations are permitted to use binary mode even when text mode is specified. From this we can see that a call to file:write immediately followed by a call file:read is not actually allowed. You must call file:seek (or file:flush) in-between writing and reading. If you want to open your file a second time, in order to read what you have just written, you must first commit these changes to the file with file:flush (or file:close), as otherwise the data is surely buffered (see also file:setvbuf). Aside: you describe immediately writing to a file after opening it with r+ mode as havi…
type: AcceptedAnswer
type: Answer
upvote count: 1
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/77659298
answers question: http://stackoverflow.com/q/77659298

http://stackoverflow.com/a/77721366
answers question: http://stackoverflow.com/q/77719576
score: 0
has comment: http://stackoverflow.com/comment/137030480
has comment: http://stackoverflow.com/comment/137031200
has body: Since your provided function() print("Error in gkyl_range_init") end as the error handler for your xpcall, you'll only print this line. Instead you might want to try this: local pOk, err = pcall(ffiC.gkyl_range_init, r, r._ndim, r._lower, r._upper) if not pOk then print("Error in gkyl_range_init:", err) end This will work if gkyl_range_init fails with an error, if the function just returns an error code or message then you'll just want to print that instead, pcall will not trigger an error in this case. local pOk, ret, err = pcall(ffiC.gkyl_range_init, r, r._ndim, r._lower, r._upper) if not pOk then print("Error in gkyl_range_init:", ret) elseif not ret then print("gkyl_range_init returned err:", err) end Something like the above might work if the function does return some information, if it doesn't then I guess you'll have to modify the library that you're using.
type: Answer

http://stackoverflow.com/comment/137067431
type: QuestionComment
comment on: http://stackoverflow.com/q/77748468
type: Comment
has text: It doesn't run the script when i die the second time*
score: 0

http://stackoverflow.com/comment/136946542
comment on: http://stackoverflow.com/q/77677453
has text: No? I meant the string at the 6th to last line.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77697636
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/77697425
has body: In NvChad, autocompletion is <C-Space> (Control + Space) by default nvim-cmp is responsible for autocompletion. If you want to change the default mapping, you have to add custom plugin options in NvChad (source): custom/chadrc.lua M.plugins = "custom.plugins" custom/plugins.lua local plugins = { -- this opts will extend the default opts { "hrsh7th/nvim-cmp", opts = { mapping = { ["<C-Space>"] = cmp.mapping.complete(), -- Replace with whatever you want }, }, }, } return plugins NOTE: This is true only to NvChad. For configuring with any other neovim config, consult the documentation. 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 kickstart.nvim
accepted answer of: http://stackoverflow.com/q/77697425
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/136979041

http://stackoverflow.com/comment/136884763
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77634753
score: 0
has text: @luke100000, directly we can assign, is there no iteration required to assign to transform_body[siminfo]. Please suggest?

http://stackoverflow.com/comment/136873375
type: Comment
score: 0
has text: It's not different from how you read any other table. https://www.lua.org/pil/2.5.html `body["TheatreInfo"]`, or short `body.TheatreInfo`, just gives you another table, which you can again index.
comment on: http://stackoverflow.com/q/77634753
type: QuestionComment

kong
type: Tag
tags question: http://stackoverflow.com/q/77705072
tag name: kong
tags question: http://stackoverflow.com/q/77634753
tags question: http://stackoverflow.com/q/77847916
tags question: http://stackoverflow.com/q/78443079
tags question: http://stackoverflow.com/q/78373365
tags question: http://stackoverflow.com/q/78449716
tags question: http://stackoverflow.com/q/78587137
tags question: http://stackoverflow.com/q/78601647
tags question: http://stackoverflow.com/q/79053069
tags question: http://stackoverflow.com/q/79205736

http://stackoverflow.com/comment/137052180
comment on: http://stackoverflow.com/a/77737067
has text: @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.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/136890368
comment on: http://stackoverflow.com/a/77645447
type: AnswerComment
type: Comment
score: 0
has text: Just bought the 4th edition ;-)

http://stackoverflow.com/comment/138383232
comment on: http://stackoverflow.com/q/77734506
type: QuestionComment
type: Comment
has text: [How to suppress warning: undefined global `vim`?](https://neovim.discourse.group/t/how-to-suppress-warning-undefined-global-vim/1882/4)
score: 1

http://stackoverflow.com/comment/137017819
comment on: http://stackoverflow.com/q/77719576
type: Comment
score: 4
type: QuestionComment
has text: Please edit your question to include enough C and Lua code that your problem is reproducible.

http://stackoverflow.com/comment/136996377
has text: peripherial.call("top", clear)
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77704605

http://stackoverflow.com/q/77603503
type: UnansweredQuestion
tagged with: fivem
has body: im fairly new to lua and working on CFX FiveM, and have made a simple table.insert which calls on a for type, value in pairs(Config.Skills) do This is then refering back to a SQL table which is pulling the data correctly, but the table inserts are showing the same value. SQL OUTPUT - {"stamina":{"RemoveAmount":-0.3,"Stat":"MP0_STAMINA","Current":25},"strength":{"RemoveAmount":-0.3,"Current":13,"Stat":"MP0_STRENGTH"}} Lua Code function SkillMenu() FetchSkills() Wait(1000) RefreshSkills() local elements = {} for type, value in pairs(Config.Skills) do table.insert(elements, { type = 'button', name = "stamina", label = "Stamina", description = type .. value["Current"] .. "%", icon = 'fad fa-heartbeat', disabled = true }) table.insert(elements, { type = 'button', name = 'strength', label = "Strength", description = type .. value["Current"] .. "%", icon = 'fad fa-heartbeat', disabled = true }) TMC.Functions.OpenMenu({ namespace = "skillmenu", type = 'openMenu', title = "Skill menu", }, elements, function(close, confirmed) end, function(selected) end, function(change) if change.elementChanged == "stamina" then TMC.Functions.CloseMenu() elseif change.elementChanged == 'strength' then TMC.Functions.CloseMenu() end end) end end What it is outputting What I am looking to achieve: Stamina stamina25% Strength strength13% Thanks in advance
answer count: 2
has title: Lua table pairs output showing same value
score: 0
has answer: http://stackoverflow.com/a/77603938
has answer: http://stackoverflow.com/a/77603934
tagged with: lua
type: Question

http://stackoverflow.com/comment/137075211
type: AnswerComment
type: Comment
score: 0
has text: Only thing I can say to help not enough context :c
comment on: http://stackoverflow.com/a/77749562

http://stackoverflow.com/comment/136873082
comment on: http://stackoverflow.com/q/77634753
type: QuestionComment
score: 1
type: Comment
has text: `body.TheatreInfo[1].tId`

http://stackoverflow.com/comment/137037949
type: QuestionComment
type: Comment
has text: It returns the json, the request is done @ESkri
score: 0
comment on: http://stackoverflow.com/q/77726860

http://stackoverflow.com/q/77712275
score: 2
type: Question
answer count: 1
tagged with: http://stackoverflow.com/tag/c
favorite count: 0
tagged with: lua
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137005432
linked to: http://stackoverflow.com/q/77280566
downvote count: 0
has body: I'm writing C code to check and modify struct members in lua, I'm using metatables It works for simple definitions, but in array I couldn't make it work, I have the following code struct pinfo { int time; bool hide_name; int type_info[10]; }; struct mystruct { int id; int value; int option[20]; struct pinfo pf[5]; .... }; int Get_mystruct(lua_State *L) { struct mystruct *ms = (struct mystruct*)lua_touserdata(L, 1); lua_pushlightuserdata(L, ms); luaL_getmetatable(L, "mystruct"); lua_setmetatable(L, -2); return 1; } int mystruct_index(lua_State *L) { struct mystruct *ms = (struct mystruct*)lua_touserdata(L, 1); const char *field = lua_tostring(L, 2); if (strcmp(field, "id") == 0) { lua_pushinteger(L, ms->id); } else if (strcmp(field, "value") == 0) { lua_pushinteger(L, ms->value); } else if (strcmp(field, "option") == 0) { lua_pushinteger(L, ms->option[lua_tointeger(L, 3)]); } else { lua_pushnil(L); } return 1; } int mystruct_newindex(lua_State *L) { struct mystruct *ms = (struct mystruct*)lua_touserdata(L, 1); const char *field = lua_tostring(L, 2); int value = (int)lua_tointeger(L, 3); if (strcmp(field, "id") == 0) { ms->id = value; } else if (strcmp(field, "value") == 0) { ms->value = value; } else if (strcmp(field, "option") == 0) { ms->option[lua_tointeger(L, 3)] = (int)lua_tointeger(L, 4); } else { lua_pushnil(L); } return 0; } void mystruct_create(lua_State *L) { luaL_Reg mystructData[] = { { "GetMyStruct", Get_mystruct}, { "__index", mystruct_index}, { "__newindex", mystruct_newindex}, {NULL, NULL} }; luaL_newmetatable(L, "mystruct"); luaL_setfuncs(L, mystructData, 0); lua_setfield(L, -2, "MyStructLua"); } In lua I use it as follows local ms = MyStructLua.GetMyStruct(my_ptr) print(ms.id) // Returns 0, not defined ms.id = 1000 print(ms.id) // Returns 1000, has been defined Now when I go to define the array a problem occurs when I try for example for o = 0, 19 do mp.option[o] = 1 end When I go to set the value I get the error bad argument #3 to 'index' (number e…
has comment: http://stackoverflow.com/comment/137005213
has comment: http://stackoverflow.com/comment/137005180
upvote count: 2
has comment: http://stackoverflow.com/comment/137005208
has title: How to use _newindex arrays I always get bad arguments
has answer: http://stackoverflow.com/a/77713457
accepted answer: http://stackoverflow.com/a/77713457

http://stackoverflow.com/comment/137005213
has text: 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).
type: Comment
comment on: http://stackoverflow.com/q/77712275
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136884840
comment on: http://stackoverflow.com/q/77634753
score: 0
type: QuestionComment
has text: 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
type: Comment

http://stackoverflow.com/comment/136938101
comment on: http://stackoverflow.com/q/77671751
type: QuestionComment
score: 0
type: Comment
has text: 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.

http://stackoverflow.com/q/77709322
tagged with: roblox-studio
score: 0
tagged with: roblox
accepted answer: http://stackoverflow.com/a/77711120
type: Question
answer count: 1
tagged with: logic
has title: Figuring out how to make tool work as expected
has body: 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 "Coal" part with pickaxe and click. But I want it to work that it will work when i click and it is already touching "Coal" Here is a video showing the problem. https://www.youtube.com/watch?v=qcri_MwelCE local toolPart = script.Parent local swung = false local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEventFolder = ReplicatedStorage.RemoteEvents local UpdateMoneyEvent = RemoteEventFolder.UpdateMoney local touchingParts = toolPart.Handle:GetTouchingParts() local toolPart = script.Parent local function onTouch(partTouched) -- Check if the touched part is named "Coal" if partTouched.Name == "Coal" then UpdateMoneyEvent:FireServer(100) print("Tool activated and touching a part named Coal!") end end toolPart.Handle.Touched:Connect(onTouch) Any Help is appreciated! Thanks! I did not know what else to try.
tagged with: lua
has answer: http://stackoverflow.com/a/77711120
type: AnsweredQuestion
tagged with: game-development

http://stackoverflow.com/comment/137075200
type: AnswerComment
type: Comment
has text: Put this script that should be a LocalScript in StarterPlayerScripts and change the paths in the script to WaitForChild('PlayerGui') paths
comment on: http://stackoverflow.com/a/77749562
score: 0

http://stackoverflow.com/q/77634753
answer count: 1
type: UnansweredQuestion
score: 1
has title: how to read nested objects(object inside object) in lua file
favorite count: 0
has body: I am writing lua file. In that we have to read the requested body. Below is the sample request body json. { "year":"2023", "languageId":"2", "city":"Banglore", "TheatreInfo": [ { "tId":"123", "tname":"inox" }, { "tId":"124", "tname":"inox" } ], "usecase":"tdetails" } i tried to read above json in lua file like below. local transform_body = {} transform_body["year"]=body["year"] transorm_vody["languageid"]=body["languageId"] transorm_vody["city"]=body["city"] but how to read for theatreinfo nested object.and theatreinfo may contains one or more entries.
tagged with: lua
has answer: http://stackoverflow.com/a/77644474
has comment: http://stackoverflow.com/comment/136873375
has comment: http://stackoverflow.com/comment/136884840
has comment: http://stackoverflow.com/comment/136884763
has comment: http://stackoverflow.com/comment/136873082
has comment: http://stackoverflow.com/comment/136883373
type: Question
tagged with: kong
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/77704605
has comment: http://stackoverflow.com/comment/136991045
tagged with: computercraft
has comment: http://stackoverflow.com/comment/137003224
has comment: http://stackoverflow.com/comment/137003047
has comment: http://stackoverflow.com/comment/136996391
has comment: http://stackoverflow.com/comment/137002690
has comment: http://stackoverflow.com/comment/137002629
has comment: http://stackoverflow.com/comment/137013422
has comment: http://stackoverflow.com/comment/136996377
has comment: http://stackoverflow.com/comment/137013443
score: 0
has comment: http://stackoverflow.com/comment/137003083
has title: Why i cant use peripherial api in api computer craft?
has comment: http://stackoverflow.com/comment/136995097
type: Question
has comment: http://stackoverflow.com/comment/137002784
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/137013430
has comment: http://stackoverflow.com/comment/136997705
has comment: http://stackoverflow.com/comment/136995899
has body: 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? I tried to write an api that will make it easier to work with monitors, but I can’t call their functions
has comment: http://stackoverflow.com/comment/136996388
tagged with: lua

http://stackoverflow.com/tag/png
tags question: http://stackoverflow.com/q/77755513
tag name: png
type: Tag

http://stackoverflow.com/comment/136935096
has text: @Matt the `<cmd>` was just an example. There is much more of this notation, like `<c-a>` that does not have such a replacement
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77671751
type: QuestionComment

http://stackoverflow.com/q/77728982
has body: 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. However, the loop keeps running infinitely, even when I release the key. function OnEvent(event, arg) if (event == "G_PRESSED" and arg == 1) then repeat OutputLogMessage("Loop") if (event == "G_RELEASED" and arg == 1) then break end until (event == "G_RELEASED" and arg == 1) OutputLogMessage("End Loop") end end
has title: Lua script logitech - start and end a loop when the key is released
score: 0
tagged with: macros
has answer: http://stackoverflow.com/a/77731663
tagged with: logitech
tagged with: lua
type: Question
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/136921633
comment on: http://stackoverflow.com/q/77659051
type: QuestionComment
score: 0
type: Comment
has text: 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

http://stackoverflow.com/a/77697072
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/136977593
upvote count: 1
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/77696861
answers question: http://stackoverflow.com/q/77696861
has body: You can use the following code to save your pointer in the lua state: lua_pushlightuserdata(L, new BigObject{}); lua_setfield(L, LUA_REGISTRYINDEX, "unique-name"); You need to choose this unique-name yourself, see the manual for detail. Use the corresponding method to obtain this pointer: lua_getfield(L, LUA_REGISTRYINDEX, "unique-name"); auto bigObject = (BigObject*)lua_touserdata(L, -1); lua_pop(L, 1);
has comment: http://stackoverflow.com/comment/136977431

http://stackoverflow.com/a/77749562
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/137075137
has body: 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. Also turn on ResetOnSpawn this will fix your issue. local players = game:GetService("Players") local localplayer = players.LocalPlayer local char = localplayer.Character or localplayer.CharacterAdded:Wait() -- Handle character respawn local hum = char:WaitForChild("Humanoid") local cam = game.Workspace.CurrentCamera local MenuCamera = game.Workspace.MenuRoom.MenuCamera hum.Died:Connect(function() print("Death event triggered!") -- Debugging wait(1.5) script.Parent.DeathScreen.Visible = true cam.CameraType = Enum.CameraType.Scriptable cam.CFrame = MenuCamera.CFrame wait(2) script.Parent.DeathScreen.Visible = false end)
has comment: http://stackoverflow.com/comment/137073374
answers question: http://stackoverflow.com/q/77748468
has comment: http://stackoverflow.com/comment/137075211
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/137075200

http://stackoverflow.com/comment/136991964
has text: just an additional thing need to inform - Before encode() method, when I tried to print 'response' , I got the table.
type: Comment
comment on: http://stackoverflow.com/q/77705072
score: 0
type: QuestionComment

http://stackoverflow.com/a/79049650
has body: 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 "waitfor:" in lua scripts before.
has comment: http://stackoverflow.com/comment/139393071
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77734652

http://stackoverflow.com/comment/137086339
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/77755905
has text: 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.

http://stackoverflow.com/q/77755513
has title: Stuck whilst applying the step missing from decoding a PNG file, in Luau (defiltering)
tagged with: decoding
type: UnansweredQuestion
tagged with: binaryfiles
has body: 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. 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 "filtered" 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. For every scanline, I am correctly getting the byte used to determine which filter function 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 PNGSuite (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. Here are the results for each image: 0 (No Operation): output image is correct! 1 (Sub) image looks nearly correct, but the red channel is a little weird: 2 (Up) the shapes in the image resemble the correct result, but it's definitely very wrong: 3 (Average) the number in the image can be seen, but otherwise, it's nearly completely incomprehensible: 4 (Paeth Predictor) shows patterns similar to Up, but it's also very wrong: (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.) (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 buffer library. It shouldn't be too…
downvote count: 0
favorite count: 0
answer count: 0
tagged with: lua
tagged with: luau
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/137084563
tagged with: http://stackoverflow.com/tag/png
type: Question

http://stackoverflow.com/comment/137087944
comment on: http://stackoverflow.com/a/77760007
type: Comment
score: 0
has text: 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
type: AnswerComment

http://stackoverflow.com/q/77766830
has comment: http://stackoverflow.com/comment/137124322
has answer: http://stackoverflow.com/a/77769346
accepted answer: http://stackoverflow.com/a/77769346
has comment: http://stackoverflow.com/comment/137102266
tagged with: tcpserver
tagged with: tcp
type: Question
has title: lua server can't handle mutiple clients
answer count: 1
tagged with: sockets
has body: so, im learning about socket progamming, and im trying to make a simple tcp chatroom server in lua. 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 server.lua require('socket') server = assert(socket.bind('localhost', 69420)) clients = {} --data = {} --use later function broadcast(message) if message then for _, client in pairs(clients) do client:send(message .. '\n') end end end function handle(client) while 1 do local buff, err = client:receive() if err then print(err) client:send("error occurred = ".. err) client:close() break else print(buff) broadcast(buff) end end end function recieve() while 1 do server:settimeout(0.01) -- tried adding this, still didn't worked local client = server:accept() if client then table.insert(clients, client) print("a new client entered") broadcast("a new client has joined us\n") coroutine.wrap(handle)(client) --this was supposed to handle the clients end end end print("localhost server listening on port 69420... nice") recieve() also, im using this client script: client.lua -- simple script just to check for server errors require('socket') client = socket.tcp() client:connect("localhost", 69420) client:send("hello\n") while 1 do local s, status, partial = client:receive() print(s or partial) if status == "closed" then break end end client:close()
tagged with: lua
has comment: http://stackoverflow.com/comment/137101237
score: 0
type: AnsweredQuestion

dpdk
tags question: http://stackoverflow.com/q/77625181
tag name: dpdk
type: Tag

http://stackoverflow.com/q/77669809
answer count: 1
score: 0
type: Question
type: UnansweredQuestion
tagged with: roblox
has title: How can i make it so my tool detects whe it's activated because it's not working
has body: My roblox tool has a function to perform when activated but it literally does nothing 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. If you want the code, here it is: local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local hum = character:WaitForChild("Humanoid") local animator = hum:WaitForChild("Animator") local tool = script.Parent local leftPunch = animator:LoadAnimation(script:WaitForChild("RookieLeftPunch")) local rightPunch = animator:LoadAnimation(script:WaitForChild("RookieRightPunch")) local currentPunch = 0 local debounce = false tool.Equipped:Connect(function() print("equipped") tool.Activated:Connect(function() if debounce then return end debounce = true if currentPunch == 0 then rightPunch:Play() task.wait(0.4) print("punched 1") debounce = false elseif currentPunch == 1 then leftPunch:Play() task.wait(0.4) print("punched 2") debounce = false elseif currentPunch == 2 then rightPunch:Play() task.wait(0.8) print("punched 3") debounce = false end if currentPunch == 2 then currentPunch = 0 else currentPunch += 1 end end) end)
has comment: http://stackoverflow.com/comment/136937173
has answer: http://stackoverflow.com/a/77743532
tagged with: lua
tagged with: luau

http://stackoverflow.com/q/77745823
has comment: http://stackoverflow.com/comment/137069220
has body: 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. The local function in question: local function pegarunbalazo() if cargador ~= 0 and not waza and not alhombro then -- 78 lines of code, of which some define variables, later... task.wait (0.1) end The global function in question: conn = UIS.InputBegan:Connect(function(input, gameProcessedEvent) if input.UserInputType == Enum.UserInputType.MouseButton1 then if debounce then return end debounce=true triggering = true while triggering do pegarunbalazo() end debounce=false end end) 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? Any kind of help, suggestion, or fix provided will be aprecciated and taken into account.
has comment: http://stackoverflow.com/comment/137072586
type: Question
tagged with: function
type: UnansweredQuestion
answer count: 0
tagged with: lua
has title: How useful is it to make a global function fire a larger local function?
tagged with: roblox
has comment: http://stackoverflow.com/comment/137071590
score: 0

http://stackoverflow.com/comment/137002690
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77704605
has text: Yes, that's what the doc said. Clear returns nil. What do you expect it to return?

http://stackoverflow.com/a/77603938
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/77603503
has body: A pairs-loop in Lua means "repeat this action for every item in a table". So, you should have one table.insert in the loop. You should also remove OpenMenu invocation from the loop. local function initcaps(s) return s:sub(1,1):upper()..s:sub(2) end function SkillMenu() FetchSkills() Wait(1000) RefreshSkills() local elements = {} for type, value in pairs(Config.Skills) do table.insert(elements, { type = 'button', name = type, label = initcaps(type), description = type .. " " .. value.Current .. "%", icon = 'fad fa-heartbeat', disabled = true }) end TMC.Functions.OpenMenu({ namespace = "skillmenu", type = 'openMenu', title = "Skill menu", }, elements, function(close, confirmed) end, function(selected) end, function(change) if change.elementChanged == "stamina" then TMC.Functions.CloseMenu() elseif change.elementChanged == 'strength' then TMC.Functions.CloseMenu() end end) end

http://stackoverflow.com/q/77693740
type: UnansweredQuestion
score: 2
downvote count: 0
answer count: 0
tagged with: http://stackoverflow.com/tag/c
tagged with: lua
type: Question
has body: 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 This is my C code #define LTM_DESC #include <tomcrypt.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "lua.h" #include "lauxlib.h" // variáveis globais prng_state prng; int err, prng_idx , hash_idx; // criando a estrutura do output typedef struct { unsigned long exported_key_len; unsigned long ctlen; } Pair; Pair pair; static int gera_chave_lua(lua_State *L) { ecc_key mykey; unsigned char exported_key_public[1024]; size_t exported_key_public_len = sizeof(exported_key_public); unsigned char exported_key_private[1024]; size_t exported_key_private_len = sizeof(exported_key_private); if (register_prng(&yarrow_desc) == -1) { lua_pushstring(L, "Erro ao registrar Yarrow."); lua_error(L); } if (register_hash(&sha512_desc) == -1) { lua_pushstring(L, "Erro ao registrar sha256."); lua_error(L); } prng_idx = find_prng("yarrow"); hash_idx = find_hash("sha512"); if ((err = rng_make_prng(256, prng_idx ,&prng, NULL)) != CRYPT_OK) { lua_pushfstring(L, "Erro ao configurar PRNG: %s", error_to_string(err)); lua_error(L); } if ((err = ecc_make_key(&prng, prng_idx, 65, &mykey)) != CRYPT_OK) { lua_pushfstring(L, "Erro ao criar a chave: %s", error_to_string(err)); lua_error(L); } if ((err = ecc_export(exported_key_public ,&exported_key_public_len , PK_PUBLIC, &mykey)) != CRYPT_OK) { lua_pushfstring(L, "Erro ao exportar a chave pública: %s", error_to_string(err)); lua_error(L); } if ((err = ecc_export(exported_key_private ,&exported_key_private_len , PK_PRIVATE, &mykey)) != CRYPT_OK) { lua_pushfstring(L, "Erro ao exportar a chave privada: %s", error_to_string(err)); lua_error(L); } lua_pushlstring(L, (const char *)exported_key_public, exported_key_public_len); lua_pushlstring(L, (cons…
tagged with: cryptography
favorite count: 0
tagged with: libtomcrypt
upvote count: 2
has title: LibTomcrypt Invalid input packet while decrypting

http://stackoverflow.com/a/77645447
type: Answer
has comment: http://stackoverflow.com/comment/136890368
upvote count: 8
downvote count: 0
has body: You must use another level of long bracket: page = [=[ <TITLE>An HTML Page Lua a text between double brackets ]=] The header says "This first edition was written for Lua 5.0", this was changed in Lua 5.1: 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.)
answers question: http://stackoverflow.com/q/77645389
score: 8
accepted answer of: http://stackoverflow.com/q/77645389
type: AcceptedAnswer

http://stackoverflow.com/comment/136933943
type: Comment
comment on: http://stackoverflow.com/q/77672280
score: 1
has text: 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))`?
type: QuestionComment

http://stackoverflow.com/q/77726860
has body: 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: { "Code": 404, "Response": "Not Found" } (it is ok that the code is 404, it should be) Now if the json ["Code"] 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 local Players = game:GetService("Players") local MarketplaceService = game:GetService("MarketplaceService") local HTTPService = game:GetService("HttpService") local for1monthid = --productid MarketplaceService.ProcessReceipt = function(receiptInfo) local plr = Players:GetPlayerByUserId(receiptInfo.PlayerId) if not plr then return Enum.ProductPurchaseDecision.NotProcessedYet end if receiptInfo.ProductId == for1monthid then local url = "https://api.endpoint.com" local data = { userid = plr.UserId } data = HTTPService:JSONEncode(data) local response = HTTPService:PostAsync(url, data, Enum.HttpContentType.ApplicationJson, false) response = HTTPService:JSONDecode(response) if response["Code"] == 200 then print(response["Code"]) return Enum.ProductPurchaseDecision.PurchaseGranted else print(response["Code"]) return Enum.ProductPurchaseDecision.NotProcessedYet end end end
type: UnansweredQuestion
tagged with: roblox-studio
has comment: http://stackoverflow.com/comment/137037949
has title: Developer product successful, even if it should not
has comment: http://stackoverflow.com/comment/137037207
has comment: http://stackoverflow.com/comment/137040805
tagged with: roblox
has comment: http://stackoverflow.com/comment/137039122
has comment: http://stackoverflow.com/comment/137038384
has comment: http://stackoverflow.com/comment/137039624
has comment: http://stackoverflow.com/comment/137038040
score: 0
answer count: 0
tagged with: lua
type: Question

http://stackoverflow.com/comment/136938048
comment on: http://stackoverflow.com/q/77671751
type: Comment
has text: See in the help. Type `:help nvim_` and press tab to browse through completions. Something like `nvim_replace_termcodes`.
type: QuestionComment
score: 0

http://stackoverflow.com/a/77731735
score: 1
type: Answer
answers question: http://stackoverflow.com/q/77728192
upvote count: 1
has body: In the game, in the "Controls Settings", introduce alternative key for "Shoot" action. (I assume your game allows binding two different keys for the same action) For example, let it be keyboard key P. So, now in the game you can shoot either using Left Mouse Button or using Keyboard key P. Of course, you will use LMB for manual shooting as usually, but your GHub script will use P. Try to play the game with both LMB and P for shooting. Make sure you can shoot with P key while keeping LMB pressed. (Some games do not allow this) The script EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsKeyLockOn("capslock") then repeat PressAndReleaseKey("P") Sleep(15) until not IsMouseButtonPressed(1) end end
downvote count: 0

roblox-studio
type: Tag
tags question: http://stackoverflow.com/q/77743878
tags question: http://stackoverflow.com/q/77714746
tags question: http://stackoverflow.com/q/77709322
tags question: http://stackoverflow.com/q/77726860
tag name: roblox-studio
tags question: http://stackoverflow.com/q/77733769
tags question: http://stackoverflow.com/q/77659051
tags question: http://stackoverflow.com/q/77916441
tags question: http://stackoverflow.com/q/77901201
tags question: http://stackoverflow.com/q/77797082
tags question: http://stackoverflow.com/q/77918731
tags question: http://stackoverflow.com/q/77853630
tags question: http://stackoverflow.com/q/77863272
tags question: http://stackoverflow.com/q/77851596
tags question: http://stackoverflow.com/q/77977304
tags question: http://stackoverflow.com/q/78134354
tags question: http://stackoverflow.com/q/78118370
tags question: http://stackoverflow.com/q/78102362
tags question: http://stackoverflow.com/q/78250537
tags question: http://stackoverflow.com/q/78167836
tags question: http://stackoverflow.com/q/78215215
tags question: http://stackoverflow.com/q/78273784
tags question: http://stackoverflow.com/q/78251874
tags question: http://stackoverflow.com/q/78285075
tags question: http://stackoverflow.com/q/78268821
tags question: http://stackoverflow.com/q/78217605
tags question: http://stackoverflow.com/q/78249339
tags question: http://stackoverflow.com/q/78219171
tags question: http://stackoverflow.com/q/78305470
tags question: http://stackoverflow.com/q/78204048
tags question: http://stackoverflow.com/q/78202258
tags question: http://stackoverflow.com/q/78337673
tags question: http://stackoverflow.com/q/78386134
tags question: http://stackoverflow.com/q/78420466
tags question: http://stackoverflow.com/q/78317719
tags question: http://stackoverflow.com/q/78369116
tags question: http://stackoverflow.com/q/78396506
tags question: http://stackoverflow.com/q/78310793
tags question: http://stackoverflow.com/q/78432378
tags question: http://stackoverflow.com/q/78433994
tags question: http://stackoverflow.com/q/78433500
tags question: http://stackoverflow.com/q/78322705
tags question: http://stackoverflow.com/q/78434058
tags question: http://stackoverflow.com/q/78363204
tags question: http://stackoverflow.com/q/78404007
tags question: http://stackoverflow.com/q/78501561
tags question: http://stackoverflow.com/q/78567841
tags question: http://stackoverflow.com/q/78543461
tags question: http://stackoverflow.com/q/78558884
tags question: http://stackoverflow.com/q/78464672
tags question: http://stackoverflow.com/q/78588093
tags question: http://stackoverflow.com/q/78469654
tags question: http://stackoverflow.com/q/78539465
tags question: http://stackoverflow.com/q/78531655
tags question: http://stackoverflow.com/q/78532534
tags question: http://stackoverflow.com/q/78562731
tags question: http://stackoverflow.com/q/78448609
tags question: http://stackoverflow.com/q/78598446
tags question: http://stackoverflow.com/q/78651730
tags question: http://stackoverflow.com/q/78633143
tags question: http://stackoverflow.com/q/78660346
tags question: http://stackoverflow.com/q/78647894
tags question: http://stackoverflow.com/q/78720214
tags question: http://stackoverflow.com/q/78742067
tags question: http://stackoverflow.com/q/78712660
tags question: http://stackoverflow.com/q/78620746
tags question: http://stackoverflow.com/q/78637224
tags question: http://stackoverflow.com/q/78621381
tags question: http://stackoverflow.com/q/78718156
tags question: http://stackoverflow.com/q/78645183
tags question: http://stackoverflow.com/q/78624992
tags question: http://stackoverflow.com/q/78705996
tags question: http://stackoverflow.com/q/78655709
tags question: http://stackoverflow.com/q/78656483
tags question: http://stackoverflow.com/q/78713867
tags question: http://stackoverflow.com/q/78710890
tags question: http://stackoverflow.com/q/78712784
tags question: http://stackoverflow.com/q/78846464
tags question: http://stackoverflow.com/q/78758535

http://stackoverflow.com/q/77696861
tagged with: c++
type: Question
has comment: http://stackoverflow.com/comment/136985301
answer count: 1
accepted answer: http://stackoverflow.com/a/77697072
tagged with: lua
has title: Share data(variables) between lua callback functions in C++
type: AnsweredQuestion
has body: 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. Hypotetic sample: static int SetParam(lua_State *state) { // be able to access nTotalSetParamCalls to do this: ++nTotalSetParamCalls; } long 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 lua_register(m_luaState, "SetParam", SetParam); luaL_dostring(m_luaState, script); std::cout << "SetParam was called: " << nTotalSetParamCalls << " times"; Thanx in advance
has answer: http://stackoverflow.com/a/77697072
score: 0

http://stackoverflow.com/q/77705072
has comment: http://stackoverflow.com/comment/136991964
has body: 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. Please help to remove the backslashes to decode successfull Below is the snippet we tried local json =require "cjson" body=json.encode(response) util.application_logging():debug("encoded body"..util.dump(body)) //Here getting as below body{\"mobileno\":\"98765467\",\"pwd\":\"demo123\"} body =json.decode(body); //not getting anything
type: Question
tagged with: kong
score: 0
has comment: http://stackoverflow.com/comment/137006900
tagged with: lua
has title: Getting back slashes in the json/request body in Lua script
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
tagged with: cjson
answer count: 0

http://stackoverflow.com/q/77659298
has comment: http://stackoverflow.com/comment/136913960
has answer: http://stackoverflow.com/a/77662332
tagged with: file
type: AnsweredQuestion
upvote count: 2
tagged with: fopen
tagged with: lua
accepted answer: http://stackoverflow.com/a/77662332
has title: File handling in lua
type: Question
answer count: 1
favorite count: 0
has body: I am trying to write something to a file using a function then read it using another function. Here is my code:- local getContent = function(fName) local file = io.open(fName, "r") if file == nil then print("Could not open the file") return end local fData = file:read("*all") print("File data:-\n" .. fData) file:close() end local writeToFile = function(fName, fWrite) local file = io.open(fName, "r+") if file == nil then print("Could not open the file") return end print("Content: " .. file:read("*all")) -- When I use r+ and read the file it acts as append mode and adds the file to the next line -- If I am not reading the file then it acts as write mode and truncates the file file:write(fWrite) -- When I try to read file here then it throws an error file:close() end local fileName = "lua-file.txt" writeToFile(fileName, "My name is Dante\n") getContent(fileName) Q1. When I try to read the file in modes with "+" at end like "r+" and after writing to them inside the writeToFile() then the terminal throws an error. I can read the file before writing to it. How can I solve this? Q2. "w+" and "a+" behave as I expect them to. "w+" truncates the file before writing and "a+" appends data to it at the last line. "r+" 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. Q3. When I am not reading the file before writing i.e. remove line 8 from writeToFile() function print("Content: " .. file:read("*a")) 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.
score: 2
downvote count: 0

tex
tag name: tex
tags question: http://stackoverflow.com/q/77649718
type: Tag
tags question: http://stackoverflow.com/q/78896730

http://stackoverflow.com/comment/136934162
has text: Thanks so much for the detailed explanation of what is going on. I had none of this on my radar. Also thanks for the alternatives to my function^^ I*ll probably implement them once everything else works.
score: 1
comment on: http://stackoverflow.com/a/77672368
type: AnswerComment
type: Comment

http://stackoverflow.com/q/77681606
type: Question
has body: 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. local AccountProxy = {} -- Internal table mapping proxies to actual Account tables local accounts = {} function AccountProxy:new() local proxy = {} local account = {balance = 0} accounts[proxy] = account setmetatable(proxy, { __index = self, }) return proxy end function AccountProxy:withdraw(v) accounts[self].balance = (accounts[self].balance or 0) - v end function AccountProxy:deposit(v) accounts[self].balance = (accounts[self].balance or 0) + v end function AccountProxy:getBalance() return accounts[self].balance or 0 end -- Example usage local acc_1 = AccountProxy:new() -- acc_1 is the proxy acc_1.deposit(100.0) print(acc_1.getBalance()) -- 100.0 acc_1.withdraw(50.0) print(acc_1.getBalance()) -- 50.0 I get attempt to index a nil value (field '?'). Any suggestion? I need encapsulation on Account object and balance as Account's property
answer count: 1
type: UnansweredQuestion
tagged with: lua
score: 0
tagged with: proxy
tagged with: encapsulation
has answer: http://stackoverflow.com/a/77682477
has title: Proxy table to encapsulate an object in lua

http://stackoverflow.com/a/77784146
has body: combo is declared as a local variable inside the event handler, so every time it receives an event, it starts combo at 0. Instead, combo and startTime should be declared outside of the function. Some other small things are that tick() will be deprecated soon so os.time() should be used instead. Additionally, combo = combo + 1 can be shortened to combo += 1, and game:GetService("{serviceName}") is recommended over game.{serviceName}. Below, lastHit is used instead of startTime since it tracks the time of the last hit. The script after all these fixes: local combo = 0 local lastHit = os.time() game:GetService("ReplicatedStorage").Remotes.M1.OnServerEvent:Connect(function(player, Mouse) print("Received M1 from the Client") combo += 1 if os.time() - lastHit >= 2 then combo = 0 end lastHit = os.time() if combo == 3 then print("M1 Combo!") combo = 0 end print(combo) end)
downvote count: 0
score: 1
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77784019
answers question: http://stackoverflow.com/q/77784019
type: AcceptedAnswer

http://stackoverflow.com/q/77733769
tagged with: roblox-studio
score: 0
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/77734810
tagged with: lua
has title: Why function doesn't refresh
accepted answer: http://stackoverflow.com/a/77734810
has body: I created simple clock in Roblox Studio (Lua) and added wait(1) between while loop. The problem is that it doesn't refresh. It just shows time and it's everything. This is code: local StarterGui = game:GetService("StarterGui") while true do local UniversalTime = DateTime.now():ToUniversalTime() local Hours = UniversalTime.Hour + 1 local Minutes = UniversalTime.Minute local Seconds = UniversalTime.Second if (Minutes < 10) then Minutes = "0"..Minutes end if (Seconds < 10) then Seconds = "0"..Seconds end StarterGui.ScreenGui.Frame.Clock.Text = `{Hours}:{Minutes}:{Seconds}` wait(1) end I don't know what caused the problem and I don't really know how to repair it.
type: AnsweredQuestion
tagged with: roblox

meson-build
tag name: meson-build
type: Tag
tags question: http://stackoverflow.com/q/77625181

http://stackoverflow.com/q/77649718
has body: I am trying to use a Lua script to generate LaTeX commands. Here is a minimal lua script: my_array = { cmdone = {1, 2}, cmdtwo = {2, 3} } cmd_template = "\\newcommand*{\\%s}{number one: %s, number two: %s}" function mkcommands() for k, v in pairs(my_array) do -- print(string.format(cmd_template, k, v[1], v[2])) tex.print(string.format(cmd_template, k, v[1], v[2])) end end And here is the TeX file: \documentclass[12pt]{article} \usepackage{luacode} \begin{luacode} dofile("test.lua") mkcommands() \end{luacode} %\newcommand*{\cmdtwo}{number one: 2, number two: 3} %\newcommand*{\cmdone}{number one: 1, number two: 2} \begin{document} \cmdone \cmdtwo \end{document} When I run lualatex test.tex, I get Undefined control sequence l. 15 \cmdone. What am I doing wrong? Can this even be done? I used the commented "print" command in the lua code to show that what was being generated looked correct. I then pasted the generated \newcommand commands into the TeX file to verify that they were working--producing the expected output number one: 1, number two: 2 number one: 2, number two: 3 But it seems the print() and tex.print commands are producing different output.
has comment: http://stackoverflow.com/comment/136908113
type: Question
type: UnansweredQuestion
tagged with: latex
has answer: http://stackoverflow.com/a/77668768
has comment: http://stackoverflow.com/comment/136911901
has comment: http://stackoverflow.com/comment/136903451
has comment: http://stackoverflow.com/comment/136896536
tagged with: lua
answer count: 1
has title: Outputting LaTeX command from Lua script
tagged with: tex
score: 0

http://stackoverflow.com/comment/137002784
type: Comment
comment on: http://stackoverflow.com/q/77704605
type: QuestionComment
score: 0
has text: I want it to just perform its function, not necessarily to return something

http://stackoverflow.com/a/77760007
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77759455
type: Answer
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/77759455
score: 2
has body: (Updated with question edit) function performLookup(words, dict) for i, word in ipairs(words) do if dict[word] then words[i] = dict[word] end end end function readDict(fname) local dict = {} local file = io.open(fname, "r") for line in file:lines() do local english, german = line:match("(%S+)%s+(%S+)") -- or \t instead of %s+ for single tab, or \t+ if multiple tabs allowed dict[english] = german end file:close() return dict end function readInput(fname) local words = {} local file = io.open(fname, "r") for line in file:lines() do table.insert(words, line) end file:close() return words end function writeFile(fname, dict, words) file = io.open(fname, "w") performLookup(words, dict) for i, line in ipairs(words) do file:write((i == 1 and "" or "\n") .. line) end file:close() end dict = readDict("dict.tsv") words = readInput("locale_EN.txt") writeFile("locale_DE.txt", dict, words) The input file (locale_EN.txt) looks like: some random words eye and a few more face The output file (locale_DE.txt) looks like: some random words Auge and a few more Gesicht The dictionary (dict.tsv) looks like: body Körper child Kind eye Auge face Gesicht 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.
has comment: http://stackoverflow.com/comment/137087944

http://stackoverflow.com/a/77667326
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77659051
has body: local tab={ January = 31, February = 28, March = 31, April = 30, May = 31, June = 30, July = 31, August = 31, September = 30, October = 31, November = 30, December = 31 } local labels=player.PlayerGui.Computer.Window.CalenderWindow.DaysHandler:GetChildren() game.ReplicatedStorage.CurrentMonth.Changed:Connect(function(i) for _,label in(labels)do label.Visible=tonumber(label.Name)&lt;=tab[i] end end) local i=game.ReplicatedStorage.CurrentMonth.Value for _,label in(labels)do label.Visible=tonumber(label.Name)&lt;=tab[i] end

http://stackoverflow.com/comment/137072586
score: 0
type: QuestionComment
has text: 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. If you are interested, you can check what's happening under the hood using e.g., https://www.luac.nl/
comment on: http://stackoverflow.com/q/77745823
type: Comment

http://stackoverflow.com/comment/136933705
has text: The whole purpose of "cmd" is NEVER to execute the RHS as "normal". Otherwise, prefer "colon" notation.
comment on: http://stackoverflow.com/q/77671751
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/a/77761940
accepted answer of: http://stackoverflow.com/q/77761655
answers question: http://stackoverflow.com/q/77761655
has body: Does someone knows what I am doing wrong? arr[i][j] does not invoke getmetatable(arr).__index(arr, i, j) as you seem to be expecting it to. Rather, it invokes getmetatable(arr).__index(arr, i)[j]. So getmetatable(arr).__index, which resolves to array2d_get, is called with arr, i, not arr, i, j, which throws the error you're seeing. If this didn't throw an error, the return value of this would be indexed with j. Any clues on how to make it works? You might be tempted to try something like arr[i, j], but unlike some other languages, indexing in Lua only allows exactly a single value; this is a syntax error. I see 4 options to fix this: Getter Write a "get" "method" rather than "overloading" []. That "method" can take parameters i, j then: arr:get(i, j) desugars to getmetatable(arr)["get"](arr, i, j). You just need to set the metatable up such that getmetatable(arr)["get"] resolves to your array2d_get function (for example by setting __index = {get = array2d_get}). I would also argue that this is probably cleaner as you add methods to your 2d arrays. Otherwise, something like arr:push(42) will always first have to check whether "push" is a valid index, then resolve to the method if it isn't. This is also not great for performance (of method calls). Array of Arrays Move from your "2d array" userdata back to "1d array of 1d arrays", 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). "Row" Type You could make arr[y] return a "row" 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. Creating such "row" objects for every indexing operation might be a problem performance-wise, however. Compound Index Type 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 arr[{x, y}] or arr[Ind…
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/comment/137042880
comment on: http://stackoverflow.com/q/77734716
score: 2
type: QuestionComment
type: Comment
has text: 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.

http://stackoverflow.com/q/77772817
type: Question
score: 0
has answer: http://stackoverflow.com/a/77781316
tagged with: lua
type: UnansweredQuestion
has body: I made a script like this This is not a local script local folder = workspace.Coins local players = game:GetService("Players") function playerSpawned(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local coins = Instance.new("IntValue", leaderstats) coins.Name = "Coins" coins.Value = 100 for i, objects in pairs(folder:GetChildren()) do local button = Instance.new("ClickDetector") button.Parent = objects objects.ClickDetector.CursorIcon = "rbxassetid://7029597423" objects.ClickDetector.MouseClick:Connect(function() objects.ClickDetector.MaxActivationDistance = 0 objects.Transparency = 1 objects.CanCollide = false coins.Value = coins.Value + 10 wait(10) objects.ClickDetector.MaxActivationDistance = 300 objects.Transparency = 0 objects.CanCollide = true end) end end players.PlayerAdded:Connect(playerSpawned) How do I make it so that if one player takes a coin, the other does not get a coin in the leaderboard?
has title: The problem with the script for taking coins (Roblox Lua)
has answer: http://stackoverflow.com/a/77774157
answer count: 2
tagged with: roblox

http://stackoverflow.com/q/77659051
type: Question
answer count: 1
type: UnansweredQuestion
tagged with: lua
has body: 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 local player = game.Players.LocalPlayer local PlayerGUI = player.PlayerGui local Window = PlayerGUI.Computer.Window local DateWindow = Window.CalenderWindow local ReplicatedStorage = game:GetService("ReplicatedStorage") local DateNumbers = DateWindow.DaysHandler:GetChildren() local DaysInMonth = { January = 31, February = 28, March = 31, April = 30, May = 31, June = 30, July = 31, August = 31, September = 30, October = 31, November = 30, December = 31 } local Months = ReplicatedStorage.Months:GetChildren() local CurrentMonth = ReplicatedStorage.CurrentMonth.Value local monthSwitched = false for _, DayLabel in pairs(DateNumbers) do local dayNumber = tonumber(DayLabel.Name) if not monthSwitched and dayNumber > DaysInMonth[CurrentMonth] then for _, month in pairs(Months) do local daysInCurrentMonth = DaysInMonth[month.Name] CurrentMonth = month.Name monthSwitched = true break end end if dayNumber <= DaysInMonth[CurrentMonth] then DayLabel.Visible = true else DayLabel.Visible = false end end 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.
score: 0
tagged with: roblox
has answer: http://stackoverflow.com/a/77667326
has comment: http://stackoverflow.com/comment/136921633
tagged with: roblox-studio
has title: A script about a month changing system
has comment: http://stackoverflow.com/comment/136921595

http://stackoverflow.com/comment/137003224
type: Comment
has text: Then I'm clueless. Maybe share a screenshot of your setup after you called the function, as well as the code snippet you used.
comment on: http://stackoverflow.com/q/77704605
score: 0
type: QuestionComment

http://stackoverflow.com/q/77703599
has answer: http://stackoverflow.com/a/77707760
tagged with: lua
has title: Access request headers in envoy_on_response
score: 0
tagged with: envoyproxy
type: Question
answer count: 1
has body: 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.
type: UnansweredQuestion

http://stackoverflow.com/comment/137005713
comment on: http://stackoverflow.com/q/77711848
has text: If you type at a command line `love main.lua`, does it run?
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/136933971
score: 1
type: QuestionComment
has text: Right on the money. It was not a number. I added ´´´angleNumber = tonumber(angleNumber)´´´ and it worked. Thanks!
type: Comment
comment on: http://stackoverflow.com/q/77672280

http://stackoverflow.com/comment/136913960
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/77659298
score: 0
type: Comment

http://stackoverflow.com/q/77709503
has answer: http://stackoverflow.com/a/77711660
score: 0
tagged with: http://stackoverflow.com/tag/c
tagged with: lua
type: Question
has body: 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. typedef struct game_node_t game_node; typedef struct game_node_vector_t game_node_vec; struct game_node_t { const char *name; game_node* parent; game_node_vec children; enum GAME_NODE_TYPES type; void *data; }; 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: game.sound = ffi.metatype("game_node", sound_metatable) game.sprite = ffi.metatype("game_node", sprite_metatable) This would give the node types sounds and sprites their specific methods. The resulting error is "cannot change a protected metatable", which isn't surprising after reading LuaJIT's documentation. So far, I've only tried putting this in my cdef: typedef struct game_node_t game_sound_node; typedef struct game_node_t game_sprite_node; And doing this: game.sound = ffi.metatype("game_sound_node", sound_metatable) game.sprite = ffi.metatype("game_sprite_node", sprite_metatable) This still results in "cannot change a protected metatable". Are there any design changes or potential workarounds that I should consider?
type: UnansweredQuestion
tagged with: luajit
has title: With LuaJIT, how could I associate more than one metatable with a C struct?
answer count: 1

http://stackoverflow.com/comment/136974208
type: Comment
has text: @kos You still need `:` when calling `deposit`, `withdraw`, or `getBalance` because these methods define and use the `self` parameter.
score: 0
comment on: http://stackoverflow.com/a/77682477
type: AnswerComment

http://stackoverflow.com/comment/137072485
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/77748092
type: Comment
score: 0

http://stackoverflow.com/comment/136944845
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77622411
has text: Please provide `box.slab.stats()`.

http://stackoverflow.com/q/77743878
tagged with: roblox-studio
score: 0
tagged with: roblox
type: Question
answer count: 1
has body: 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. The 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 local hitbox = game.Workspace.SellBuildingHitbox hitbox.Touched:Connect(function(hit) local plrname = hit.Parent.Name if game.Players:FindFirstChild(plrname) then local plr = game.Players:FindFirstChild(plrname) plr.Stats.Stomach.Value = 0 end end) Thanks in advance!
type: UnansweredQuestion
has title: Script running but simply not doing what it says(no errors)
tagged with: lua
has answer: http://stackoverflow.com/a/78252059
tagged with: luau

http://stackoverflow.com/q/77755107
score: 0
has title: How to make a function repeat in lua, UE4SS
tagged with: lua
type: AnsweredQuestion
has body: So there is this code that I downloaded from nexus mods: local IDA, IDB local LightComponent function HookNewLight(ContextParam) local Context = ContextParam:get() LightComponent = Context:GetPropertyValue("PointLight") LightComponent:SetHiddenInGame(true, true) end RegisterHook("/Script/Engine.PlayerController:ClientRestart", function(Context, NewPawn) if IDA == nil then IDA, IDB = RegisterHook("/Game/Core/Characters/Player/AnathemaPlayerCharacter_BP.AnathemaPlayerCharacter_BP_C:Re ceiveBeginPlay", HookNewLight) end end) function ToggleVisibility() if(LightComponent and LightComponent:IsValid()) then local NewState = LightComponent:IsVisible() LightComponent:SetHiddenInGame(NewState, true) end end RegisterKeyBind(Key.F3, ToggleVisibility) 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: function CheckVisibility() if (LightComponent and LightComponent:IsValid() and LightComponent:IsVisible()) then ToggleVisibility() end -- Schedule the function to be called again after 0.1 seconds TimerManager:SetTimer(function() CheckVisibility() end, 0.1, false) end hooking into the actor ticks: RegisterHook("/Script/Engine.Actor:Tick", CheckVisibility) ,etc but none of them seems to work, usually it gives "attempt to index a nil value" error. I wonder if anyone knows how to make it repeat and could help.
has answer: http://stackoverflow.com/a/77755803
accepted answer: http://stackoverflow.com/a/77755803
tagged with: unreal-engine5
type: Question
answer count: 1

http://stackoverflow.com/q/77697425
has body: 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 There is how it looks like No typing Started typing I don't know if it useful, but I use next plugins for lsp: nvim-lspconfig mason.nvim mason-lspconfig.nvim Also nvchad configuration has auto setup for nvim-cmp and LuaSnip plugins. I didn't configure them manually
downvote count: 0
has title: How to trigger lsp suggestion popup in neovim?
has answer: http://stackoverflow.com/a/77697636
accepted answer: http://stackoverflow.com/a/77697636
upvote count: 2
tagged with: neovim-plugin
score: 2
tagged with: neovim
tagged with: nvim-lspconfig
type: Question
answer count: 1
tagged with: nvim.cmp
favorite count: 0
tagged with: lua
type: AnsweredQuestion

http://stackoverflow.com/a/78263624
score: 1
accepted answer of: http://stackoverflow.com/q/77769954
has body: You can define bg & fg of the color groups "AlphaShortcut, AlphaHeader, AlphaHeaderLabel, AlphaButtons, AlphaFooter" in your colorscheme config. Example using catppuccin colorscheme: return { "catppuccin/nvim", config = function() require("catppuccin").setup({ custom_highlights = function(colors) return { AlphaShortcut = { fg = colors.red, bg = colors.mauve }, AlphaHeader = { fg = colors.red, bg = colors.mauve }, } end, }) end }
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/77769954
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/77625181
has body: 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 "lua enabled" and "Dependency lua found: YES 5.1.4 (cached)" but shows "lua_enabled: -Denable_lua=false". Also I edited the meson_option.txt to "option('enable_lua', type: 'boolean', value: true, description: 'Enable Lua support')" and rebuild with "meson -Denable_lua=true --reconfigure build". Still when I run the test hello world lua script with the following command inside pktgen console: ./usr/local/bin/pktgen -- -m "[2:4].0" script test/hello-world.lua I get the error: User State for CLI not set for Lua, please build with Lua enabled meson_options.txt option('enable_lua', type: 'boolean', value: true, description: 'Enable Lua support') option('enable_gui', type: 'boolean', value: false, description: 'build the gui') option('enable_docs', type: 'boolean', value: false, description: 'build documentation') option('enable-avx', type: 'boolean', value: true, description: 'Try to compile with AVX support') option('enable-avx2', type: 'boolean', value: false, description: 'Try to compile with AVX2 support') option('only_docs', type: 'boolean', value: false, description: 'Only build documentation') meson.build project('pktgen', 'C', version: run_command(find_program('cat', 'more'), files('VERSION'), check:false).stdout().strip(), license: 'BSD', default_options: [ 'buildtype=release', 'default_library=static', 'warning_level=3', 'werror=true' ], meson_version: '>= 0.47.1' ) pktgen_conf = configuration_data() # set up some global vars for compiler, platform, configuration, etc. cc = meson.get_compiler('c') target = target_machine.cpu_family() if (target != 'riscv64') add_project_arguments('-march=native', language: 'c') endif if get_option('enable-avx') and cc.has_argument('-mavx') add_project_arguments('-mavx', language: 'c') endif if get_option('enable-avx2') and…
tagged with: lua
tagged with: ninja
has comment: http://stackoverflow.com/comment/136850179
has comment: http://stackoverflow.com/comment/136849692
answer count: 0
tagged with: centos
tagged with: meson-build
score: 0
has comment: http://stackoverflow.com/comment/136849995
has title: Pktgen console not enabling lua support, build with lua error
has comment: http://stackoverflow.com/comment/136849829
type: Question
tagged with: dpdk
type: UnansweredQuestion

http://stackoverflow.com/comment/137124322
has text: `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.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77766830

http://stackoverflow.com/q/77672280
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77672368
upvote count: 1
downvote count: 0
has body: 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. Am I overlooking some Lua syntax quirk? local function mirroredNumber (angleNumber) if angleNumber == 2 then return 8 elseif angleNumber == 3 then return 7 elseif angleNumber == 4 then return 6 elseif angleNumber == 6 then return 4 elseif angleNumber == 7 then return 3 elseif angleNumber == 8 then return 2 else return 99 end end 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.
has comment: http://stackoverflow.com/comment/136934076
answer count: 1
has title: Lua if statement always goes to else option
has comment: http://stackoverflow.com/comment/136933943
favorite count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/136933971
type: Question
has answer: http://stackoverflow.com/a/77672368
score: 1

http://stackoverflow.com/a/77734464
answers question: http://stackoverflow.com/q/77666088
score: 4
upvote count: 4
downvote count: 0
type: Answer
has body: 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 print(|) and the documentation popup goes away. Here's a link to the repo for a signature help source for nvim-cmp made by the developer of nvim-cmp. Add that plugin with your package manager of choice and add { name = 'nvim_lsp_signature_help' } to your list of sources in your nvim-cmp configuration: require'cmp'.setup { ... other settings ... sources = { ... other sources ... { name = 'nvim_lsp_signature_help' }, }, }

http://stackoverflow.com/comment/137038384
type: Comment
score: 0
has text: Can you print the value of `local response` after `HTTPService:PostAsync`?
comment on: http://stackoverflow.com/q/77726860
type: QuestionComment

http://stackoverflow.com/a/78252059
has body: If the variable is in the TAB menu then Stats is supposed to be named leaderstats If the variable is a Gui then change the text in the gui
score: 0
answers question: http://stackoverflow.com/q/77743878
type: Answer

http://stackoverflow.com/q/77666088
type: Question
downvote count: 0
score: 3
type: UnansweredQuestion
tagged with: nvim.cmp
favorite count: 0
has title: vscode-like suggestions in neovim
has answer: http://stackoverflow.com/a/78183112
tagged with: lua
answer count: 2
tagged with: neovim
tagged with: nvim-lspconfig
has body: I switched from vscode to neovim and am writing my own nvim config Recently I realized that I'm missing suggestions in brackets looking like this: I am using nvim-cmp and having troubles with looking the function's docs Could you help me please? Sorry for my poor english... I want to see pop-up menu with arguments of function (or just documentation) while I am typing args Now I configured nvim-cmp like this:
upvote count: 3
has answer: http://stackoverflow.com/a/77734464

vlc
type: Tag
tags question: http://stackoverflow.com/q/77734652
tag name: vlc
tags question: http://stackoverflow.com/q/77935205
tags question: http://stackoverflow.com/q/78658397
tags question: http://stackoverflow.com/q/78660017
tags question: http://stackoverflow.com/q/78633861
tags question: http://stackoverflow.com/q/78882864
tags question: http://stackoverflow.com/q/79503032

http://stackoverflow.com/a/77707760
has body: You can do this with a Lua filter by using the Dynamic Metadata object API. Here's an example below that will: read the x-my-header header from the request set a header x-my-header-is-a in the response according to x-my-header value: if x-my-header is A, it will set x-my-header-is-a: true otherwise, it will set x-my-header-is-a: false The trick here is to use the Dynamic Metadata struct to share things between envoy_on_request and envoy_on_response. With /etc/lua/filter.lua: function envoy_on_request(request_handle) -- store "x-my-header" in the dynamic metadata request_handle:streamInfo():dynamicMetadata():set("envoy.filters.http.lua", "x-my-header", request_handle:headers():get("x-my-header") ) end function envoy_on_response(response_handle) -- retrieve "x-my-header" from the dynamic metadata local my_header = response_handle:streamInfo():dynamicMetadata():get("envoy.filters.http.lua")["x-my-header"] -- insert your custom logic here; in this dummy example, set "x-my-header-is-a" according to "x-my-header" if my_header == "A" then response_handle:headers():add("x-my-header-is-a", "true") else response_handle:headers():add("x-my-header-is-a", "false") end end You can use it in your envoy config like this: http_filters: - name: envoy.filters.http.lua typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua default_source_code: filename: /etc/lua/filter.lua # other filters I've tested it with envoy v1.28.0, and it works perfectly: $ # test 1, no "x-my-header" header in the request $ curl -s -I localhost:8080 | grep "x-my-header-is-a" x-my-header-is-a: false $ # test 2, header "x-my-header" = "A" in the request $ curl -s -I -H "x-my-header: A" localhost:8080 | grep "x-my-header-is-a" x-my-header-is-a: true $ # test 3, header "x-my-header" != "A" in the request $ curl -s -I -H "x-my-header: B" localhost:8080 | grep "x-my-header-is-a" x-my-header-is-a: false Credit also goes to this answer here: https://github.com/envoyproxy/envoy/issues/4613#i…
answers question: http://stackoverflow.com/q/77703599
score: 0
type: Answer

http://stackoverflow.com/comment/136995899
score: 0
has text: What method are you trying to call? What would you expect it to return?
type: QuestionComment
comment on: http://stackoverflow.com/q/77704605
type: Comment

http://stackoverflow.com/q/77622411
type: Question
type: UnansweredQuestion
tagged with: lua
has title: Tarantool Cartridge "Memory is highly fragmented" errors
has comment: http://stackoverflow.com/comment/136951561
tagged with: tarantool
has comment: http://stackoverflow.com/comment/136951580
answer count: 1
tagged with: tarantool-cartridge
has body: I'm running a cluster with enough RAM per node, but nevertheless it's plagued by frequent "Memory is highly fragmented" 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 items and arena are near or above 99% > box.slab.info() --- - items_size: 1286313040 items_used_ratio: 99.56% quota_size: 6500000768 quota_used_ratio: 40.27% arena_used_ratio: 96.2% items_used: 1280601176 quota_used: 2617245696 arena_size: 2617245696 arena_used: 2516986968 ... I tried adjusting Vinyl memory and Vinyl cache, as well as changing memtx_min_tuple_size from 16 bits to 64, but it didn't affect the ratios. Could please someone explain how to increase items and arena size? or maybe there are other ways to fix this? With default value of fragmentation_threshold_critical = 0.85 this cluster should run with ~3 gigs of ram and still have some room items_used_ratio = items_used / items_size quota_used_ratio = quota_used / quota_size arena_used_ratio = arena_used / arena_size UPDATE: adding slab stats as requested box.slab.stats() --- - - mem_free: 16400 mem_used: 260224 item_count: 4066 item_size: 64 slab_count: 17 slab_size: 16384 - mem_free: 6072 mem_used: 10200 item_count: 75 item_size: 136 slab_count: 1 slab_size: 16384 - mem_free: 16128 mem_used: 52574976 item_count: 365104 item_size: 144 slab_count: 3232 slab_size: 16384 - mem_free: 156216 mem_used: 286979496 item_count: 1888023 item_size: 152 slab_count: 17646 slab_size: 16384 - mem_free: 2943632 mem_used: 423399040 item_count: 2646244 item_size: 160 slab_count: 26201 slab_size: 16384 - mem_free: 913912 mem_used: 405490008 item_count: 2413631 item_size: 168 slab_count: 12445 slab_size: 32768 - mem_free: 862448 mem_used: 288143152 item_count: 1637177 item_size: 176 slab_count: 8850 slab_size: 32768 - mem_free: 484712 mem_used: 170306168 item_count: 925577 item_size: 184 slab_count: 5230 slab_size: 32768 - mem_free: 53680 mem_used: 44456448 item_count:…
score: 0
has answer: http://stackoverflow.com/a/77981267
has comment: http://stackoverflow.com/comment/136944845

http://stackoverflow.com/comment/136883373
score: 0
has text: @luke100000, sorry I didn't get exactly. How to iterate and assign to transform_body.
type: Comment
comment on: http://stackoverflow.com/q/77634753
type: QuestionComment

http://stackoverflow.com/a/77743532
has body: Usually, when there are no errors or print messages, it means a few things: 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) 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) Here is the revised code, with comments, which may help you find the problem. print("The script ran!") -- Use this to figure out if the script is in a context where it can run, it probably can. local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local hum = character:WaitForChild("Humanoid") local animator = hum:WaitForChild("Animator") print("Animator was loaded!") -- Use this to know that :WaitForChild() didn't get stuck looking for character/humanoid/animator local tool = script.Parent local leftPunch = animator:LoadAnimation(script:WaitForChild("RookieLeftPunch")) local rightPunch = animator:LoadAnimation(script:WaitForChild("RookieRightPunch")) print("Animations were loaded!") -- Use this to know that :WaitForChild() didn't get stuck looking for your animations local currentPunch = 0 local debounce = false -- Using tool.equipped would be unreliable, as it would keep :Connecting tool.Activated every time it is equipped, which is not a good practice. -- Tool.activated only runs when the tool is equipped anyway, so it's more efficient tool.Activated:Connect(function() if debounce then return end debounce = true print("Current punch" .. currentPunch) -- More efficient way to debug and tells you if it's not 1, 2 or 3 if currentPunch == 0 then rightPunch:Play() task.wait(0.4) elseif currentPunch == 1 then leftPunch:Play() task.wait(0.4) elseif currentPunch == 2 then rightPunch:Play() task.wait(0.8) end if currentPunch == 2 then currentPunch = 0 else currentPunch += 1 end -- Safer and more efficient to put a single debounce = false at the end…
type: Answer
score: 0
answers question: http://stackoverflow.com/q/77669809

http://stackoverflow.com/q/77769954
tagged with: neovim
accepted answer: http://stackoverflow.com/a/78263624
has title: Custom highlighting of header in alpha starting screen plugin of nvim not working
tagged with: lazy-loading
score: 0
type: AnsweredQuestion
tagged with: plugins
tagged with: lua
has body: I want to change the color of the header in alpha.nvim dashboard. I can set it to predefined highlight groups(right now "Error") but I want to provide a custom hl_group. I use vim.cmd(hi custom guifg="hex" guibg="hex" gui="none") before dashboard.section.header.opts.hl = 'custom' but it sometimes works and sometimes doesn't. This is inside a alpha.lua where return { 'goolord/alpha-nvim', dependencies = { 'nvim-tree/nvim-web-devicons', 'BlakeJC94/alpha-nvim-fortune' }, config = function() local alpha = require("alpha") local dashboard = require("alpha.themes.dashboard") local fortune = require("alpha.fortune") math.randomseed(os.time()) local ascii_arts = {} dashboard.section.header.val = ascii_arts['pacman'] -- vim.cmd('hi custom <my values>') -- vim.cmd('hi custom') dashboard.section.header.opts.hl = "Error" -- custom dashboard.section.buttons.opts.hl = "Debug" dashboard.section.footer.opts.hl = "Conceal" dashboard.config.opts.noautocmd = true vim.cmd autocmd user alphaready echo 'ready' alpha.setup(dashboard.opts) also when I set dashboard.footer.opts.hl to "Custom" 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. When I vim.cmd('hi custom') 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 :hi custom in terminal and the result it xxx cleared 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.
has answer: http://stackoverflow.com/a/78263624
type: Question
tagged with: neovim-plugin
answer count: 1

http://stackoverflow.com/q/77736920
has body: So I am making data store for a simulator type game on roblox studio using luau and got this error which i cant crack. Heres the code local DataStoreService = game:GetService("DataStoreService") local CoinsStore = DataStoreService:GetDataStore("CoinsStore") game.Players.PlayerAdded:Connect(function(player) local stats = Instance.new("Folder", player) stats.Name = "Stats" local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local Coins = Instance.new("IntValue", leaderstats) Coins.Name = "Coins" local Rebirths = Instance.new("IntValue", leaderstats) Rebirths.Name = "Rebirths" local StomachMaxSpace = Instance.new("IntValue", stats) StomachMaxSpace.Name = "StomachMaxSpace" local Stomach = Instance.new("IntValue", stats) Stomach.Name = "Stomach" local UID = player.UserId --Load Data local data local success, errormessage = pcall(function() data = CoinsStore:GetAsync(UID) end) if success then Coins.Value = data.CoinsAmount StomachMaxSpace.Value = data.StomachCapacity Stomach.Value = data.Stomach end end) --save data game.Players.PlayerRemoving:Connect(function(player) local UID = player.UserId local data = { CoinsAmount = player.leaderstats.Coins.Value, StomachCapacity = player.Stats.StomachMaxSpace.Value, Stomach = player.Stats.Stomach.Value } local success, errormessage = pcall(function() CoinsStore:SetAsync(UID, data) end) if success then print("All Data Saved") end end) Please Help me solve the error because I need to get this game out Error: ServerScriptService.Script:36: attempt to index number with 'CoinsAmount'
tagged with: lua
has title: ServerScriptService.Script:36: attempt to index number with 'CoinsAmount' (Roblox Studio)
answer count: 1
type: UnansweredQuestion
score: 0
tagged with: roblox
type: Question
has answer: http://stackoverflow.com/a/77737067
tagged with: luau

http://stackoverflow.com/comment/136911901
type: Comment
score: 0
has text: 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().
type: QuestionComment
comment on: http://stackoverflow.com/q/77649718

http://stackoverflow.com/comment/137006900
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77705072
has text: Backslashes are shown by `util.dump`. They are absent in JSON. You can try `print(body:byte(1,-1))` to see all ASCII codes.
score: 0

http://stackoverflow.com/q/77648678
has body: To solve my concrete question (asked also on the Pandoc mailing list, which, unfortunatley, seems to be down due to spam mails at the moment) regarding using the Latex \sidecaption 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. The main question is, how can I access the values of the fields of a pandoc.Figure to rearrange them in the output through a custom writer; especially the fields content (image), caption and attr. 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. So far I got the following code: function Writer (doc, opts) local filter = { Figure = function (fig) local tester = '\\begin{figure*}\n' .. fig.content .. '\n\\end{figure*}\n' -- or/and fig.caption return pandoc.RawBlock('latex', tester) end } return pandoc.write(doc:walk(filter), 'latex', opts) end If I call the writer (together with my custom template) like this pandoc --template=mytemplate -t test-writer.lua ast-test.txt -o ast-test.tex, I get the error bad argument #2 to 'concat' (table expected, got string) for the line containing the code when called with fig.content; and the error attempt to concatenate a table value (field 'caption') when called with fig.caption; for the latter case I also tried fig.caption.long which also results in (table expected, got string). But when I call it without any fig. content, I get an empty {figure*} (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. The test file ast-test.txt only contains a few lines: --- title: A title --- # Einleitung Some text ![caption *to* an image](counter_plot_new_periods.png) Edit I tried an approach using a Lua filter instead of a Lua custom writer (inspired from this answer by @…
tagged with: lua
tagged with: pandoc
linked to: http://stackoverflow.com/q/77504584
tagged with: output
linked to: http://stackoverflow.com/q/66945893
favorite count: 0
upvote count: 2
tagged with: writer
score: 2
tagged with: figure
type: Question
downvote count: 0
has title: Access values of pandoc.Figure elements in pandoc.RawBlock with custom Lua writer
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/136977431
score: 0
type: AnswerComment
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/77697072

http://stackoverflow.com/comment/137075137
comment on: http://stackoverflow.com/a/77749562
score: 0
has text: That's a problem on your end then, view your scripts and try to fix, I can't examine any errors in the script.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/137039122
comment on: http://stackoverflow.com/q/77726860
has text: @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
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/77728192
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/137031944
tagged with: logitech
favorite count: 0
score: -2
tagged with: logitech-gaming-software
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77731735
has title: need help changing logitech script
downvote count: 3
tagged with: lua
has body: 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 function OnEvent(event, arg) if IsModifierPressed("lctrl") then repeat if IsMouseButtonPressed(1) then repeat PressMouseButton(1) Sleep(15) ReleaseMouseButton(1) until not IsMouseButtonPressed(1) end until not IsModifierPressed("lctrl") end end

http://stackoverflow.com/comment/136937915
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77671751
has text: @Matt ok thanks! Could you point me to the relevant API call that does this processing?
type: QuestionComment

http://stackoverflow.com/a/77737067
has body: I believe CoinsStore:GetAsync(UID) 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.
downvote count: 0
has comment: http://stackoverflow.com/comment/137049073
has comment: http://stackoverflow.com/comment/137048031
answers question: http://stackoverflow.com/q/77736920
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/137052180
type: Answer

lazy-loading
type: Tag
tag name: lazy-loading
tags question: http://stackoverflow.com/q/77769954
tags question: http://stackoverflow.com/q/78958369

http://stackoverflow.com/q/77707868
type: AnsweredQuestion
has title: how can i fix diagonal movement being faster than normal movement? (lua/love2d)
has answer: http://stackoverflow.com/a/77707912
accepted answer: http://stackoverflow.com/a/77707912
tagged with: love2d
type: Question
upvote count: 1
downvote count: 0
answer count: 1
score: 1
has body: When I move diagonally, the movement becomes faster, I know why this happens I just dont know how to fix it. function love.update(dt) if love.keyboard.isDown("w") then player.y = player.y - 75 * dt end if love.keyboard.isDown("s") then player.y = player.y + 75 * dt end if love.keyboard.isDown("d") then player.x = player.x + 75 * dt end if love.keyboard.isDown("a") then player.x = player.x - 75 * dt end end
favorite count: 0
tagged with: lua

http://stackoverflow.com/comment/136908113
comment on: http://stackoverflow.com/q/77649718
has text: I meant the `%` before `\newcommand` in your tex file.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/77759455
score: 0
type: Question
has title: How to replace words in file with dictionary and save it to the file?
has answer: http://stackoverflow.com/a/77760007
has comment: http://stackoverflow.com/comment/137087707
has body: A have a dictionary as dict = { body = "Körper", child = "Kind", eye = "Auge" face = "Gesicht" } And I have something like lookup function as: function performLookup(words, dict) for i, word in ipairs(words) do if dict[word] then words[i] = dict[word] end end end 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. Update: So, by having files dict.tsv and locale_EN.txt we creating a new locale file, but with accordingly replaced words in the file locale_DE.txt.
accepted answer: http://stackoverflow.com/a/77760007
tagged with: lookup
tagged with: lua
type: AnsweredQuestion
answer count: 1

http://stackoverflow.com/q/77748468
answer count: 2
has answer: http://stackoverflow.com/a/77755905
tagged with: roblox
tagged with: lua
score: 0
type: Question
has answer: http://stackoverflow.com/a/77749562
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137067431
has body: This is the script. I don't know why but it's only running once. local players = game:GetService("Players") local localplayer = players.LocalPlayer local char = localplayer.Character local hum = char:WaitForChild("Humanoid") local cam = game.Workspace.CurrentCamera local MenuCamera = game.Workspace.MenuRoom.MenuCamera hum.Died:Connect(function() wait(1.5) script.Parent.DeathScreen.Visible = true repeat cam.CameraType = Enum.CameraType.Scriptable until cam.CameraType == Enum.CameraType.Scriptable cam.CFrame = MenuCamera.CFrame wait(2) script.Parent.DeathScreen.Visible = false end) It just doesn't run the script when i die.
has title: ROBLOX. So, this function is only running once and i don't know why. Does anyone know why?

http://stackoverflow.com/q/77677453
has answer: http://stackoverflow.com/a/77681223
has body: This what I try: local data = { {cond1 = 'yes', cond2 = 'yes', nums = 7, results = 'no', average = 9.5}, {cond1 = 'yes', cond2 = 'no', nums = 12, results = 'no', average = 15}, {cond1 = 'no', cond2 = 'yes', nums = 18, results = 'yes', average = 26.5}, {cond1 = 'no', cond2 = 'yes', nums = 35, results = 'yes', average = 36.5}, {cond1 = 'yes', cond2 = 'yes', nums = 38, results = 'yes', average = 44}, {cond1 = 'yes', cond2 = 'no', nums = 50, results = 'no', average = 66}, {cond1 = 'no', cond2 = 'no', nums = 83, results = 'no'}, } function split_data(data, root_node, branch_node, root_condition_function, branch_condition_function) local true_node = {true_value = 0, false_value = 0} local false_node = {true_value = 0, false_value = 0} for _, entry in ipairs(data) do if root_condition_function(entry, root_node) then if branch_condition_function(entry, branch_node) then true_node.true_value = true_node.true_value + 1 else true_node.false_value = true_node.false_value + 1 end else if branch_condition_function(entry, branch_node) then false_node.true_value = false_node.true_value + 1 else false_node.false_value = false_node.false_value + 1 end end end return true_node, false_node end -- Statement for root node/string node local function root_string_condition(entry, root_node) return entry[root_node] == 'yes' end -- Statement for numeric root node local function root_numeric_condition(entry, root_node, branch_node) local nums = entry[root_node] local average = entry[branch_node] -- Check for nil values if nums == nil or average == nil then return false end return tonumber(nums) < tonumber(average), tonumber(nums) >= tonumber(average) end -- Statement for branch node local function branch_condition(entry, branch_node) return entry[branch_node] == 'yes' end -- Example usage for string condition local trueNodeStr, falseNodeStr = split_data(data, 'cond1', 'results', root_string_condition, branch_condition) -- Print the results for string condition print("String Condition Results:"…
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/136942842
has comment: http://stackoverflow.com/comment/136946542
has title: How to pass dynamic statement into function?
accepted answer: http://stackoverflow.com/a/77681223
tagged with: lua
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/136946197

http://stackoverflow.com/a/77981267
has body: Could please someone explain how to increase items and arena size? They are increased automatically. 99% of items_used_ratio and arena_used_ratio is fine so long as quota_used_ratio is low (40% in your case). Actually it was a bug in the code that raises the warning, it was fixed in cartridge version 2.7.9.
answers question: http://stackoverflow.com/q/77622411
score: 0
type: Answer

http://stackoverflow.com/comment/136921595
type: QuestionComment
type: Comment
has text: 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".
score: 0
comment on: http://stackoverflow.com/q/77659051

http://stackoverflow.com/q/77761655
type: AnsweredQuestion
has title: 2d array access with lua userdata
has body: I am trying to write a lua library providing 2d arrays with the C api. I have followed the tutorial available on the lua website where it is demonstrated how to implement 1d arrays. To 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. Here's the C code: #include <lauxlib.h> #include <lua.h> typedef struct Array2d { size_t height, width; int data[]; } Array2d; static int array2d_get(lua_State *L) { Array2d *arr = lua_touserdata(L, 1); size_t x = luaL_checkinteger(L, 2) - 1; size_t y = luaL_checkinteger(L, 3) - 1; luaL_argcheck(L, arr != NULL, 1, "'array' expected"); luaL_argcheck(L, x >= 0 && x < arr->width, 2, "x is not in [1,width]"); luaL_argcheck(L, y >= 0 && y < arr->height, 3, "y is not in [1,height]"); lua_pushinteger(L, arr->data[x + y * arr->width]); return 1; } static int array2d_size(lua_State *L) { Array2d *arr = lua_touserdata(L, 1); luaL_argcheck(L, arr != NULL, 1, "'array' expected"); lua_pushinteger(L, arr->width * arr->height); return 1; } static int array2d_new(lua_State *L) { size_t width = luaL_checkinteger(L, 1); size_t height = luaL_checkinteger(L, 2); size_t nbytes = sizeof(Array2d) + width * height * sizeof(int); Array2d *arr = lua_newuserdata(L, nbytes); arr->width = width; arr->height = height; luaL_getmetatable(L, "lib.arr"); lua_setmetatable(L, -2); for (int i = 0; i < width * height; i++) { arr->data[i] = 0; } return 1; } static const struct luaL_Reg libarr_f[] = {{"new", array2d_new}, {NULL, NULL}}; static const struct luaL_Reg libarr_m[] = { {"__index", array2d_get}, {"__len", array2d_size}, {NULL, NULL}}; int luaopen_libarr(lua_State *L) { luaL_newmetatable(L, "lib.arr"); luaL_setfuncs(L, libarr_m, 0); luaL_newlib(L, libarr_f); return 1; } And here is the lua code: local libarr = require "libarr" local width=3 local height=3 arr = libarr.new(width,height) for i=1,width do for j=1,height do p…
answer count: 1
accepted answer: http://stackoverflow.com/a/77761940
score: 0
type: Question
tagged with: lua-userdata
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/77761940
tagged with: lua

http://stackoverflow.com/q/77719576
has comment: http://stackoverflow.com/comment/137036694
has comment: http://stackoverflow.com/comment/137017819
type: Question
upvote count: 1
answer count: 1
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
tagged with: error-handling
favorite count: 0
tagged with: lua
tagged with: ffi
downvote count: 0
has comment: http://stackoverflow.com/comment/137018382
has answer: http://stackoverflow.com/a/77721366
tagged with: debugging
score: 1
has body: Hello Stack Exchange Community, 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. The primary snippet causing the issue involves an xpcall function in Lua that wraps a C function call: xpcall(function() ffiC.gkyl_range_init(r, r._ndim, r._lower, r._upper) end, function() print("Error in gkyl_range_init") end) Despite using xpcall 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. **Specifically, my challenge is: ** Obscured C Errors: Even with xpcall, 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. **An Alternative Approach I've Considered: ** Using GDB for debugging: I've attempted to debug the code using GDB. However, the backtrace provided within GDB seems limited, indicating "No stack" 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. **Seeking Solutions: ** 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 wo…
has title: Trouble Interfacing Errors Between C and Lua: Seeking Solutions

http://stackoverflow.com/comment/136991235
has text: 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)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77704125
score: 0

http://stackoverflow.com/comment/137005180
score: 0
type: QuestionComment
has text: `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).
comment on: http://stackoverflow.com/q/77712275
type: Comment

http://stackoverflow.com/a/77734810
type: AcceptedAnswer
type: Answer
has body: StarterGui replicates to the client as PlayerGui. They'll only see changes as the player if you update the value from there. 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. Alternatively, if you want to keep using DateTime (which is also fine), you can set up your clock underneath StarterGui as you do here, but change your definition (and your var name appropriately) so that it will reference the PlayerGui 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. local gui = script.Parent -- will reference `PlayerGui` after client replication while true do local UniversalTime = DateTime.now():ToUniversalTime() [. . .] gui.ScreenGui.Frame.Clock.Text = `{Hours}:{Minutes}:{Seconds}` wait(1) end Side note: I recommend looking into the task library to find better ways of executing this with threading. Specifically, spawn; a simple change that will lead to better practice.
score: 0
accepted answer of: http://stackoverflow.com/q/77733769
answers question: http://stackoverflow.com/q/77733769

http://stackoverflow.com/q/77662875
type: UnansweredQuestion
has body: 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.) 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. This is the code I have for it. local entity = script.Parent local speed = 10 local player = game.Players.LocalPlayer local function chasePlayer() local humanoid = player.Character:FindFirstChild("Humanoid") if humanoid then local targetPosition = humanoid.RootPart.Position local direction = (targetPosition - entity.Position).unit entity.Velocity = direction * speed end end entity.Touched:Connect(function(otherPart) local character = otherPart.Parent local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid.Health = 0 end end) game:GetService("RunService").Heartbeat:Connect(chasePlayer) I would like for someone to correct this code as I have tried countless times to get it to work but have failed miserably. 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.
tagged with: roblox
score: 0
has comment: http://stackoverflow.com/comment/136921628
tagged with: lua
has title: I can't make an entity. (Roblox)
answer count: 1
has answer: http://stackoverflow.com/a/77762204
type: Question

http://stackoverflow.com/comment/137435332
score: 0
has text: Can you copy the relevant info as a quote, inline to the Answer, in case the link becomes broken?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77943526

http://stackoverflow.com/comment/136953269
score: 0
has text: your code gave correct results for current data, Nums True - True Value: 0, False Value: 1 Nums 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 Nums False - True Value: 3, False Value: 4, but its gave Nums True - True Value: 0, False Value: 2 Nums False - True Value: 3, False Value: 2. why its happend?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77681223

tcpserver
tag name: tcpserver
tags question: http://stackoverflow.com/q/77766830
type: Tag

http://stackoverflow.com/comment/139393071
has text: Well, I'll give it a try and let you know what I find out and I'll accept your answer if it works.
comment on: http://stackoverflow.com/a/79049650
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/77774157
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77772817
has body: You should move the for loop outside of the function.

http://stackoverflow.com/a/77681223
has comment: http://stackoverflow.com/comment/136953269
answers question: http://stackoverflow.com/q/77677453
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/136953415
has body: Given this call: local trueNodeNum, falseNodeNum = split_data(data, 'nums', 'results', root_numeric_condition, branch_condition) split_data only passes two arguments to root_numeric_condition (root_condition_function) if root_condition_function(entry, root_node) then where three are expected: local function root_numeric_condition(entry, root_node, branch_node) So in root_numeric_condition local average = entry[branch_node] will always be nil, and the function will always return false. Given the variable name, it looks like you are actually trying to access the average field of the entry table, but return tonumber(nums) &lt; tonumber(average), tonumber(nums) &gt;= tonumber(average) the multiple return values of root_numeric_condition and the use of tonumber on what one would expect to already be numbers makes it rather unclear what your intentions are. As a start, split_data can be refactored into: local function split_data(data, root, branch, root_condition, branch_condition) local results = { { true_value = 0, false_value = 0 }, { true_value = 0, false_value = 0 } } for _, entry in ipairs(data) do local b1 = root_condition(entry, root) and 1 or 2 local b2 = branch_condition(entry, branch) and 'true_value' or 'false_value' results[b1][b2] = 1 + results[b1][b2] end return results[1], results[2] -- or table.unpack(results) end And purely based on your expectations, one would assume something like local function root_numeric_condition(entry, root) return not entry.average or entry[root] &gt; entry.average end
has comment: http://stackoverflow.com/comment/136955552
accepted answer of: http://stackoverflow.com/q/77677453

http://stackoverflow.com/comment/136985301
has text: 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`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77696861
type: Comment

http://stackoverflow.com/a/77672226
answers question: http://stackoverflow.com/q/77671751
has body: "cmd" notation is not a replacement but alternative. Usually, the RHS of a mapping is processed as if (well, almost) typed. However, any "cmd"-thing is being processed much like as a script. Therefore, you are supposed to strip "cmd" and "cr" off and pass it onto execute, not normal. Of course, after make sure that there is no other <key> notation left.
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/comment/136936661
type: Comment
has text: 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.
score: 0
comment on: http://stackoverflow.com/q/77671751
type: QuestionComment

http://stackoverflow.com/comment/137022575
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77716591
score: 0
has text: 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.

http://stackoverflow.com/comment/137037207
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77726860
type: QuestionComment
has text: 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?

http://stackoverflow.com/comment/136942842
has text: Aren't you trying to pass on `'average'`?
score: 0
comment on: http://stackoverflow.com/q/77677453
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/136979041
comment on: http://stackoverflow.com/a/77697636
score: 0
has text: Thanks, it works! Missed that `cmp.mapping.complete()` mapping in `configs/cmp.lua`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/137042888
type: Comment
type: QuestionComment
has text: 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.
score: 1
comment on: http://stackoverflow.com/q/77734716

http://stackoverflow.com/q/77714746
tagged with: lua
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77716591
tagged with: roblox-studio
accepted answer: http://stackoverflow.com/a/77716591
score: 0
tagged with: roblox
type: Question
has title: Roblox Studio: Attempt to index nil with 'Connect'
answer count: 1
has body: I am doing a script and output says this " Workspace.Script:30: attempt to index nil with 'Connect' ". The error is on line 30 that has this code: players.PlayerAdded:Connect(function(player) -- line 30 if player.UserId == alertaCorUserId then alertaCorEvent:FireClient(player, true) else alertaCorEvent:FireClient(player, false) end end) I tried a lot of things, but nothing are working. All help is welcome. I will put here the whole script local players = game:GetService("Players"):GetPlayers() if #players > 0 then local alertaCorUserId = players[math.random(1, #players)].UserId local ReplicatedStorage = game:GetService("ReplicatedStorage") local alertaCorEvent = ReplicatedStorage:FindFirstChild("AlertaCorEvent") if not alertaCorEvent then alertaCorEvent = Instance.new("RemoteEvent") alertaCorEvent.Name = "AlertaCorEvent" alertaCorEvent.Parent = ReplicatedStorage end if alertaCorEvent then players.PlayerAdded:Connect(function(player) if player.UserId == alertaCorUserId then alertaCorEvent:FireClient(player, true) else alertaCorEvent:FireClient(player, false) end end) alertaCorEvent.OnServerEvent:Connect(function(player, isAlertaCor) if isAlertaCor then print(player.Name .. " is Alerta Cor!") else print(player.Name .. " isn't Alerta Cor!") end end) else warn("Erro: alertaCorEvent is nil.") end else warn("No players to be selected") end

http://stackoverflow.com/q/77757772
has answer: http://stackoverflow.com/a/77762074
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/77762074
score: 0
type: AnsweredQuestion
tagged with: lua
tagged with: fennel
tagged with: hammerspoon
has body: I'm trying to convert some Hammserspoon Lua code to Fennel, but the converted code is throwing the following error. ERROR: LuaSkin: hs.hotkey callback: init.fnl:32: attempt to call a table value stack traceback: init.fnl:32: in function <init.fnl:23>``` The Lua code is working without issue, here it is - local myModal = hs.hotkey.modal.new() hs.hotkey.bind({}, 'F18', function() myModal:enter() end) myModal:bind('', 'V', function() myModal:exit() hs.alert.show("Modal test") end) And, here's the converted code that is giving the error. (local myModal (hs.hotkey.modal.new)) (print (.. "myModal = " (hs.inspect.inspect myModal))) (myModal:entered (fn [] (print "myModal entered"))) (myModal:exited (fn [] (print "myModal exited"))) (hs.hotkey.bind {} "F18" (fn [] (myModal:enter))) (myModal:bind "" "V" (fn [] ((myModal:exit) (hs.alert.show "Modal Test") ))) Not sure why the error is generate here. Can anyone help with identifying the issue with this? The error is coming from the following bit. (hs.hotkey.bind {} "F18" (fn [] (myModal:enter))) I had used hs.inspect to check myModal and here's the output from it. myModal = { keys = {} }
has title: How to configure hs.hotkey.modal with Fennel in hammerspoon?

http://stackoverflow.com/a/77676408
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/77639707
has body: First I think you could have just assigned the body to transform_body = {}. that way you do not need to do any manipulation. But in an event you needed to manipulate the data that is returned from the request body. Here are couple of options. Lets say you want to flatten your data to be Tid | Year | Language Id | City | TName Then I will write that like this. local transform_body = function ( body ) local theatreInformation = {}; local theatreInfo = body["TheatreInfo"]; if theatreInfo then local information = { tid = theatreInfo.tId, tname = theatreInfo.tname year = body.year, languageid = body.languageId, city = body.city }; table.insert( threatreInformation, information ); end return theatreInformation; end local bodyData = transform_body( body ); This will transform your data into the format below tid | tname | year | languageid | city 123 | inox | 2023 | 2 | Banglore 124 | inox | 2023 | 2 |Banglore

http://stackoverflow.com/q/77711848
score: 1
has comment: http://stackoverflow.com/comment/137005713
has title: Love2D does not run in VSC
tagged with: environment-variables
tagged with: lua
type: Question
upvote count: 1
answer count: 1
type: UnansweredQuestion
tagged with: visual-studio-code
favorite count: 0
has answer: http://stackoverflow.com/a/77943526
has body: 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 "Undefined global love"? Can someone help me find an answer? This program does run by drag and drop as well 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?) Edit 2: Here is the code instead. I would just like the answer to this question: function love.load() love.window.setTitle("Hello LÖVE") love.graphics.setNewFont(24) end function love.draw() love.graphics.printf("Welcome to LÖVE", 0, love.graphics.getHeight() / 2 , love.graphics.getWidth(), "center") end
tagged with: love2d
downvote count: 0

http://stackoverflow.com/q/77748092
has comment: http://stackoverflow.com/comment/137072485
answer count: 2
tagged with: lua
has title: How to check the value from a NumberValue
has answer: http://stackoverflow.com/a/77769766
type: Question
type: UnansweredQuestion
tagged with: roblox
has answer: http://stackoverflow.com/a/77751429
score: 0
tagged with: luau
has body: 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. I tried: if NumberValue.Value == 5 then print("It worked!") I also tried to put the script into SeverScriptService, Workspace or ReplicatedsStorage but it didn't work :(

http://stackoverflow.com/a/77755905
type: Answer
has comment: http://stackoverflow.com/comment/137086339
answers question: http://stackoverflow.com/q/77748468
downvote count: 0
score: 1
has body: This looks to be in PlayerGui, for which I'm assuming you've got ResetOnSpawn 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 Player.CharacterAdded. 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. Thanks to Kylaaa for pointing out that by the time the script executes, the CharacterAdded event might have already been fired. I typically handle this with a flag (for client) or some transient table (for server). local players = game:GetService("Players") local localplayer = players.LocalPlayer local cam = game.Workspace.CurrentCamera local MenuCamera = game.Workspace.MenuRoom.MenuCamera local playerAlreadyLoaded = player.Character -- store for use later local function handleDeath(char) local hum = char:WaitForChild("Humanoid") hum.Died:Connect(function() wait(1.5) script.Parent.DeathScreen.Visible = true repeat cam.CameraType = Enum.CameraType.Scriptable until cam.CameraType == Enum.CameraType.Scriptable cam.CFrame = MenuCamera.CFrame wait(2) script.Parent.DeathScreen.Visible = false end) end localplayer.CharacterAdded:Connect(handleDeath) if playerAlreadyLoaded then handleDeath(playerAlreadyLoaded) end If the goal of the repeat until 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. local players = game:GetService("Players") local localplayer = players.LocalPlayer local cam = game.Workspace.CurrentCamera local MenuCamera = game.Workspace.MenuRoom.MenuCamera local playerAlreadyLoaded = player.Character -- store for use later localplayer.CharacterAdded:Connect(function(char) lo…
upvote count: 1

http://stackoverflow.com/comment/136849995
type: Comment
has text: Try to remove the first item in array `lua_names = ['lua', ...`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77625181

http://stackoverflow.com/q/77645389
has answer: http://stackoverflow.com/a/77645447
type: Question
score: 2
downvote count: 0
favorite count: 0
upvote count: 2
has body: The example in https://www.lua.org/pil/2.4.html shows: page = [[ <TITLE>An HTML Page Lua a text between double brackets ]] however this gives me an error on the / in . lua54: html.lua:9: unexpected symbol near '/' has something changed since the book was published?
accepted answer: http://stackoverflow.com/a/77645447
type: AnsweredQuestion
tagged with: lua
has title: strings with nested strings in lua?
answer count: 1

figure
tag name: figure
type: Tag
tags question: http://stackoverflow.com/q/77648678

http://stackoverflow.com/comment/136955552
type: AnswerComment
type: Comment
has text: 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
comment on: http://stackoverflow.com/a/77681223
score: 0

http://stackoverflow.com/comment/137084563
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77755513
type: Comment
has text: 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.

output
tags question: http://stackoverflow.com/q/77648678
type: Tag
tag name: output

http://stackoverflow.com/comment/137042940
has text: "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.
score: 0
comment on: http://stackoverflow.com/q/77734716
type: QuestionComment
type: Comment

encapsulation
tag name: encapsulation
tags question: http://stackoverflow.com/q/77681606
type: Tag

http://stackoverflow.com/a/77711120
type: AcceptedAnswer
type: Answer
has body: local toolPart = script.Parent local swung = false local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEventFolder = ReplicatedStorage.RemoteEvents local UpdateMoneyEvent = RemoteEventFolder.UpdateMoney local touchingParts = toolPart.Handle:GetTouchingParts() local toolPart = script.Parent MINING_TIME = 1 local function onTouch(partTouched) -- Check if the touched part is named "Coal" if partTouched.Name == "Coal" then _+=1;while not __ do __=_ while wait(MINING_TIME)and _&gt;0 do UpdateMoneyEvent:FireServer(100) print("Tool activated and touching a part named Coal!") end;__=___;end end end toolPart.Handle.Touched:Connect(onTouch) toolPart.Handle.TouchEnded:Connect(function()_-=1;end)_=0
answers question: http://stackoverflow.com/q/77709322
score: 0
accepted answer of: http://stackoverflow.com/q/77709322

http://stackoverflow.com/comment/136946197
comment on: http://stackoverflow.com/q/77677453
type: Comment
has text: 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.
type: QuestionComment
score: 0

centos
type: Tag
tags question: http://stackoverflow.com/q/77625181
tag name: centos

http://stackoverflow.com/a/77716591
has body: game:GetService("Players") is the player service, game:GetService("Players"):GetPlayers() is a table with all connected players. You want to connect an event to the service, not to that table.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/77714746
has comment: http://stackoverflow.com/comment/137022575
answers question: http://stackoverflow.com/q/77714746

http://stackoverflow.com/comment/137048031
comment on: http://stackoverflow.com/a/77737067
type: AnswerComment
type: Comment
score: 0
has text: The error is not appearing on that line unfortunately. The error appears at the code Coins.Value = data.CoinsAmount

http://stackoverflow.com/q/77700378
has title: (Roblox) Is the lobby in the same map as the main game?
score: 0
type: Question
has answer: http://stackoverflow.com/a/77707080
type: UnansweredQuestion
tagged with: roblox
has answer: http://stackoverflow.com/a/77711009
has body: 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. I haven't done anything about this issue, I'm waiting for something from someone who can help me in this beginning.
answer count: 2
tagged with: lua

http://stackoverflow.com/a/77751429
score: 0
has body: Have you defined "NumberValue" yet? Have you put it in a forever loop with a task.wait(0) line? normally this script would work in workspace local NumberValue = workspace.Value --define NumberValue (replace it with where the number value is) while task.wait(0) do --repeat forever but wait a frame each time if NumberValue.Value == 5 then print("It worked!") end end
type: Answer
answers question: http://stackoverflow.com/q/77748092

http://stackoverflow.com/a/77644474
upvote count: 1
downvote count: 0
has body: You can use any json to lua library, for example https://github.com/rxi/json.lua json = require "json" local tabl = json.decode('[1,2,3,{"x":10}]') -- Returns { 1, 2, 3, { x = 10 } }
answers question: http://stackoverflow.com/q/77634753
score: 1
type: Answer

ninja
tag name: ninja
type: Tag
tags question: http://stackoverflow.com/q/77625181

http://stackoverflow.com/a/77769346
score: 1
type: AcceptedAnswer
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77766830
answers question: http://stackoverflow.com/q/77766830
has body: I suggest using a multithreaded library, such as Lanes. If you only want to use LuaSocket, you need to follow the order below (pseudocode): while 1 do server:accept() ... for i,client in ipairs(clients) do client:receive() ... client:send() ... end end You can use socket.select 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: local recvt, sendt, err = socket.select(clients, clients, 0.01) if not err then if recvt then -- Calling receive on clients in this table will immediately return. for k,c in ipairs(recvt) do local line, err = c:receive() end end if sendt then -- Same as recvt for k,c in ipairs(sendt) do end end end
downvote count: 0

http://stackoverflow.com/comment/136937173
comment on: http://stackoverflow.com/q/77669809
type: QuestionComment
has text: 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.
type: Comment
score: 0

http://stackoverflow.com/comment/137039624
comment on: http://stackoverflow.com/q/77726860
has text: Which way of `if` it goes? The correct one?
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/a/77668768
has body: It turns out that my problem was scope. When I used Lua to generate \newcommand commands inside a \begin{luacode} ... \end{luacode} environment, those commands disappeared when the environment ended. The fix was to use \directlua instead of the environment. With the same Lua file, this TeX file works: \documentclass[12pt]{article} \usepackage{luacode} \directlua{dofile("test.lua") mkcommands()} \begin{document} \cmdone \cmdtwo \end{document}
answers question: http://stackoverflow.com/q/77649718
type: Answer
score: 0

http://stackoverflow.com/comment/137071590
score: 0
comment on: http://stackoverflow.com/q/77745823
type: QuestionComment
has text: @ESkri absolutely the same? like, no slight performance boost in one compared to the other?
type: Comment

http://stackoverflow.com/comment/137005208
type: Comment
has text: 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`).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77712275

http://stackoverflow.com/comment/137040805
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77726860
type: Comment
has text: It prints 404, as it should (so else)

http://stackoverflow.com/comment/136934076
type: QuestionComment
score: 1
type: Comment
has text: Alright, elaborated on the pitfalls in my answer.
comment on: http://stackoverflow.com/q/77672280

environment-variables
tag name: environment-variables
type: Tag
tags question: http://stackoverflow.com/q/77711848
tags question: http://stackoverflow.com/q/77846650
tags question: http://stackoverflow.com/q/79263801

http://stackoverflow.com/a/77707912
accepted answer of: http://stackoverflow.com/q/77707868
answers question: http://stackoverflow.com/q/77707868
upvote count: 4
score: 4
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: The solution lies in some simple vector math. Let's calculate the dir to move in from the pressed keys: local d = {x = 0, y = 0} -- direction to move in if love.keyboard.isDown("w") then d.y = d.y - 1 end if love.keyboard.isDown("s") then d.y = d.y + 1 end if love.keyboard.isDown("d") then d.x = d.x + 1 end if love.keyboard.isDown("a") then d.x = d.x - 1 end Now, you might get a diagonal direction like {x = 1, y = 1} 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 "straight", you get just 1. Thus, you'll be going about sqrt(2) times faster if going diagonally. We can fix this by "normalizing" 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): local length = math.sqrt(d.x^2 + d.y^2) if length > 0 then d.x = d.x / length d.y = d.y / length end now just scale this with the desired speed, and apply it: local speed = 75 player.x = player.x + speed * d.x player.y = player.y + speed * d.y (Note: this gives you fractional x / y coordinates; I expect your drawing code to deal with those properly.)

http://stackoverflow.com/comment/136896536
comment on: http://stackoverflow.com/q/77649718
type: QuestionComment
score: 0
type: Comment
has text: Doesn't `%` start a comment in latex?

http://stackoverflow.com/q/77704125
tagged with: lua
has comment: http://stackoverflow.com/comment/136991832
has comment: http://stackoverflow.com/comment/136991235
type: Question
has title: Pass ambiguous rows into table in Lua
type: UnansweredQuestion
has body: I'm a little confused in Lua. I want to take 3 headers in an unspecified row index and transfer them to the table. In order not to ramble too much, I will give some of the lines as examples instead of the code I use. uptade = [[Microsoft Visual C++ 2008 Redistributable - … Microsoft.VCRedist.2008.x64 9.0.30729.6161 winget Java 8 Update 391 {71324AE4-039E-4CA4-87B4-2F32180391F0} 8.0.3910.13 Update for Windows 10 for x64-based Systems … {7B63012A-4AC6-40C6-B6AF-B24A84359DD5} 8.93.0.0 Microsoft Visual C++ 2008 Redistributable - … {8220EEFE-38CD-377E-8595-13398D740ACE} 9.0.30729 GiliSoft Screen Recorder Pro {85B92051-32EF-61AA-AB7C-24B0B2DB29AC}_is1 13.0.0 Security Update for Microsoft Office 2016 (K… {90160000-0011-0000-0000-0000000FF1CE}_Offic… Unknown ]] -- result resTbl = { {"Microsoft Visual C++ 2008 Redistributable", "9.0.30729.6161","winget"}, {"Java 8 Update 391", "8.0.3910.13",""}, {"Update for Windows 10 for x64-based Systems","8.93.0.0", ""}, {"Microsoft Visual C++ 2008 Redistributable", "9.0.30729", ""}, {"GiliSoft Screen Recorder Pro", "13.0.0", ""}, {"Security Update for Microsoft Office 2016", "Unknown", ""}} How can I parse this into a table? EDIT: Until a better solution comes along, here is the solution I found: I printed the CMD output to a ".cvs" file. I realized that; at certain intervals as "Name..Id..Version..Available..Source " (string.sub(1,39) -->>40,78..79,98..99,113..114,125..) is listed. I read with these intervals and transferred each row to a table in 5 sections. s1=line:sub(1,39) s2=line:sub(40,78)... aa2 = {s1,s2,s3,s4,s5} listTbl1[#listTbl1 + 1] = aa2 print(listTbl1[1][1].."---"..listTbl1[1][2]) The only problem is that CMD remains visible on the screen for 8-12 seconds, depending on the number of programs. If anyone has a better solution, please reply. Thanks.
score: 0
answer count: 0

http://stackoverflow.com/comment/136991832
comment on: http://stackoverflow.com/q/77704125
score: 0
has text: @Luke100000 , thanks.. Please state your recommendation in the code. "line:match" shows an error in the line you gave.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/77765418
score: -1
tagged with: lua
has title: What can I do to stop running the script when I release the left button?
answer count: 1
tagged with: logitech
downvote count: 1
type: Question
tagged with: logitech-gaming-software
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77781597
has body: EnablePrimaryMouseButtonEvents(true); function OnEvent(event, arg) if IsKeyLockOn("capslock") and IsMouseButtonPressed(1) and IsMouseButtonPressed(3) then repeat PressMouseButton(1) Sleep(13) ReleaseMouseButton(1) Sleep(15) PressMouseButton(1) Sleep(18) ReleaseMouseButton(1) Sleep(12) PressMouseButton(1) Sleep(14) ReleaseMouseButton(1) Sleep(16) until not IsMouseButtonPressed(3) end end
favorite count: 0
upvote count: 0

http://stackoverflow.com/comment/137030480
type: AnswerComment
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/77721366
score: 0

logic
tag name: logic
type: Tag
tags question: http://stackoverflow.com/q/77709322

http://stackoverflow.com/comment/136921628
has text: [`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, ...)?
type: Comment
comment on: http://stackoverflow.com/q/77662875
type: QuestionComment
score: 0

http://stackoverflow.com/a/77769766
score: 1
type: Answer
answers question: http://stackoverflow.com/q/77748092
upvote count: 1
downvote count: 0
has body: You're on the right track but the issue is that your code executes once and then never checks again. 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 : -- find the NumberValue Instance local NumberValue = game.Workspace.NumberValue -- listen for when it changes NumberValue.Changed:Connect(function(newValue) print("NumberValue update to", newValue) if newValue == 5 then print("It worked!") end end) Then, whenever something changes the Value, you should see this message appear. 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.

http://stackoverflow.com/a/77781316
answers question: http://stackoverflow.com/q/77772817
type: Answer
score: 0
has body: @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. A ClickDetector's MouseClick event can give you the player that interacted with them, so you can use that to access their leaderstats. -- define some easy to change values local DEFAULT_COIN_AMOUNT = 100 local COIN_VALUE = 10 local RESPAWN_TIME = 10 -- when a player joins, create their leaderstats local players = game:GetService("Players") function playerSpawned(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats" local coins = Instance.new("IntValue", leaderstats) coins.Name = "Coins" coins.Value = DEFAULT_COIN_AMOUNT end) players.PlayerAdded:Connect(playerSpawned) -- add click detectors to all coins in the world local folder = workspace.Coins for _, object in ipairs(folder:GetChildren()) do local button = Instance.new("ClickDetector", object) button.CursorIcon = "rbxassetid://7029597423" button.MouseClick:Connect(function(playerWhoClicked) -- hide the coin button.MaxActivationDistance = 0 object.Transparency = 1 object.CanCollide = false -- increase the player's coins counter playerWhoClicked.leaderstats.Coins.Value += COIN_VALUE -- reveal the coin after a short wait wait(RESPAWN_TIME) object.ClickDetector.MaxActivationDistance = 300 object.Transparency = 0 object.CanCollide = true end) end

http://stackoverflow.com/comment/136951561
type: Comment
score: 0
has text: @IlyaVerbin initial post has been updated
type: QuestionComment
comment on: http://stackoverflow.com/q/77622411

http://stackoverflow.com/comment/137003047
score: 0
has text: 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)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77704605

http://stackoverflow.com/comment/137049073
type: AnswerComment
type: Comment
has text: I understand, but the pcall does not ensure that the `CoinsStore:GetAsync(UID)` actually returns an object that has the `.CoinsAmount` member. The 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.
comment on: http://stackoverflow.com/a/77737067
score: 1

http://stackoverflow.com/comment/137038040
score: 0
type: QuestionComment
has text: Just to be sure, the prints work. If the response["Code"] is 404, it prints 404 and so on
type: Comment
comment on: http://stackoverflow.com/q/77726860

http://stackoverflow.com/q/77639707
has answer: http://stackoverflow.com/a/77676408
answer count: 1
score: 0
has body: 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. { "year":"2023", "languageId":"2", "city:"Banglore", "TheatreInfo": [ { "tId":"123", "tname":"inox" }, { "tId":"124", "tname":"inox" } ], "usecase":"tdetails" } We tried to read above json in lua file like below. local transform_body = {}; transform_body["year"]=body["year"]; transform_body["languageid"]=body["languageId"]; transform_body["city"]=body["city"]; How do I write a lua script for Array of objects TheatreInfo?
has title: How to read/iterate Array of ojects in lua script
tagged with: arrays
tagged with: object
type: Question
type: UnansweredQuestion
tagged with: lua
linked to: http://stackoverflow.com/q/77634753
has comment: http://stackoverflow.com/comment/136876088

http://stackoverflow.com/comment/137102266
type: QuestionComment
has text: @SupaMaggie70 but how can i run multiple threads / coroutines?
type: Comment
comment on: http://stackoverflow.com/q/77766830
score: 0

visual-c++
tags question: http://stackoverflow.com/q/77734716
type: Tag
tag name: visual-c++

http://stackoverflow.com/comment/136849829
type: QuestionComment
score: 0
type: Comment
has text: When I run "lua" command it shows 5.3.6 but in pktgen build it shows 5.1.4.
comment on: http://stackoverflow.com/q/77625181

http://stackoverflow.com/a/77762204
score: 0
answers question: http://stackoverflow.com/q/77662875
has body: 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. Unit is supposed to have uppercase U or it wont work by the way. So thats your solution. Here is my version of your code which is fixed. Keep in mind only the client can see the entity chasing them, not the other clients. Entities are impossible to make (difficult) without them having basic components of a regular Roblox player character. If your entity doesn't have components of a regular roblox character, recommend adding now then using this script. local entity = script.Parent local speed = 10 local player = game.Players.LocalPlayer local function chasePlayer() local humanoid = player.Character:FindFirstChild("Humanoid") if not entity then return end if humanoid then coroutine.wrap(function() local bool = true -- add parameters to make this value false when you want it to while bool == true do wait() -- 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. entity.Parent.Humanoid.WalkSpeed = speed if player.Character.Humanoid.RootPart then entity.Parent.Humanoid:MoveTo(player.Character.Humanoid.RootPart.Position) end end end)() end end entity.Touched:Connect(function(otherPart) local character = otherPart.Parent local humanoid = character:FindFirstChild("Humanoid") if humanoid then humanoid.Health = 0 end end) chasePlayer() -- game:GetService("RunService")…
type: Answer

http://stackoverflow.com/comment/136996388
type: QuestionComment
type: Comment
score: 0
has text: I'm trying to call this function from the API but it returns null
comment on: http://stackoverflow.com/q/77704605

http://stackoverflow.com/q/77784019
has title: Combo not going any higher than 1, trying to make combat system (roblox)
tagged with: lua
has answer: http://stackoverflow.com/a/77784146
type: Question
answer count: 1
tagged with: roblox
accepted answer: http://stackoverflow.com/a/77784146
score: 0
has body: I'm trying to make a combat system and obviously need a combo variable to keep track of what current combo i am in game.ReplicatedStorage.Remotes.M1.OnServerEvent:Connect(function(player, Mouse) print("Received M1 from the Client") local combo = 0 local startTime = tick() if combo == 3 then print("M1 Combo!") combo = 0 end if tick() - startTime >= 2 then combo = 0 end combo = combo + 1 print(combo) end) But it just seems to never go higher than 1 or never add 1 to the combo 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!
type: AnsweredQuestion

http://stackoverflow.com/a/77731663
type: Answer
answers question: http://stackoverflow.com/q/77728982
score: 0
has body: Assign the "Back" action to physical G1 key (in the LGS/GHub GUI). ("Back" is the default action for mouse button 4). Make sure the game ignores mouse button 4 click (in the game control settings). Set the script: function OnEvent(event, arg) if event == "G_PRESSED" and arg == 1 then -- G1 key repeat OutputLogMessage("Loop") Sleep(10) until not IsMouseButtonPressed(4) -- 4 = "back" OutputLogMessage("\nEnd Loop\n") end

http://stackoverflow.com/a/77943526
has comment: http://stackoverflow.com/comment/137435332
type: Answer
has body: To run a love game, you need to indicate only the name of the folder that contains main.lua: love myFolder. Also, love.exe path must be in the Environment Variables check here for more details
score: 0
answers question: http://stackoverflow.com/q/77711848

tarantool-cartridge
tags question: http://stackoverflow.com/q/77622411
tag name: tarantool-cartridge
type: Tag

http://stackoverflow.com/comment/137013430
comment on: http://stackoverflow.com/q/77704605
has text: i trying to (OpenPeripherial addon) in API glas = peripherial.wrap("top") function func() glas.addBox(args) end in test load api api.func what i reduce "attempt to index ? ( a nil value)
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/136997705
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77704605
type: Comment
has text: I assume you meant `peripherial.call("top", "clear")`? In any case, clear returns nil as intended, see https://computercraft.info/wiki/Term_(API)

http://stackoverflow.com/comment/137069220
type: QuestionComment
score: 0
has text: Memory usage and efficiency are the same (with and without local function). But readability of the code is different.
type: Comment
comment on: http://stackoverflow.com/q/77745823

decoding
tag name: decoding
type: Tag
tags question: http://stackoverflow.com/q/77755513

http://stackoverflow.com/comment/136849692
type: QuestionComment
comment on: http://stackoverflow.com/q/77625181
type: Comment
score: 0
has text: Do you have Lua 5.3 or 5.4 package installed on your system?

http://stackoverflow.com/a/77762074
accepted answer of: http://stackoverflow.com/q/77757772
answers question: http://stackoverflow.com/q/77757772
type: AcceptedAnswer
type: Answer
has body: After trying with different things and testing with https://fennel-lang.org/see , 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). (hs.hotkey.bind {} "F18" (fn [] (myModal:enter))) The issue was inside the myModal:bind function call. I think I'd misplaced a parenthesis. this works (myModal:bind "" :T (fn [] (my-modal:exit) (hs.alert.show "testing Fennel Modal") ))
score: 0

http://stackoverflow.com/a/77682477
score: 0
has comment: http://stackoverflow.com/comment/136973556
has body: acc_1:deposit(100.0) is syntax sugar for acc_1.deposit(acc_1, 100.0). The immediate issue you have is that acc_1.deposit is nil. First off, acc_1 is empty. This is sort of by design -- it is a proxy returned by AccountProxy:new. Because the key doesn't exist, it will check the metatable. The __index method looks in the corresponding account table, but this only has balance. There is nothing connecting acc_1 to AccountProxy.deposit. You could call AccountProxy.deposit(acc_1, 100.0), but this is not really a traditional object-oriented pattern. You want acc_1.deposit to be associated with the actual method, so you must either put deposit directly in acc_1, 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 new from your instance methods. E.g. function AccountProxy:new() local proxy = {} -- ... function proxy:deposit() -- do the deposit ... end -- ... return proxy end or function AccountProxy:new() local proxy = {} setmetatable(proxy, { __index = AccountProxy, }) -- ... return proxy end 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 balance. 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.) Without the metatable, you need another way to retrieve balance from proxy; and you have already partially implemented this as suggested by the exercise. Given proxy, you can lookup accounts[proxy] e.g. function AccountProxy:getBalance() return accounts[self].balance or 0 end Assuming outside code doesn't have access to ac…
has comment: http://stackoverflow.com/comment/136974208
has comment: http://stackoverflow.com/comment/136976568
answers question: http://stackoverflow.com/q/77681606
type: Answer

http://stackoverflow.com/a/77781597
upvote count: 0
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/77765418
has body: The problem is: you cannot both simulate a mouse button press/release and monitor the same mouse button state (pressed/released) simultaneously. To solve the problem you may: either change the physical button (rapid-fire by another mouse button instead of LMB) or change the simulated button (introduce alternative button for shoot in the game). This answer describes how to implement the second option. You need to satisfy all 3 steps: In the game, in the "Controls Settings", introduce alternative key for "Shoot" action. (I assume your game allows binding two different keys for the same action) For example, let it be keyboard key P. So, now in the game you can shoot either using Left Mouse Button or using Keyboard key P. Of course, you will use LMB for manual shooting as usually, but your LGS/GHub script will use P. Try to play the game with both LMB and P for shooting. Make sure you can shoot with P key while keeping LMB pressed. (Some games do not allow this) The script EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsKeyLockOn("capslock") and IsMouseButtonPressed(3) then repeat Sleep(math.random(10,30)) PressKey("P") Sleep(math.random(10,30)) ReleaseKey("P") until not (IsMouseButtonPressed(1) and IsMouseButtonPressed(3)) end end
score: -1

http://stackoverflow.com/comment/136953415
comment on: http://stackoverflow.com/a/77681223
type: AnswerComment
type: Comment
has text: `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.
score: 0

http://stackoverflow.com/a/77755803
type: AcceptedAnswer
score: 0
type: Answer
has body: I have no experience with Unreal Engine, but I see a couple things. "attempt to index a nil value" should be interpreted as, in simplified form, you tried to do this: nil[1] or nil:foo(). The wording tends to trip some people up. In this case, it makes the most sense that TimerManager 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. As I was reading through for ways to get a create Unreal classes, I came across the LoopAsync 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. https://github.com/UE4SS-RE/RE-UE4SS/tree/main/docs/lua-api/global-functions local IDA, IDB local LightComponent function HookNewLight(ContextParam) local Context = ContextParam:get() LightComponent = Context:GetPropertyValue("PointLight") LightComponent:SetHiddenInGame(true, true) end RegisterHook("/Script/Engine.PlayerController:ClientRestart", function(Context, NewPawn) if IDA == nil then IDA, IDB = RegisterHook("/Game/Core/Characters/Player/AnathemaPlayerCharacter_BP.AnathemaPlayerCharacter_BP_C:Re ceiveBeginPlay", HookNewLight) end end) function ToggleVisibility() if(LightComponent and LightComponent:IsValid()) then local NewState = LightComponent:IsVisible() LightComponent:SetHiddenInGame(NewState, true) end end RegisterKeyBind(Key.F3, function() -- call every 100 milliseconds / 0.1 seconds LoopAsync(100, function() ToggleVisibility() -- if you need to disable it, you can set up a flag or condition for -- this function to return true; otherwise it will loop forever return false end) end)
has comment: http://stackoverflow.com/comment/137111618
accepted answer of: http://stackoverflow.com/q/77755107
answers question: http://stackoverflow.com/q/77755107

nvim.cmp
tags question: http://stackoverflow.com/q/77697425
tag name: nvim.cmp
type: Tag
tags question: http://stackoverflow.com/q/77666088
tags question: http://stackoverflow.com/q/77888576
tags question: http://stackoverflow.com/q/78290698
tags question: http://stackoverflow.com/q/78677429

http://stackoverflow.com/comment/137045006
score: 0
type: QuestionComment
has text: @273K at least read the whole question
comment on: http://stackoverflow.com/q/77734716
type: Comment

http://stackoverflow.com/a/77672368
has comment: http://stackoverflow.com/comment/136934162
accepted answer of: http://stackoverflow.com/q/77672280
answers question: http://stackoverflow.com/q/77672280
upvote count: 2
score: 2
downvote count: 0
has body: There are two relevant Lua quirks, one of which I would suspect to be at play here: String - number coercion, but strict equality checking; Use of floats, but printing them inexactly, hiding rounding errors Let's first simplify your example: function f(x) if x == 1 then return 0 end return 1 end So f(1) is 0, and f(x) is 1 for every x that does not equal 1. Strings that quack like numbers Lua has a controversial "feature" where it coerces strings to numbers if you do arithmetic on them, and coerces numbers to strings if you do arithmetic on them; print just calls tostring internally, which doesn't quote strings, so strings very much "quack like numbers". However, testing for equality (or table indexing) is "strict"; it also requires the types to match. See this example: -- Oops! This should be a number. -- In practice this might be something less obvious like a function returning a string. local x = "1" print(x + 2) -- 3, we can do arithmetic as if it was a number! print(x) -- 1, it looks just like it was a number! print(type(x)) -- string print("1" == 1) -- false, the types don't match print(f(x)) -- 1, because "1" ~= 1 The solution here, assuming x is a string which comes from a file or similar, is to tonumber(x) (or equivalently: x + 0, which behaves roughly like assert(tonumber(x))). Rounding errors 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 rounds numbers when printing them, so you don't see this if you insert debug prints. Consider: local x = 0.2 + 6 * 0.3 print(x) -- 2.0 print(x == 2) -- false, what? how does 2 not equal 2? To uncover this, print x to 17 digits of precision: print(("%.17g"):format(0.2 + 6 * 0.3)) -- 1.9999999999999998 If you know that you're working with inaccuracies, you should do compa…
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/137073374
type: AnswerComment
type: Comment
score: 0
has text: Hey, thanks for the reply. But same problem it only runs once and then it doesn't run anymore.
comment on: http://stackoverflow.com/a/77749562

sockets
tag name: sockets
type: Tag
tags question: http://stackoverflow.com/q/77766830
tags question: http://stackoverflow.com/q/77958049
tags question: http://stackoverflow.com/q/78729670
tags question: http://stackoverflow.com/q/79474052

http://stackoverflow.com/comment/136951580
type: Comment
score: 0
type: QuestionComment
has text: 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
comment on: http://stackoverflow.com/q/77622411

http://stackoverflow.com/q/77712176
has title: make consumer as coroutine and producer as main thread in lua
tagged with: producer
type: Question
tagged with: consumer
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77713139
score: 0
has body: This is the consumer-producer , producer as coroutine and consumer as main thread: function receive (prod) local status, value = coroutine.resume(prod) return value end function send (x) coroutine.yield(x) end function producer () return coroutine.create(function () while true do local x = io.read() -- produce new value send(x) end end) end function filter (prod) return coroutine.create(function () for line = 1, math.huge do local x = receive(prod) -- get new value x = string.format("%5d %s", line, x) send(x) -- send it to consumer end end) end function consumer (prod) while true do local x = receive(prod) io.write(x, "\n") end end -- get new value -- consume new value consumer(filter(producer())) and here is my answer bt is not running as expected: function receive (x) coroutine.yield(x) end function send (cons, x) local status, value = coroutine.resume(cons, x) return value end function producer (cons) while true do local x = io.read() -- produce new value send(cons, x) end end function filter (cons) return coroutine.create(function (x) for line = 1, math.huge do local _, x = receive(x) -- get new value x = string.format("%5d %s", line, x) send(cons, x) -- send it to consumer end end) end function consumer () return coroutine.create(function(x) while true do local x = receive(x) io.write(x, "\n") end end) end -- get new value -- consume new value producer(filter(consumer())) 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. Any suggestion? I do not want to change the initial way was implemented, meaning the recieve() bound into the consumer() and send() bound into reciever().
tagged with: lua

http://stackoverflow.com/comment/137111618
has text: Yeah this actually worked, thanks for looking into it and answering
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77755803

http://stackoverflow.com/comment/137010877
comment on: http://stackoverflow.com/a/77713457
score: 0
has text: http://lua-users.org/wiki/BindingCodeToLua
type: AnswerComment
type: Comment

http://stackoverflow.com/q/77671751
tagged with: neovim
upvote count: 1
tagged with: keymapping
has comment: http://stackoverflow.com/comment/136938101
answer count: 1
has answer: http://stackoverflow.com/a/77672226
favorite count: 0
has comment: http://stackoverflow.com/comment/136936661
tagged with: lua
has body: Given a string of inputs, it is possible to execute it using :normal!: :normal! ihello will go into insert mode and write the text 'hello'. When mapping keys to expressions we can use a similar, albeit incompatible syntax. In Lua, we could, for example, define vim.keymap.set('n', 's', '&lt;c-a&gt;y') Given such a string, '&lt;c-a&gt;y', how would we execute it imperatively from within Lua/Vimscript without a key binding, similar to what is possible with :normal!?
type: Question
has title: Execute key RHS expression in Vim imperatively
type: UnansweredQuestion
tagged with: vim
has comment: http://stackoverflow.com/comment/136935096
has comment: http://stackoverflow.com/comment/136937915
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/136938048
has comment: http://stackoverflow.com/comment/136933705

error-handling
tag name: error-handling
tags question: http://stackoverflow.com/q/77719576
type: Tag

http://stackoverflow.com/comment/137031944
type: QuestionComment
score: 0
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/77728192

http://stackoverflow.com/comment/137013422
type: QuestionComment
score: 0
has text: okay i cant load scren shoots
type: Comment
comment on: http://stackoverflow.com/q/77704605

dll
tags question: http://stackoverflow.com/q/77734716
type: Tag
tag name: dll
tags question: http://stackoverflow.com/q/78615298
tags question: http://stackoverflow.com/q/78985787

http://stackoverflow.com/comment/136976568
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77682477
has text: sorry my mistake, thnx, everything is fine

http://stackoverflow.com/comment/137007727
type: AnswerComment
type: Comment
score: 0
has text: 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. Regarding 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?
comment on: http://stackoverflow.com/a/77713457

binaryfiles
tag name: binaryfiles
tags question: http://stackoverflow.com/q/77755513
type: Tag

http://stackoverflow.com/comment/137005432
has text: @Oka So I have to create another index for array ? In this case, how could I do this in C?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77712275

tarantool
type: Tag
tag name: tarantool
tags question: http://stackoverflow.com/q/77622411
tags question: http://stackoverflow.com/q/78699403

http://stackoverflow.com/comment/137018382
type: Comment
comment on: http://stackoverflow.com/q/77719576
score: 0
has text: 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).
type: QuestionComment

http://stackoverflow.com/comment/136903451
type: QuestionComment
type: Comment
has text: @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.
score: 0
comment on: http://stackoverflow.com/q/77649718

http://stackoverflow.com/a/77707080
answers question: http://stackoverflow.com/q/77700378
has body: Pretty cloudy question and this is my first time answering on Stackoverflow, but i'll do my best. Most games with lobbys put it's games in separate places 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. 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 teleport to into it's own different place!
score: 0
type: Answer

http://stackoverflow.com/comment/136991045
type: Comment
comment on: http://stackoverflow.com/q/77704605
has text: "If no peripheral is connected, returns nil.", are you sure the side is correct and is a valid peripherial?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/136995097
score: 0
type: QuestionComment
has text: Yes, peripherial.isPresent returns "true"
comment on: http://stackoverflow.com/q/77704605
type: Comment

http://stackoverflow.com/comment/136996391
type: Comment
has text: I'm working with a monitor if that's the case
score: 0
comment on: http://stackoverflow.com/q/77704605
type: QuestionComment

http://stackoverflow.com/a/77603934
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77603503
has body: The problem is that you're doing both table.inserts in both iterations, but you should only be creating each menu item once. Either wrap your table.inserts in if statements so they only run for the correct iteration, or just remove the loop altogether and use expressions like Config.Skills.stamina.Current and Config.Skills.strength.Current to get the values.

http://stackoverflow.com/comment/137087707
score: 1
type: QuestionComment
has text: "*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.
comment on: http://stackoverflow.com/q/77759455
type: Comment

http://stackoverflow.com/comment/136977593
has text: You'd better update your question, add this description and check my update.
score: 0
comment on: http://stackoverflow.com/a/77697072
type: AnswerComment
type: Comment

http://stackoverflow.com/a/77713139
score: 0
type: Answer
has body: The receiver isn't returning anything, let's add a return. function receive(x) return coroutine.yield(x) end The receiver only returns one value in your example, let's remove _. local x = receive(x) Then all your consumer, filter etc are one input delayed because you ignore the first x, and then enter the loop.
answers question: http://stackoverflow.com/q/77712176

unreal-engine5
tag name: unreal-engine5
tags question: http://stackoverflow.com/q/77755107
type: Tag

http://stackoverflow.com/comment/137003083
has text: yes, I tried to do this, the function does not work, and I understand that it cannot call the periphery
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77704605
type: Comment

consumer
tags question: http://stackoverflow.com/q/77712176
tag name: consumer
type: Tag

http://stackoverflow.com/comment/137002629
has text: the problem is that any attempt to call the peripheral from the API returns zero
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77704605

http://stackoverflow.com/comment/136876088
score: 1
has text: Your question has been asked and answered already: https://stackoverflow.com/questions/77634753/how-to-read-nested-objectsobject-inside-object-in-lua-file
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77639707

tcp
tags question: http://stackoverflow.com/q/77766830
tag name: tcp
type: Tag

http://stackoverflow.com/q/77734652
type: UnansweredQuestion
downvote count: 0
tagged with: vlc
favorite count: 0
score: 1
has answer: http://stackoverflow.com/a/79049650
tagged with: lua
has body: For example, let's say I want to run vlc.audio.set_mute(true) at 10 seconds into the current video file and vlc.audio.set_mute(false) at 20 seconds (thereby muting seconds 10 through 20). 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. Lua itself does not have a built-in sleep function Calls to the OS seem to be blocked. Busy waiting in a loop causes the extension to be perceived as unresponsive (and it's bad anyway). vlc.misc is not available in Extensions, so I can't do something like a while loop and then run vlc.misc.mwait(vlc.misc.mdate() + 500) at the end of each iteration.
has title: How to create a VLC Lua extension that does something at particular timestamps?
type: Question
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/137043317
score: 0
comment on: http://stackoverflow.com/q/77734716
has text: `#include <lua.hpp>` - this is not C. `extern "C"` is also invalid C.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/137042848
has text: If you ask about C++, why do you spam tag C watchers?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77734716

fopen
tag name: fopen
tags question: http://stackoverflow.com/q/77659298
type: Tag

http://stackoverflow.com/a/77711009
has body: It really depends different games use different methods the two methods would be: Have everything, maps and the lobby in the same place. 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. The second approach is having each game/map in a different place. 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. 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.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/77700378
downvote count: 0

writer
type: Tag
tag name: writer
tags question: http://stackoverflow.com/q/77648678
tags question: http://stackoverflow.com/q/78552455
tags question: http://stackoverflow.com/q/79190029

http://stackoverflow.com/comment/137031200
score: 0
comment on: http://stackoverflow.com/a/77721366
type: AnswerComment
has text: How did you acquire the error message?
type: Comment

fennel
tag name: fennel
type: Tag
tags question: http://stackoverflow.com/q/77757772

http://stackoverflow.com/comment/137101237
score: 2
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/77766830
type: QuestionComment

lookup
tags question: http://stackoverflow.com/q/77759455
type: Tag
tag name: lookup

http://stackoverflow.com/comment/137013443
score: 0
has text: trying to display the table number will do nothing
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77704605

http://stackoverflow.com/a/77711660
upvote count: 1
downvote count: 0
has body: 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. local type_table = { sound = sound_metatable.new, sprite = sprite_metatable.new } function create_node(type) return type_table[type]() end Then, I wrote a new metatable that looks up the function tables based on the node's type. local lookup_table = { [sound_enum] = sound_metatable, [sprite_enum] = sprite_metatable } local test_metatable = { __index = function (table, key) print(tonumber(table.type)) return lookup_table[tonumber(table.type)][key] end } Then, I can do this: game.node = ffi.metatype("game_node", test_metatable) 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.
answers question: http://stackoverflow.com/q/77709503
score: 1
type: Answer

http://stackoverflow.com/comment/136973556
has text: ur article is great but i cannot make it to run wth metatables.. take a look at the new post in my question.
comment on: http://stackoverflow.com/a/77682477
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/137036694
score: 0
type: QuestionComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/77719576

ffi
tag name: ffi
tags question: http://stackoverflow.com/q/77719576
type: Tag
tags question: http://stackoverflow.com/q/78430344
tags question: http://stackoverflow.com/q/78863482
tags question: http://stackoverflow.com/q/78839677
tags question: http://stackoverflow.com/q/78985787

proxy
tag name: proxy
tags question: http://stackoverflow.com/q/77681606
type: Tag
tags question: http://stackoverflow.com/q/78673757

keymapping
tags question: http://stackoverflow.com/q/77671751
type: Tag
tag name: keymapping

macros
type: Tag
tag name: macros
tags question: http://stackoverflow.com/q/77728982
tags question: http://stackoverflow.com/q/78894422
tags question: http://stackoverflow.com/q/78767378
tags question: http://stackoverflow.com/q/79135324

libtomcrypt
tag name: libtomcrypt
tags question: http://stackoverflow.com/q/77693740
type: Tag

http://stackoverflow.com/a/78183112
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/77666088
score: 2
has body: I think you want something like lsp_signature.nvim or you could use my own signature parameter hints signature.lua. It's minimal and I try to mimic the behaviour of triggering as vscode does. https://asciinema.org/a/xmAxDSfIKSYJQ3hEISmScA4Ym
downvote count: 0

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/77693740
type: Tag
tags question: http://stackoverflow.com/q/78087883
tags question: http://stackoverflow.com/q/78581627
tags question: http://stackoverflow.com/q/78582469

envoyproxy
type: Tag
tags question: http://stackoverflow.com/q/77703599
tag name: envoyproxy
tags question: http://stackoverflow.com/q/78262424
tags question: http://stackoverflow.com/q/79358099
tags question: http://stackoverflow.com/q/79421275

producer
type: Tag
tags question: http://stackoverflow.com/q/77712176
tag name: producer

http://stackoverflow.com/q/77824896
score: -1
tagged with: lua
has title: Lua script for g502 hero , loop until key press again
has comment: http://stackoverflow.com/comment/137199928
answer count: 1
has answer: http://stackoverflow.com/a/77827117
tagged with: logitech-gaming-software
has comment: http://stackoverflow.com/comment/137199992
has body: 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. -- NOT HOLD - PRESS AGAIN -- here is my code; local M4_pressed = false function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then M4_pressed = not M4_pressed while M4_pressed do PressKey("2") Sleep(math.random(60, 70)) ReleaseKey("2") Sleep(math.random(60, 70)) end end end this is my code but its not stopping on press again. M4_pressed = not M4_pressed /*this means if(M4_pressed = true){M4_pressed = false)} if(M4_pressed = false){M4_pressed = true)} */
type: Question
has comment: http://stackoverflow.com/comment/137199768
favorite count: 0
downvote count: 1
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137199848

cygwin-64
type: Tag
tags question: http://stackoverflow.com/q/77922338
tag name: cygwin-64

http://stackoverflow.com/q/77854806
upvote count: 1
tagged with: mutt
favorite count: 0
type: Question
downvote count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/138802533
has body: 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.
tagged with: lua
has comment: http://stackoverflow.com/comment/138837896
type: UnansweredQuestion
tagged with: neomutt
score: 1
has title: Deleting E-Mails Programmatically with Lua in Neomutt

http://stackoverflow.com/q/77936647
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/77990070
tagged with: datastore
tagged with: lua
has body: 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. Here is the script - local Players = game:GetService("Players") local DataStoreService = game:GetService("DataStoreService") local SufferingsStore = DataStoreService:GetDataStore("Sufferings") local SufferCoinsStore = DataStoreService:GetDataStore("SufferCoins") local function leaderboard(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local SufferCoins = Instance.new("IntValue") SufferCoins.Name = "SufferCoins" SufferCoins.Parent = leaderstats local Sufferings = Instance.new("IntValue") Sufferings.Name = "Sufferings" Sufferings.Parent = leaderstats local data1, data2 local success, errorMessage = pcall(function() data1 = SufferCoinsStore:GetAsync(player.UserId.. "-SufferCoins") data2 = SufferingsStore:GetAsync(player.UserId.. "-Sufferings") end) if success then SufferCoins.Value = data1 Sufferings.Value = data2 print("Data succesfuly loaded for " .. player.Name) else warn(errorMessage) end end local function saveData(player) local success, errorMessage = pcall(function() SufferCoinsStore:SetAsync(player.UserId.. "-SufferCoins", player.leaderstats.SufferCoins.Value) SufferingsStore:SetAsync(player.UserId.. "-Sufferings", player.leaderstats.Sufferings.Value) end) if success then print("Data Saved for " .. player.Name) else print("An Error Occurred While Saving for " .. player.Name) warn(errorMessage) end end Players.PlayerAdded:Connect(function(player) leaderboard(player) player.CharacterAdded:Connect(function() leaderboard(player) end) end) Players.PlayerRemoving:Connect(function(player) saveData(player) end) for _, player in pairs(Players:GetPlayers()) do leaderboard(player) end 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 do…
has title: Saving 2 player values in a Roblox leaderboard
has answer: http://stackoverflow.com/a/77990070
answer count: 1
tagged with: leaderboard
score: 0

http://stackoverflow.com/comment/137151666
type: Comment
has text: 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.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/77797865

http://stackoverflow.com/comment/137320371
has text: The first line is line778 so the last one is 792 as the error told that the problem is anywhere in it
type: Comment
comment on: http://stackoverflow.com/q/77892559
type: QuestionComment
score: 0

http://stackoverflow.com/q/77904973
tagged with: lua
score: 1
accepted answer: http://stackoverflow.com/a/77909693
tagged with: convex
type: AnsweredQuestion
has body: I'm trying to check if point x, y is inside of polygon poly = {x1,y1, x2,y2, x3,y3 ...} But something goes wrong: local function pointInConvexPolygon(x, y, poly) -- poly as {x1,y1, x2,y2, x3,y3, ...} local imax = #poly local function isVerticesClockwise(poly) local sum = 0 local imax = #poly local x1, y1 = poly[imax-1], poly[imax] for i = 1, imax - 1, 2 do local x2, y2 = poly[i], poly[i + 1] sum = sum + (x2 - x1) * (y2 + y1) x1, y1 = x2, y2 -- fixed end local isClockwise = sum &lt; 0 love.window.setTitle(isClockwise and 'clockwise' or 'counterclockwise') return isClockwise end local sign = isVerticesClockwise(poly) and 1 or -1 local x1, y1 = poly[imax-1], poly[imax] for i = 1, imax - 1, 2 do local x2, y2 = poly[i], poly[i + 1] local dotProduct = (x - x1) * (y1 - y2) + (y - y1) * (x2 - x1) if sign * dotProduct &lt; 0 then return false end x1, y1 = x2, y2 end return true end Sometimes clockwise direction is right, but sometimes it says wrong direction.
answer count: 1
upvote count: 1
tagged with: polygon
tagged with: math
has answer: http://stackoverflow.com/a/77909693
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/137349525
tagged with: contains
has title: Check if point is in convex polygon
downvote count: 0

http://stackoverflow.com/q/77847916
favorite count: 0
type: Question
answer count: 0
has title: Kong: limit concurrent requests per consumer
has body: 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? Thanks.
downvote count: 0
tagged with: lua
tagged with: kong-plugin
tagged with: kong
type: UnansweredQuestion
score: 1
upvote count: 1

http://stackoverflow.com/q/77809496
type: Question
tagged with: lua
tagged with: scripting
has comment: http://stackoverflow.com/comment/137173418
score: 1
has answer: http://stackoverflow.com/a/78295761
upvote count: 1
answer count: 1
type: UnansweredQuestion
favorite count: 0
has body: 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. Script that fires the event: local frame = game.Players.LocalPlayer.PlayerGui.Credits.Frame local text = frame.Presents local stroke = text.UIStroke local CurrentCamera = workspace.CurrentCamera local TweenService = game:GetService("TweenService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local finishcredits = ReplicatedStorage.Credits local SoundService = game:GetService("SoundService") local song = SoundService.Song local boom = SoundService.Boom local RunService = game:GetService("RunService") local targetTransparency = 1 local tweenDuration = 2 local tweenDuration2 = 4 local tweenInfo = TweenInfo.new(tweenDuration) local tween = TweenService:Create(frame, tweenInfo, {BackgroundTransparency = targetTransparency}) local tween2 = TweenService:Create(text, tweenInfo, {TextTransparency = targetTransparency}) local tween3 = TweenService:Create(stroke, tweenInfo, {Transparency = targetTransparency}) wait(1) print("1") local camera = workspace.MainCamera local function updateCamera() CurrentCamera.CFrame = camera.CFrame end print("2") frame.Visible = true wait(1) boom:Play() wait(5) song:Play() CurrentCamera.CameraType = Enum.CameraType.Scriptable print("script") tween:Play() print("tweened") tween2:Play() tween3:Play() wait(2) finishcredits:Fire(print("fired")) RunService.RenderStepped:Connect(updateCamera) Script that receives it: local TweenService = game:GetService("TweenService") local camera = workspace:WaitForChild("MainCamera") local text = workspace.MenuText:WaitForChild("WorldPivot") local SoundService = game:GetService("SoundService") local event = game.ReplicatedStorage.Credits local watereffect = workspace.MenuText.Water.Water local fireeffect = workspace.MenuText.Fire local explosion = fireeffect.Explosion local function enableExplosion() for _, explosion in pairs(explosion:GetDescendants()) do …
has title: Sends Event But Doesn't Receive
downvote count: 0
tagged with: roblox

http://stackoverflow.com/comment/137430818
has text: Raising an issue so the root cause can be fixed is actually the best suggestion I can come up with.
type: Comment
comment on: http://stackoverflow.com/q/77951468
type: QuestionComment
score: 2

http://stackoverflow.com/a/77798023
has body: I found this page which seems to have the exact same problem as you. The relevant code: function CloneMe(char) --a function that clones a player char.Archivable = true local clone = char:Clone() char.Archivable = false return clone end Basically you can’t clone anything unless it has Archivable=true, and player characters have it disabled by default
downvote count: 0
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/77797082
type: Answer

http://stackoverflow.com/q/77914976
upvote count: 1
has title: Retrieve the returned value of an execution
tagged with: lua
downvote count: 0
score: 1
type: AnsweredQuestion
answer count: 1
accepted answer: http://stackoverflow.com/a/77915148
favorite count: 0
type: Question
has body: I am implementing a Lua REPL. I use readline to read a command and then do: luaL_dostring(L, myinput); How can I retrieve the value returned by the execution if there is any? For example, if myinput contains a function call add(1, 1), how I can retrieve 2 here? I tried reading the stack with lua_tointeger but the stack is empty (lua_gettop returns 0). I would like to avoid modifying myinput to do something like ans = add(1, 1) and then reading the global if possible...
has answer: http://stackoverflow.com/a/77915148

http://stackoverflow.com/comment/137242091
comment on: http://stackoverflow.com/q/77838818
type: Comment
score: 0
has text: It seems that it does. Many thanks for that (I don't understand all of it, but copy paste should do it!!!)
type: QuestionComment

http://stackoverflow.com/q/77939546
has comment: http://stackoverflow.com/comment/137415721
downvote count: 0
tagged with: vector
answer count: 0
has comment: http://stackoverflow.com/comment/137403580
score: 1
has body: I have 4 half-planes, that are defined as base point and normalized tangent: local frameX, frameY, frameW, frameH = 25, 25, 750, 550 local halfPlanes = { -- halfplane as starting point and tangent {frameX, frameY, -1, 0}, -- y &lt; frameY {frameX + frameW, frameY, 0, 1}, -- x &gt; frameX + frameW {frameX + frameW, frameY+frameH, 1, 0}, -- y &gt; frameY + frameH {frameX, frameY+frameH, 0, -1}, -- x &lt; frameX } I want to check if the point is in one of them / not in any of them as local bx, by, tx, ty = halfPlane[1], halfPlane[2], halfPlane[3], halfPlane[4] local d1 = dotProductLineTangentPoint (bx, by, tx, ty, px1, py1) local d2 = dotProductLineTangentPoint (bx, by, tx, ty, px2, py2) where dotProductLineTangentPoint is local function dotProductLineTangentPoint (x, y, tx, ty, px, py) -- x,y - starting point of line -- tx, ty - normalized tangent vector of line -- px, py - point to check -- return tx * (px - x) + ty * (py - y) return ty * (px - x) + tx * (py - y) end And than if one side is positive and the other is negative, then if (d1 &gt; 0 and d2 &lt; 0) or (d1 &lt; 0 and d2 &gt; 0) then local cx, cy = findCrossingLineTangentSegment (bx, by, tx, ty, p1, p2) return {cx, cy, px2, py2} end The result function crops the given segment with given boundary. Question: How to make the findCrossingLineTangentSegment correctly? Now I have placeholder with two exceptions for horizontal and vertical lines and not working vector solution: local function findCrossingLineTangentSegment(bx, by, tx, ty, p1, p2) if tx == 0 then local x, y = findIntersectionWithVerticalLine(p1.x, p1.y, p2.x, p2.y, bx) -- print ('cross with vertical') return x, y elseif ty == 0 then local x, y = findIntersectionWithHorizontalLine(p1.x, p1.y, p2.x, p2.y, by) -- print ('cross with horizontal') return x, y else -- local u = ((p2.x - p1.x) * ty + (p1.y - by) * tx) / (tx * (p1.y - p2.y) + ty * (p2.x - p1.x)) local u = dotProductLineTangentPoint(bx, by, tx, ty, p1) / dotProductLineTangentPoint(bx, by, tx,…
has comment: http://stackoverflow.com/comment/137416516
tagged with: lua
type: UnansweredQuestion
upvote count: 1
tagged with: math
favorite count: 0
has comment: http://stackoverflow.com/comment/137403589
type: Question
has title: Check if the point is inside of half-plane and cut the segment
linked to: http://stackoverflow.com/q/68592435

http://stackoverflow.com/comment/137429981
has text: @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.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77951468

http://stackoverflow.com/q/77906120
tagged with: lua
type: Question
has body: 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: local handle = io.popen("ls -1") local result = handle:read("*a") handle:close() local output = {} for s in result:gmatch("[^\r\n]*") do table.insert(output, s) end vim.api.nvim_buf_set_lines(buffer, 0, -1, false, output) It works, but I get an extra newline at the end of each line, so the lines of output are separated by blank lines. If instead I set the output myself, say to output = {"a", "b", "c"}, then it works as expected. I have checked and there is no newline character at the end of the strings in output. What is going on?
type: UnansweredQuestion
tagged with: neovim
score: 1
has answer: http://stackoverflow.com/a/77906506
upvote count: 1
tagged with: neovim-plugin
answer count: 1
favorite count: 0
downvote count: 0
has title: Expurious newlines when setting buffer content in Neovim with Lua

http://stackoverflow.com/q/77902368
has comment: http://stackoverflow.com/comment/137339653
accepted answer: http://stackoverflow.com/a/77903383
has body: What are the performance implications of Lua's debug.getlocal 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. I'd also be interested in its impact in other implementations, such as LuaJIT.
upvote count: 0
has title: What are the performance implications of using Lua's `debug.getlocal` function?
score: -1
answer count: 1
has comment: http://stackoverflow.com/comment/137338563
has answer: http://stackoverflow.com/a/77903383
favorite count: 0
type: AnsweredQuestion
tagged with: reflection
tagged with: lua
downvote count: 1
type: Question
tagged with: performance

http://stackoverflow.com/comment/137156402
type: Comment
score: 0
has text: 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.
type: AnswerComment
comment on: http://stackoverflow.com/a/77799598

http://stackoverflow.com/q/77901201
tagged with: syntax-error
tagged with: lua
type: UnansweredQuestion
tagged with: roblox-studio
score: 1
upvote count: 1
has body: 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? local dts = game:GetService("DataStoreService") local money = dts:GetDataStore("Currency-0") --Currency is set up like this: --{CASH, GEMS} --It is a table storing both values. game.Players.PlayerAdded:Connect(function(plr) local model = Instance.new("Model") -- lets set up our leaderstats! model.Name = "leaderstats" model.Parent = plr local moneyValue = Instance.new("IntValue") moneyValue.Name = "Cash" local gemValue = Instance.new("IntValue") gemValue.Name = "Gems" local key = "USER_" .. plr.Name .. "_" .. plr.UserId -- advanced player key local storedCash -- setting up a variable local success, err = pcall(function() storedCash = money:GetAsync(key) end) if success then moneyValue.Value = storedCash[1] -- this is the line that messes up gemValue.Value = storedCash[2] -- we've set that, now we must make it show moneyValue.Parent = model else moneyValue.Value = 0 gemValue.Value = 0 money:SetAsync(key, {0, 0}) end end) My error: :29: attempt to index local 'storedCash' (a nil value) 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?
answer count: 1
has title: I am getting a Data Store error in Roblox Studio that fails my data store. I have enabled studio access to API services
favorite count: 0
type: Question
downvote count: 0
tagged with: game-development
has answer: http://stackoverflow.com/a/77902316

http://stackoverflow.com/q/77849932
has answer: http://stackoverflow.com/a/77850126
answer count: 1
type: UnansweredQuestion
has body: I am trying to iterate through a table but start from a position in the table using a key. list = { "one", "two", "four", "five", "six" } for k = 3, v in pairs(list) do print("Key:" .. k .. " " .. "Value:" .. v) end Compilation error on line 10: ...\ZeroBraneStudio\myprograms\untitled.lua:10: 'do' expected near 'in'
favorite count: 0
tagged with: loops
has title: How do I iterate through a table starting at a key position in lua?
upvote count: 3
type: Question
downvote count: 0
tagged with: lua
score: 3
tagged with: lua-table

http://stackoverflow.com/a/77903383
type: Answer
accepted answer of: http://stackoverflow.com/q/77902368
has body: 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? 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 SE question though.
downvote count: 0
answers question: http://stackoverflow.com/q/77902368
upvote count: 3
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/77958049
has comment: http://stackoverflow.com/comment/137448554
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/137453875
tagged with: lua
has title: socks daemon on Lua
tagged with: daemon
has body: I'm newbie in Lua, but have an experience in PHP. I 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. I want to replicate the project in Lua. However, I have not found good examples of working with sockets on Lua. How can I serve two sockets at the same time? How do I get multiple incoming connections on the same port? 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.
score: 0
type: Question
answer count: 0

http://stackoverflow.com/q/77790831
answer count: 1
has title: Part instance doesn't remove itself when told so
type: Question
has body: 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() ). 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. The global script in question: local remoteEvent = script.Parent.esquirlaEvent local tool = script.Parent remoteEvent.OnServerEvent:Connect(function(player, startPosition, impacto, colordobjeto, materialdobjeto) local function crearescombros() local visual = Instance.new("Part") visual.Parent = game.Workspace.esquirlas visual.Anchored = true visual.CanCollide = false visual.Transparency = .5 visual.Shape = Enum.PartType.Ball visual.Position = impacto visual.Size = Vector3.new(2, 2, 2) local sonido = Instance.new("Sound") sonido.Parent = visual sonido.SoundId = "rbxassetid://15229796402" sonido.Volume = 0.5 sonido.MaxDistance = 70 sonido:Play() wait(.1) visual.Transparency = .8 wait(.1) visual.Transparency = 1 sonido.Ended:Wait() visual:Remove() end crearescombros() end) Any help is welcomed.
tagged with: roblox
tagged with: lua
accepted answer: http://stackoverflow.com/a/77794827
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77794827

http://stackoverflow.com/q/77918731
tagged with: lua
accepted answer: http://stackoverflow.com/a/77927881
tagged with: roblox
tagged with: roblox-studio
has body: 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 ContentProvider:PreloadAsync(); local Attempt = true while Attempt do ContentProvider:PreloadAsync({DayTheme},function(assetId,assetFetch) print("Got DayTheme with asset ID",assetId) if assetFetch == Enum.AssetFetchStatus.None then warn("DayTheme returned no valid information, and the engine didn't attempt to load it.") elseif assetFetch == Enum.AssetFetchStatus.Failure then warn("DayTheme failed to load and was aborted by the engine.") elseif assetFetch == Enum.AssetFetchStatus.Loading then return elseif assetFetch == Enum.AssetFetchStatus.TimedOut then print("Load timed out, trying again.") else print("ContentProvider returned OK") if not DayTheme.IsLoaded then print("Waiting for DayTheme to load") local pass = 1 repeat task.wait(1) pass = pass + 1 print(pass) until DayTheme.IsLoaded or pass == 10 if not DayTheme.IsLoaded then warn("DayTheme failed to load") else if not DayTheme.IsPlaying then print("Playing"); DayTheme:Play() end end else if not DayTheme.IsPlaying then print("Playing"); DayTheme:Play() end end Attempt = false end end) task.wait(3) end Where DayTheme is a Sound instance (not an asset ID), running this section either 1) prints the "DayTheme failed to load and was aborted by the engine" warning I have set for Enum.AssetFetchStatus.Failure, or 2) eventually prints the "DayTheme failed to load" warning I have set for the DayTheme.IsLoaded check after ContentProvider returns Enum.AssetFetchStatus.Success. This is set up in a while loop to hopefully make it retry, since automatic retrying simply isn't a thing since around 2017. It should also be said that this is not the standard "Failed to download asset" 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…
has answer: http://stackoverflow.com/a/77927881
answer count: 1
type: AnsweredQuestion
score: 0
has title: Roblox Luau - Asset refuses to load in-game, but works in studio
tagged with: lua-5.1
type: Question
tagged with: luau

http://stackoverflow.com/a/78295761
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77809496
has body: It looks like on your second script you are connecting to the .Event event on an RemoteEvent. From my knowledge, .Event isn't an event you can connect to. Instead, you need to connect to .OnServerEvent for Client → Server events. local TweenService = game:GetService("TweenService") local camera = workspace:WaitForChild("MainCamera") local text = workspace.MenuText:WaitForChild("WorldPivot") local SoundService = game:GetService("SoundService") local event = game.ReplicatedStorage.Credits local watereffect = workspace.MenuText.Water.Water local fireeffect = workspace.MenuText.Fire local explosion = fireeffect.Explosion local function enableExplosion() for _, explosion in pairs(explosion:GetDescendants()) do if explosion:IsA("ParticleEmitter") then explosion.Enabled = true end end end local function enableFire() for _, fire in pairs(fireeffect:GetDescendants()) do if fire:IsA("ParticleEmitter") then fire.Enabled = true end end end local function enableWater() watereffect.Enabled = true end local function disableExplosion() for _, explosion in pairs(explosion:GetDescendants()) do if explosion:IsA("ParticleEmitter") then explosion.Enabled = false end end end local function disableFire() for _, fire in pairs(fireeffect:GetDescendants()) do if fire:IsA("ParticleEmitter") then fire.Enabled = false end end end local function disableWater() watereffect.Enabled = false end local playbutton = workspace.Menu.Play local rope = workspace.Menu.Play.Rope local info = TweenInfo.new(6, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false) local info4 = TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false) local info2 = TweenInfo.new(8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false) local tween = TweenService:Create(camera, info, {Position = Vector3.new(733.108, 14.451, -821.718)}) -- menu camera local tween4 = TweenService:Create(text, info4, {Position = Vector3.new(712.179, 19.936, -842.667)}) -- text title local tween2 = TweenService:Create(pla…

http://stackoverflow.com/comment/137394601
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77933920
has text: 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

http://stackoverflow.com/q/77899840
upvote count: 2
answer count: 1
type: Question
has title: "%w" and "%W" difference in lua?
has answer: http://stackoverflow.com/a/77899918
has body: %w and %W as in here: Str = string.gsub(Str, “%f[%w]cat%f[%W]” What's the difference between a small %w and a big %W ? Here are more examples: for _ in string.gmatch(“\n” .. Str .. “\n”, “%Wcat%W”) do , if Pos1 == 0 or string.find(Str, “^%W”, Pos1) then I know %w matches a word character So i expect %W matches a capital word character?
downvote count: 0
score: 2
tagged with: lua
tagged with: lua-patterns
type: UnansweredQuestion
favorite count: 0

http://stackoverflow.com/q/77852183
tagged with: lua
has body: 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 I'm not sure how to do it, or event if it's possible, but I try. So far I tried to do it in Lua : -- Check if Conky env if conky == nil then os.exit(1) end conky.config = { use_xft = true, font = 'DejaVu Sans:size=10', update_interval = 2, -- update every 2sec } function conky_rss() local rss_url = "https://torrentfreak.com/feed/" function get_all_rss_titles() local xml = io.popen('curl -s "'..rss_url..'"'):read('*all') local xml2lua = require("xml2lua") local handler = require("xmlhandler.tree") local parser = xml2lua.parser(handler) parser:parse(xml) local titles = {} for _, item in ipairs(handler.root.RSS.Channel.Item) do table.insert(titles, item.Title) end return titles end function display_next_title() local titles = get_all_rss_titles() local index = tonumber(os.date('%S')) % #titles + 1 local title = titles[index] return title end return display_next_title() end And I'm calling this script like that in Conky.text : ${color1} -> ${color0}${lua /home/Cthulhu/.conky/My_Script/Script_Sources/conky-rss.lua} It didn't show anything yet ... Any ideas to make it work or to improve it ?
has title: What's the best way to display a différent title of a post from TorrentFreak using RSS and Conky?
answer count: 1
score: 0
type: AnsweredQuestion
tagged with: conky
accepted answer: http://stackoverflow.com/a/77873224
type: Question
has answer: http://stackoverflow.com/a/77873224
tagged with: rss

http://stackoverflow.com/comment/137186835
comment on: http://stackoverflow.com/q/77815499
type: Comment
has text: @Luatic - It's an exercize from PiL4. `Figure 25.6` is just a code very similar to OP's code.
score: 0
type: QuestionComment

http://stackoverflow.com/q/77802584
tagged with: simulator
upvote count: 1
type: UnansweredQuestion
has title: Opening coppeliaSim with flag not working
favorite count: 0
has body: I am trying to open a TCP port on coppeliaSim to connect to, but when doing the command /Applications/coppeliaSim.app/Contents/MacOS/coppeliaSim -gREMOTEAPISERVERSERVICE_19999_FALSE_TRUE it opens coppeliaSim without the flagging i presume. When running my script to test it out: local sim = require("sim") function sysCall_init() local status, _info, _serverVersion, _clientVersion, _clientIp = simRemoteApi.status(19999) if status == -1 then print(Warning: you did not start CoppeliaSim in the way required to connect to the server. Please start with "-gREMOTEAPISERVERSERVICE_19999_FALSE_TRUE", using ./scripts/start_coppelia_sim ) end end it gives me the error: [string "/Robobo@childScript"]:5: attempt to index a nil value (global 'simRemoteApi') stack traceback: [string "/Robobo@childScript"]:5: in function 'sysCall_init' 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. Does anyone know how to resolve this issue?
answer count: 0
tagged with: websocket
type: Question
downvote count: 0
tagged with: macos
tagged with: flags
tagged with: lua
score: 1

sql
tags question: http://stackoverflow.com/q/77933538
tag name: sql
type: Tag

http://stackoverflow.com/q/77950812
tagged with: recursion
answer count: 1
favorite count: 0
has body: 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. 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) function fractal:compute(x,y) iteration = 1 local zx = 0 local zy = 0 while iteration < self.maxIterations and zx^2 + zy^2 < 4 do temp = zx if self.current == "Mandelbrot" then zx, zy = Mandelbrot(zx,zy,x,y) end iteration = iteration + 1 end return iteration end function Mandelbrot(zx, zy, x, y) return zx^2-zy^2+x, 2*zx*zy+y end I've tried to do this with a few methods, like using: x^2 + y^2 > 4 or iteration == maxIterations as the base case but for some reason it doesn't seem to work- such as this: function fractal:compute_Recursively(x,y, cx, cy, count) if count >= fractal.maxIterations or x^2 + y^2 >= 4 then return count else return self.compute_Recursively(x^2-y^2+cx, 2*x*y + cy, cx, cy, count+1) end end function formulae.Mandelbrot_Recursive(x, y, cx, cy, i) if i >= fractal.maxIterations or x^2 + y^2 >= 4 then return i else return formulae.Mandelbrot_R(x^2-y^2+cx, 2*x*y + cy, cx, cy, i+1) end end
tagged with: fractals
tagged with: lua
has comment: http://stackoverflow.com/comment/137423309
has answer: http://stackoverflow.com/a/77953378
type: Question
upvote count: 1
has title: How can I convert this iterative loop to a recursive one?
type: UnansweredQuestion
downvote count: 0
score: 1

return-value
tag name: return-value
tags question: http://stackoverflow.com/q/77789757
type: Tag

http://stackoverflow.com/comment/137286927
comment on: http://stackoverflow.com/q/77872527
type: Comment
score: 0
has text: 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/.
type: QuestionComment

http://stackoverflow.com/q/77866808
tagged with: roblox
has answer: http://stackoverflow.com/a/77871839
type: Question
has body: 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. Code: game.Players.PlayerAdded:Connect(function(plr) local ng = game.Workspace:FindFirstChild(plr.Name .. " / Banned") if ng:IsA("WedgePart") then plr:Kick("Banned") print(plr.Name .. " tried to join while banned") end end) script.Parent["Kick/Ban"].OnServerEvent:Connect(function(plr, plrname, reason, kb) if game.Players:FindFirstChild(plrname) then local target = game.Players:FindFirstChild(plrname) if kb == "Kick" then if reason ~= "" then target:Kick(reason) elseif reason == "" then target:Kick() end elseif kb == "Ban" then local part = Instance.new("WedgePart") print(target.Name .. " has been banned") part.Parent = game.Workspace part.Name = target.Name .. " / Banned" part.CanCollide = false part.Transparency = 1 part.Anchored = true target:Kick("Banned") elseif kb == "Unban" then local tn = plrname .. " / Banned" local part2 = game.Workspace:FindFirstChildOfClass("WedgePart") while part2 do if part2.Name:lower() == tn:lower() then part2:Destroy() print(target.Name .. " has been unbanned") break end part2 = game.Workspace:FindFirstChildOfClass("WedgePart", part2) end if not part2 then print(target.Name .. " is not banned") end end end end) Tried asking AI for help but got nothing. I think the main problem is in game.Players.PlayerAdded. Please help me.
tagged with: lua
possible better answer: http://stackoverflow.com/a/77867501
type: AnsweredQuestion
answer count: 2
has title: Why can't I unban player?
score: 0
accepted answer: http://stackoverflow.com/a/77871839
has answer: http://stackoverflow.com/a/77867501

http://stackoverflow.com/q/77852628
tagged with: parsing
tagged with: neovim-plugin
score: 0
has title: How to fix these parser errors that i am getting for my lazyvim installation on neovim
has answer: http://stackoverflow.com/a/77854053
type: Question
tagged with: tui
tagged with: lua
has body: 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 here is the error screenshot please help me I am stuck on this since 3 days 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
tagged with: treesitter
answer count: 1
type: UnansweredQuestion

convex
tag name: convex
type: Tag
tags question: http://stackoverflow.com/q/77904973

http://stackoverflow.com/q/77817799
type: UnansweredQuestion
score: 1
upvote count: 1
has body: 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. For the references per chapter, I found the following extension: https://github.com/pandoc-ext/section-bibliographies#quarto 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. Here is how I'm using the lua filter: filters: - section-bibliographies.lua #This is the lua filter stated above bibliography: rap_v002.bib citeproc: true 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: chapters: - abstract.qmd - index.qmd - dedication.qmd - acknowledgements.qmd - list_abbreviations.qmd - chapter_1_intro.qmd - chapter_2_lm.qmd - chapter_3_ml.qmd - chapter_4_conclusions.qmd - bibliography.qmd appendices: - appendices.qmd Inside the bibliography.qmd file I have the following: # References {.unnumbered} ::: {#refs} ::: I understand that the lua filter changes the pandoc behavior about those #refs to create the references per chapter. I have tried to change it without success. 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?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/137915107
downvote count: 0
answer count: 0
tagged with: lua
tagged with: quarto
tagged with: http://stackoverflow.com/tag/r
has title: How to create references per chapter and complete references section in quarto book pdf?
has comment: http://stackoverflow.com/comment/137198441

http://stackoverflow.com/comment/137199768
type: QuestionComment
has text: And your problem is?
comment on: http://stackoverflow.com/q/77824896
score: 1
type: Comment

http://stackoverflow.com/q/77864170
has answer: http://stackoverflow.com/a/77871793
has body: 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. the code in serverscriptservice: local Players = game:GetService("Players") local function leaderboardSetup(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local gold = Instance.new("IntValue") gold.Name = "Gold" gold.Value = 0 gold.Parent = leaderstats local function upd() gold.Value = gold.Value + 1 end game.ReplicatedStorage.GoldClick.OnServerEvent:Connect(function(Localplayer) if player.Name == Localplayer.Name then upd() end end) end Players.PlayerAdded:Connect(leaderboardSetup) the code in the object: script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.GoldClick:FireServer() end) i tried to make the leaderboard go up with the leaderstat name being "Gold", there were no errors but when i clicked the part it didn't go up.
tagged with: leaderboard
answer count: 1
score: 0
type: Question
tagged with: roblox
has title: how to increase leaderboard number on click event
tagged with: lua
type: UnansweredQuestion

http://stackoverflow.com/q/77837754
tagged with: lua
has comment: http://stackoverflow.com/comment/137223239
type: Question
has body: 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. 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. --Arbitary code: TextEditor = {39393, 739937} SomeString = "A very long novel" WriteString = function(str) --Some code to type to a text editor end OtherFunction = function(arg1, arg2) -- do something end AnotherFunction = function(arg1, arg2, arg3) -- do something end ReadSomething = function() -- arbitrary code end -- Problem: Script = { MoveMouseTo(TextEditor) WriteString(SomeString) OtherFunction(arg1, arg2) AnotherFunction(arg1, arg2, arg3) ReadSomeString() } f = 1 while IsKeyLockOn("scrolllock") && f <= Script.Length() do Script[f] f = f + 1 end 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.
tagged with: logitech-gaming-software
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77837947
answer count: 1
has title: How do I make a script that can run through a list of functions that I can stop at will? Lua 5.1 LGS
score: 0

http://stackoverflow.com/q/77899954
has body: I'm using mlua crate Im passing a struct to Lua as UserData which is mutable and Lua can modify the data, let lua = Lua::new(); let mut cars = Cars::new(); cars.add_car("Toyota".to_string(), "Corolla".to_string()); lua.globals().set("Cars", cars)?; and I should be able to pull the data back to Rust as its original Struct let final_cars: Cars = lua.globals().get("Cars")?; But the problem is I'm not sure how to convert the UserData back to Rust Struct when implementing the FromLua trait Here's the Full code use serde::{Deserialize, Serialize}; use mlua::{ FromLua, Lua, LuaSerdeExt, Value, Result, UserData, UserDataMethods}; #[derive(Default, Debug, Serialize, Deserialize, Clone )] struct Car { brand: String, model: String, } impl UserData for Car { } #[derive(Default, Debug, Serialize, Deserialize, Clone )] struct Cars { list: Vec<Car> } impl Cars { fn new() -> Self { Self { list: Vec::new() } } fn add_car(&mut self, brand: String, model: String) { self.list.push( Car { brand, model } ); } } impl UserData for Cars { fn add_methods<'lua, M: UserDataMethods<'lua, Self>>(methods: &mut M) { methods.add_method_mut("add", |_, this, (brand, model): (String, String)| { println!("added car lua [brand: {}, name: {}]", &brand, &model); this.list.push( Car { brand, model }); println!("{:#?}", this.list); Ok(()) }); } } impl<'lua>FromLua<'lua> for Cars { fn from_lua(value: Value<'lua>, lua: &'lua Lua) -> Result<Self> { // I cannot transform the userdata back to Cars // I've got an error saying "Error: DeserializeError("invalid type: userdata, expected table")" let list: Cars = lua.from_value(value)?; Ok( list ) } } fn main() -> Result<()> { let lua = Lua::new(); let mut cars = Cars::new(); cars.add_car("Toyota".to_string(), "Corolla".to_string()); println!("{:#?}", &cars); lua.globals().set("Cars", cars)?; //lua.create_ser_userdata(routes)? //lua.to_value(&routes)? lua.load(r#" local cars = Cars cars:add("Toyota", "Lua") cars:add("Honda", "Lua") print( type(cars) ) -- userdata pri…
type: Question
downvote count: 0
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/137336927
tagged with: rust
upvote count: 1
type: UnansweredQuestion
score: 1
has title: Coverting data back to Rust which is pass to Lua using mlua
favorite count: 0
has comment: http://stackoverflow.com/comment/137334861

http://stackoverflow.com/comment/137284580
comment on: http://stackoverflow.com/a/77871839
score: 0
type: AnswerComment
has text: :) I'm glad, I didn't actually test it.
type: Comment

http://stackoverflow.com/q/77927924
score: 2
tagged with: neovim
has answer: http://stackoverflow.com/a/78954259
has answer: http://stackoverflow.com/a/77951441
favorite count: 0
type: AnsweredQuestion
answer count: 3
type: Question
downvote count: 0
has body: Just starting to learn Neovim and I m struggling with something that might be a simple to fix for someone experienced. Using LazyVim distribution for Neovim which internally use Lazy.nvim as plugin manager and uses neo-tree as one of the plugins. I want to configure neo-tree plugin to show relative line numbers in its file explorer. Using this and this as referance, I made a new file in plugins/neo-tree.lua with this as contents: return { { "nvim-neo-tree/neo-tree.nvim", opts = { view = { relativenumber = true, }, }, }, } Now after this, when I restart, I should see line number but I don't. What could go wrong here? Note: When I m in the neo-tree buffer and i set number, I see line numbers.
accepted answer: http://stackoverflow.com/a/77951441
tagged with: lua
has answer: http://stackoverflow.com/a/77973239
has title: Add relative line numbers in neo-tree using Lazy in Neovim
upvote count: 2
possible better answer: http://stackoverflow.com/a/77973239

http://stackoverflow.com/q/77810553
has comment: http://stackoverflow.com/comment/137174263
has body: I'm trying to get the name of the file without the path and the extension in one go. I am using string.match and ([^\\/]+)$ to get rid of the path and then another string.match with (.+)%.[^.]+$ 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 string.match only once. Any way to combine the two regex codes? I've tried various other regex codes on the internet but it seems that Lua doesn't play well with all of them. In practice: entirepath = "C:/Users/mail/Desktop/Something/Test.mp3" justname = string.match(entirepath, "code that keeps only filename") print(justname) Result should be Test.
score: 2
tagged with: string
tagged with: lua-patterns
has title: Remove both path and extension from string in Lua
accepted answer: http://stackoverflow.com/a/77810559
tagged with: filenames
upvote count: 2
type: AnsweredQuestion
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/77810559
tagged with: path
type: Question
downvote count: 0
tagged with: lua

http://stackoverflow.com/comment/137339653
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77902368
has text: 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/)
score: 1

http://stackoverflow.com/comment/137288968
score: 0
type: QuestionComment
has text: 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".
type: Comment
comment on: http://stackoverflow.com/q/77872527

http://stackoverflow.com/tag/r
tag name: r
type: Tag
tags question: http://stackoverflow.com/q/77817799

http://stackoverflow.com/q/77899869
upvote count: 2
tagged with: lpeg
score: 2
tagged with: lua
downvote count: 0
has body: LPEG considers loop body consisting of lpeg.Cmt (…) empty under Lua 5.1, 5.2, 5.3, 5.4 and LuaJIT, even though I am sure that the function passed to lpeg.Cmt returns an advanced position, or false for failure. Minimal example causing 'loop body may accept empty string' error: local lpeg = require 'lpeg' local pattern = lpeg.Cmt (lpeg.P (true), function (s, p) local n = f (s, p) -- f is not calculatable beforehand. if not ((n or 0) &gt; 0) then return false -- cannot advance, therefore fail. else return p + n, string.sub (s, p, n) -- advance. end end) ^ 1 I don't know beforehand, how much or what kind of input lpeg.Cmt (…) will consume; but it will either consume some, or fail after the function returns false. Is there a workaround?
favorite count: 0
has answer: http://stackoverflow.com/a/77907650
type: AnsweredQuestion
answer count: 1
has title: lpeg.Cmt and empty loop body
accepted answer: http://stackoverflow.com/a/77907650
type: Question

http://stackoverflow.com/comment/137155892
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77799598
score: 0
has text: @VRehnberg Not afraid of lagging?

http://stackoverflow.com/comment/137333631
comment on: http://stackoverflow.com/q/77895884
type: QuestionComment
score: 2
type: Comment
has text: Is the question about Roblox?

http://stackoverflow.com/q/77944117
has comment: http://stackoverflow.com/comment/137413762
type: Question
answer count: 0
has title: LUA Script - Duplicating records using multiple delimited category fields
tagged with: lua
has body: Looking for help with a LUA script to duplicate records in a table when there are delimited records in multiple cells Sample data: Product Number Category Name Cat Order code 1 Category Name One,Category Name Two 3,4 2 Category Name Three, Category Name 4 2,1 This is how I need it to look: Product Number Category Name Cat Order Code 1 Category Name One 3 1 Category Name Two 4 2 Category Name Three 2 2 Category Name Four 1 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: for i = 1,records:size() do -- Get record i record = records:getrecord(i); -- Get the contents of the Category field categoryField = record:field("Category Name"):content(); -- Define a duplicates created counted n = 0; -- For each delimited value for k, v in string.gmatch(categoryField , "([^,]+)") do if (n == 0) then -- Remember the first value rememberMe = k; else -- For anything other than the first, duplicate the record newRecord = records:duplicaterecord(i); -- Define a unique key newRecord:field("Product number"):setcontent( newRecord:field("Product number"):content() .. "-" .. n); -- Set the new Category content newRecord:field("Category Name"):setcontent(k); end n = n + 1; end if n > 1 then -- If more than one duplicate was created, set the first value record:field("Category Name"):setcontent(rememberMe); end end
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137420634
score: 0

http://stackoverflow.com/comment/137346134
score: 0
comment on: http://stackoverflow.com/a/77906506
type: AnswerComment
has text: 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?
type: Comment

http://stackoverflow.com/a/77871839
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77866808
has comment: http://stackoverflow.com/comment/137284580
answers question: http://stackoverflow.com/q/77866808
has body: 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. 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. Something like the Below: local bannedPlayers = {} game.Players.PlayerAdded:Connect(function(plr) if bannedPlayers[plr.Name] then plr:Kick("Banned") print(plr.Name .. " tried to join while banned") end end) script.Parent["Kick/Ban"].OnServerEvent:Connect(function(plr, plrname, reason, kb) if game.Players:FindFirstChild(plrname) then local target = game.Players:FindFirstChild(plrname) if kb == "Kick" then if reason ~= "" then target:Kick(reason) elseif reason == "" then target:Kick() end elseif kb == "Ban" then print(target.Name .. " has been banned") bannedPlayers[plrname] = reason target:Kick("Banned") elseif kb == "Unban" then if bannedPlayers[plrname] then bannedPlayers[plrname] = nil print(target.Name .. " has been unbanned") else print(target.Name .. " is not banned") end end end end)

http://stackoverflow.com/comment/137229953
score: 2
type: Comment
has text: Close, instead of processing all indices, only traverse the first n-1, and use the last index to set `r[path[#path]] = value`. I would make a utility function instead of using metatables.
type: QuestionComment
comment on: http://stackoverflow.com/q/77838818

http://stackoverflow.com/q/77872527
type: Question
upvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/4845984
tagged with: shared-libraries
downvote count: 1
has comment: http://stackoverflow.com/comment/137286927
has comment: http://stackoverflow.com/comment/137288968
has comment: http://stackoverflow.com/comment/137286904
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/c
tagged with: macos
has title: Should C packages be compiled as modules rather than shared libraries for Lua?
tagged with: lua
answer count: 1
has body: In Lua, C packages are libraries of native code loaded from CPATH. There are two types of libraries that can be loaded dynamically: 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. In PiL, it's suggested that shared libraries should be used. This chapter even mentions "dynamic linking" multiple times, when in my opinion, it should be "dynamic loading". Am I misinterpreting this chapter? 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? I first started researching this because on macOS shared libraries have to have .dylib extension, and modules (or "bundles" in macOS terminology), can have any extension, and it's a very common practice in ported software to use .so extension (for example, CMake defaults when targeting macOS are CMAKE_SHARED_LIBRARY_SUFFIX=.dylib and CMAKE_SHARED_MODULE_SUFFIX=.so). Lua on macOS will only try to load libraries with .so extension with default CPATH.
linked to: http://stackoverflow.com/q/2339679
has answer: http://stackoverflow.com/a/77878004
score: 0

http://stackoverflow.com/a/77951441
score: 5
accepted answer of: http://stackoverflow.com/q/77927924
answers question: http://stackoverflow.com/q/77927924
has body: There is no relativenumber option for the nvim-neo-tree/neo-tree.nvim plugin. You are confusing with the nvim-tree/nvim-tree.lua plugin (discussion about this option). For the neo-tree.nvim plugin, you could enable relativenumber with Lazy via event_handlers: return { "nvim-neo-tree/neo-tree.nvim", opts = { event_handlers = { event = "neo_tree_buffer_enter", handler = function() vim.opt_local.relativenumber = true end, }, }, }
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0

http://stackoverflow.com/q/77829116
has answer: http://stackoverflow.com/a/77830864
accepted answer: http://stackoverflow.com/a/77830864
tagged with: neovim
type: Question
has body: 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. In my Lazy options, I have netrw in teh disabled_plugins section and I am importing my plugins directory which contains the nvim-tree 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. Here are some of the files that I think are relevant to this problem: This is nvim/lua/moorby/lazy.lua: local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) local opts = { defaults = { lazy = true, }, install = { colorscheme = { "monokai" } }, rtp = { disabled_plugins = { "gzip", "matchit", "matchparen", "netrw", "netrwplugin", "tarplugin", "tohtml", "tutor", "zipplugin", } }, change_detection = { enabled = true, notify = true, }, } require("lazy").setup( { {import = "moorby.plugins"} }, opts ) nvim/lua/moorby/plugins/nvim-tree.lua return { "nvim-tree/nvim-tree.lua", filters = { dotfiles = true, }, lazy = false } nvim/lua/moorby/plugins/colorscheme.lua (my colorscheme is loading fine by the way) return { "tanvirtin/monokai.nvim", lazy = false, priority = 999, config = {}, } In this screenshot, you can see netrw in the background and you can see that nvim-tree has been successfully loaded by Lazy: EDIT: I just noticed that the plugin being imported is nvim-tree.LUA not nvim-tree.NVIM but I tried to change this and it does not work so I think .lua is still correct and that is definitely the URL of the repo.
favorite count: 0
upvote count: 4
downvote count: 0
has title: How to get neovim to use nvim-tree instead of netrw?
answer count: 1
tagged with: lua
type: AnsweredQuestion
score: 4

http://stackoverflow.com/a/77837947
has body: This is the answer: ArbitraryFunction = function(a,b) print(a .. &quot; + &quot; .. b .. &quot; = &quot; .. a+b) end Script = { function() ArbitraryFunction(1,1) end, function() ArbitraryFunction(2,3) end, } this = true; for _, f in pairs(Script) do if this == true then f() end end
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77837754

http://stackoverflow.com/comment/137203985
score: 0
has text: 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?
comment on: http://stackoverflow.com/q/77826394
type: Comment
type: QuestionComment

http://stackoverflow.com/q/77789112
score: 1
upvote count: 1
answer count: 1
favorite count: 0
tagged with: roblox
downvote count: 0
tagged with: luau
tagged with: lua
has title: The Error Argument 3 missing or nil : Script Troubleshooting
type: Question
has body: 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 local ReplicatedStorage = game:GetService("ReplicatedStorage") local TweenService = game:GetService("TweenService") local Players = game:GetService("Players") local Player = Players.LocalPlayer local PlayerGui = Player:WaitForChild("PlayerGui") local Remotes = ReplicatedStorage:WaitForChild("Remotes") local Rng = Random.new() local function AnimateBuild(Model) for _, v in Model:GetDescendants() do if v:IsA("BasePart") or v:IsA("UnionOperation") then local OriginalCFrame = v.CFrame local OriginalSize = v.Size local OriginalTransparency = v.Transparency local PositionOffset = Vector3.new(Rng:NextNumber(-2, 2), Rng:NextNumber(-2, 2)) local RotationOffset = CFrame.Angles(Rng:NextNumber(-3, 3), Rng:NextNumber(-3, 3)) v.CFrame = v.CFrame * CFrame.new(PositionOffset) * RotationOffset v.Transparancy = 1 TweenService:Create(v, TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {CFrame = OriginalCFrame}):Play() TweenService:Create(v, TweenInfo.new(0.25, Enum.EasingStyle.Quart, Enum.EasingDirection.Out), {Transparency = OriginalTransparency}):Play() end end end Remotes:WaitForChild("BuildAnimation").OnClientEvent:Connect(function(Model) print("CALLED ANIMATION") AnimateBuild(Model) end) i have not tyyend enything idk what to do
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77789666

http://stackoverflow.com/q/77789757
answer count: 1
has title: cannot load() returned values from string
has answer: http://stackoverflow.com/a/77790137
favorite count: 0
tagged with: return-value
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/77790137
type: Question
upvote count: 1
has body: I have this assignment from the official book about lua: Exercise 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. Like 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. function loadwithprefix(prefix, chunk) local prefixflg = true return function(...) local x = select(1, ...) local env = { x = x, __index = { _G = _G } } if not prfxflg then prfxflg = true return load(prefix, nil, nil, env) else return load(' return ' .. code(), nil, nil, env) end end end local line = io .read() local f = loadwithprefix('local x = ...; return x ', function(...) return line end) for i = 1, 10 do print(string.rep('*', f(i)())) end 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?
tagged with: lua
downvote count: 0
score: 1
tagged with: load

http://stackoverflow.com/a/77959479
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/137438248
answers question: http://stackoverflow.com/q/77959155
score: 1
has comment: http://stackoverflow.com/comment/137438282
upvote count: 1
has body: Newer versions of Lua have replaced gfind with gmatch, replace the function in the code to match your version. 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. local S = "564186207, 399.4989929 , ABC, degds, 2425, 335.232" local pattern = "(%d+%.?%d*)" --Any number of digits, followed by an optional 'dot' and then zero or more digits (this could match against "123." but given your example input it hopefully won't be an issue local matches = string.gmatch(S,pattern) for found in matches do print("Matched:",found) end Outputs: Matched: 564186207 Matched: 399.4989929 Matched: 2425 Matched: 335.232
accepted answer of: http://stackoverflow.com/q/77959155
downvote count: 0

http://stackoverflow.com/q/77884118
tagged with: roblox
has answer: http://stackoverflow.com/a/77885012
tagged with: lua
has body: 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. When I run the function again, the function overlaps the other previously ran function. The script: local eids = script.Parent.EnemyIDSelected local userinput = game:GetService("UserInputService") local frame = script.Parent.Parent.Parent local enemycount = frame.Enemies.NumberOfEnemies local enemyorder = frame.Enemies.Frame:WaitForChild("EnemyOrder") userinput.InputBegan:Connect(function(input,gameProcessedEvent) if input.KeyCode == Enum.KeyCode.A or input.KeyCode == Enum.KeyCode.Left then eids.Value = eids.Value - 1 elseif input.KeyCode == Enum.KeyCode.D or input.KeyCode == Enum.KeyCode.Right then eids.Value = eids.Value + 1 end end) eids.Changed:Connect(function() if eids.Value > enemycount.Value then eids.Value = 1 elseif eids.Value < 1 then eids.Value = enemycount.Value end end) eids.Changed:Connect(function() local number = 0 local function findenemies() local enemycount = frame.Enemies.NumberOfEnemies.Value local enemies = {} local ordernumber = 1 for i, v in pairs(enemyorder:GetChildren()) do if string.sub(v.Name, 1, 5) == "Order" then enemies[ordernumber] = v.Value if ordernumber == enemycount then return enemies end ordernumber = ordernumber + 1 end end end local enemies = findenemies() -- while wait() do for i, v in pairs(enemies) do if i == eids.Value then print(number) script.Parent.ImageLabel.TextLabel.Text = enemies[i].EnemyValue.Value enemies[i].ImageColor3 = Color3.fromRGB(80, 80, 80) for i2, v2 in pairs(enemies) do if v2 ~= enemies[i] then v2.ImageColor3 = Color3.fromRGB(80, 80, 80) end end wait(0.15) enemies[i].ImageColor3 = Color3.fromRGB(255, 255, 255) wait(0.15) number = number + 1 end end end end) When I run the function again, the function overlaps the other previously ran function.
type: UnansweredQuestion
has title: Roblox Studio - Function unintentionally running multiple times at once
answer count: 1
score: 0
type: Question

http://stackoverflow.com/q/77802738
has comment: http://stackoverflow.com/comment/137161769
tagged with: lua
tagged with: domoticz
type: UnansweredQuestion
score: 1
upvote count: 1
favorite count: 0
has body: since the 2024,1 Domoticz version I have errors with Lua scripts controlling my Heatzy module. the error is : Error: EventSystem: in HeatzyStatusSalon: [string "json = (loadfile "/home/pi/domoticz/scripts/l..."]:20: attempt to index a nil value (field 'attr') my script is : json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")() -- For Linux enlever les -- devant la ligne qui vous interesse et mettre -- devant la ligne a commenter -- json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")() -- For raspberry enlever les -- devant la ligne qui vous interesse et mettre -- devant la ligne a commenter -- json = (loadfile "D:\\Domoticz\\scripts\\lua\\json.lua")() -- For Windows enlever les -- devant la ligne qui vous interesse et mettre -- devant la ligne a commenter -- json = (loadfile "/volume1/@appstore/domoticz/var/scripts/lua/json.lua")() -- For Syno enlever les -- devant la ligne qui vous interesse et mettre -- devant la ligne a commenter --variable a configurer did = 'MYDID' --did que l'on a trouvé, on garde les '' selectorheatzy = 'Chauffage Salon' --nom de votre inter selecteur qui pilote le heatzy on garde les '' --fin des variable a configurere --ligne de commande qui interoge les serveur heatzy pour le retour d'etat 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\'')) --parsing du json local blocjson = config:read('*all') config:close() --print (blocjson) local jsonValeur = json:decode(blocjson) mode = jsonValeur.attr.mode --print('****************') --print(mode) commandArray = {} if mode == 'stop' and otherdevices[selectorheatzy]~='Off' then print("heatzy le radiateur est passé en mode Stop") commandArray[selectorheatzy]='Set Level: 0' elseif mode == 'cft' and otherdevices[selectorheatzy]~='Confort' then print("heatzy le radiateur est passé en mode Confort") commandArray[selectorheatzy]='Set …
has title: I'd like to fix an Lua script in Domoticz to control my heating module
type: Question
downvote count: 0
answer count: 0

http://stackoverflow.com/q/77935205
tagged with: http://stackoverflow.com/tag/html
has body: i need help about opening vlc with html deeplink I have already a ps1 script for add registry key, a URL Protocol on "vlcurl", so on my html : Video The big issue with this is the redirection, vlc try to open the link with the "vlcurl" at the start causing issue : Your input can't be opened: VLC is unable to open the MRL 'vlcurl:http://127.0.0.1:5500/ship.mp4'. Check the log for details. The goal is to remove the "vlcurl" when we send this to vlc 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 "vlcurl" in the "%1" remove it) but apparently we can't 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
type: UnansweredQuestion
has title: Html video to vlc deep link
tagged with: vlc
score: 0
has comment: http://stackoverflow.com/comment/137396484
type: Question
answer count: 0
tagged with: registry
tagged with: lua
has comment: http://stackoverflow.com/comment/137395911

http://stackoverflow.com/q/77961269
score: 0
type: AnsweredQuestion
has body: I want to make function which returns multiple variants "how to use function": var.get(a:number): any next is var.get(a:string,b:number): any next is var.get(): any. I know by Roblox Lua (LuaU) it's possible and it returns as pages like I did upper. How can I make same? (please provide code) I'm sure it should be one function but how it returns multiple variants of how to use it? I tried: local var={} function var.get(a:number):any -- some code here end function var.get():any -- some code here end But it didn't worked.
possible better answer: http://stackoverflow.com/a/77962694
tagged with: luau
has answer: http://stackoverflow.com/a/77965863
tagged with: lua
has title: How to make multi-argument choose function in LuaU?
type: Question
tagged with: roblox
accepted answer: http://stackoverflow.com/a/77965863
has answer: http://stackoverflow.com/a/77962694
answer count: 2

http://stackoverflow.com/comment/137349525
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77904973
has text: `y1 - y2` vs `x2 - x1` doesn't look right. One of these is probably swapped.

http://stackoverflow.com/q/77846650
downvote count: 0
has comment: http://stackoverflow.com/comment/137238908
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/137238931
has comment: http://stackoverflow.com/comment/137238943
has title: lua script not able to consume env variables in a docker container
tagged with: lua
type: UnansweredQuestion
favorite count: 0
tagged with: environment-variables
has body: Having the following Dockerfile FROM openresty/openresty:alpine RUN apk update && apk add bash \ && apk add gettext envsubst ENV REDIS_HOST \ REDIS_PORT \ REDIS_FULL_KEY_PREFIX \ HTTP_PROTOCOL \ WEB_HOST \ UPSTREAM_HOST \ PROXYPASS_NAME RUN echo "env REDIS_HOST; env REDIS_PORT; env REDIS_FULL_KEY_PREFIX; env HTTP_PROTOCOL; env WEB_HOST; env UPSTREAM_HOST; env PROXYPASS_NAME;" > /usr/local/openresty/nginx/conf/lua-config.lua COPY nginx.conf.template /usr/local/openresty/nginx/conf/nginx.conf.template COPY test.lua /usr/local/openresty/nginx/conf ENTRYPOINT ["/bin/sh", "-c", "envsubst '${REDIS_HOST} ${REDIS_PORT} ${REDIS_FULL_KEY_PREFIX} ${HTTP_PROTOCOL} ${WEB_HOST} ${UPSTREAM_HOST} ${PROXYPASS_NAME}' < /usr/local/openresty/nginx/conf/nginx.conf.template > /usr/local/openresty/nginx/conf/nginx.conf && /usr/local/openresty/bin/openresty -g 'daemon off;error_log /dev/stdout debug;'"] my nginx.conf where I call the lua script than it looks as it follows: location ^~ /pages { rewrite_by_lua_file conf/test.lua; # more code } I'm using docker compose to bring up the container openresty: build: context: . dockerfile: Dockerfile environment: REDIS_HOST: redis REDIS_FULL_KEY_PREFIX: "blah_blah" HTTP_PROTOCOL: "http://" WEB_HOST: localhost PROXYPASS_NAME: nginx UPSTREAM_HOST: localhost depends_on: - nginx networks: - proxynet - redis I'm not able to consume in lua the ENV variables. For example when I try to get for example the REDIS_HOST env in my test.lua I get script nil local cueRedisFqhn = os.getenv("REDIS_HOST") local redisPort = os.getenv("REDIS_PORT") or "6379" ngx.log(ngx.NOTICE, cueRedisFqhn) How can adjust the dockerfile to make it available?
upvote count: 1
tagged with: docker
type: Question

http://stackoverflow.com/comment/137377295
type: QuestionComment
has text: Why do you need Cygwin here? Just install MSYS2 and use MinGW64 for all your builds.
comment on: http://stackoverflow.com/q/77922338
type: Comment
score: 0

http://stackoverflow.com/a/77927881
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77918731
has comment: http://stackoverflow.com/comment/137393503
has body: I want to give you two links that are related to your issue and an explanation: https://devforum.roblox.com/t/isloaded-is-intermittently-returning-false-for-successfully-loaded-audio/2809379 https://create.roblox.com/docs/reference/engine/classes/ContentProvider#RequestQueueSize In the last link I linked, it says the following: 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). 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. 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. 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: local retryLimit = 12 local retryCount = 0 repeat task.wait(2) retryCount+= 1 until ContentProvider:GetAssetFetchStatus(DayTheme) == Enum.AssetFetchStatus.Success or retryCount &gt; retryLimit
upvote count: 1
answers question: http://stackoverflow.com/q/77918731
score: 1
has comment: http://stackoverflow.com/comment/137391312

http://stackoverflow.com/comment/137225598
has text: Nice idea. Unfortunately it doesn't work. `attempt to call field 'shallow_copy' (a nil value)`
comment on: http://stackoverflow.com/q/77824918
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/137137086
comment on: http://stackoverflow.com/q/77789995
score: 0
type: QuestionComment
has text: Question edited. Tell me if if my proposal is a good idea. I forgot the `method` argument in my original code.
type: Comment

http://stackoverflow.com/q/77824918
linked to: http://stackoverflow.com/q/640642
has body: 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. 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. Server-side code util.AddNetworkString("SendToPlayer") util.AddNetworkString("UpdateConfig") local config --[[ Config Strucktur ["bind"] = KEY_H ["enabled"] = 1 ["probability"] = 50 ["treatment_time"] = 1 ["ui_scale"] = 1 ]]-- hook.Add("Initialize", "Create_base", function() sql.Query("DROP TABLE medical_config") if not sql.Query("SELECT * FROM medical_config") then sql.Query("CREATE TABLE medical_config (enabled BIT, probability TINYINT, ui_scale TINYINT, treatment_time TINYINT, bind TEXT)") sql.Query("INSERT INTO medical_config (enabled, probability , ui_scale , treatment_time , bind ) VALUES ('1', '50', '1', '1', 'KEY_H')") end config = sql.Query("SELECT * FROM medical_config")[1] end) hook.Add("PlayerSpawn", "Start", function(ply) if config["enabled"] == "1" then local steamID64 = ply:SteamID64() if not sql.Query("SELECT * FROM " .. sql.SQLStr(steamID64)) then -- Tabelle existiert nicht, erstelle sie und füge Initialdaten hinzu sql.Query("CREATE TABLE " .. sql.SQLStr(steamID64) .. " (injury TEXT, treatment_step_1 BIT, treatment_step_2 BIT, treatment_step_3 BIT, treatment_step_4 BIT )") sql.Query("INSERT INTO " .. sql.SQLStr(steamID64) .. " VALUES ('Test', 1, 1, 1, 1)") send_config() else -- Tabelle existiert bereits, setze sie zurück sql.Query("DROP TABLE " .. sql.SQLStr(steamID64)) sql.Query("CREATE TABLE " .. sql.SQLStr(steamID64) .. " (injury TEXT, treatment_step_1 BIT, treatment_step_2 BIT, treatment_step_3 BIT, treatment_step_4 BIT )") sql.Query("INSERT INTO " .. sql.SQLStr(steamID64) .. " VALUES ('Test', 1, 1, 1, 1)")…
tagged with: garrys-mod
has comment: http://stackoverflow.com/comment/137203231
tagged with: lua
type: UnansweredQuestion
score: 0
has title: I have a problem with a table, values are being changed that wouldn't normally be able to be changed
has comment: http://stackoverflow.com/comment/137208284
has comment: http://stackoverflow.com/comment/137204008
type: Question
has comment: http://stackoverflow.com/comment/137204366
has comment: http://stackoverflow.com/comment/137203974
has comment: http://stackoverflow.com/comment/137235098
answer count: 0
has comment: http://stackoverflow.com/comment/137225598

http://stackoverflow.com/a/77880646
has comment: http://stackoverflow.com/comment/137304275
has body: I'm not sure entirely what your problem is here, but I can see an issue right off the bat. Firstly, on your elseif line you are trying to compare a number, lastIDInt, with a string '1' . This just will not work so you should compare it with a number: lastIDInt &gt;= 1 I cannot see anywhere in your code that would cause the error you are describing however, but the above may fix your problem.
answers question: http://stackoverflow.com/q/77879660
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/137306323

http://stackoverflow.com/q/77800090
has answer: http://stackoverflow.com/a/77800109
tagged with: resources
accepted answer: http://stackoverflow.com/a/77800109
type: AnsweredQuestion
answer count: 1
score: 0
type: Question
has title: Try to run resource and got " '}' expected (to close '{' at line 5) near "
tagged with: lua
tagged with: fivem
has body: Tried to run a FXManifest for my Resource and got &quot; Error: CAK-Sounds failed to load: Could not parse resource metadata file D:/txData/ESXLegacy_99D8F7.base/resources//[carsounds]/CAK-Sounds/fxmanifest.lua: CAK-Sounds/fxmanifest.lua:85: '}' expected (to close '{' at line 5) near ''audioconfig/488sound_game.dat151.rel''&quot; My Manifest looks like this fx_version 'adamant' game 'gta5' files { 'audioconfig/lambov10_game.dat151.rel', 'audioconfig/lambov10_sounds.dat54.rel', 'sfx/dlc_lambov10/lambov10.awc', 'sfx/dlc_lambov10/lambov10_npc.awc', 'audioconfig/musv8_game.dat151.rel', 'audioconfig/musv8_sounds.dat54.rel', 'sfx/dlc_musv8/musv8.awc', 'sfx/dlc_musv8/musv8_npc.awc', 'audioconfig/brabus850_game.dat151.rel', 'audioconfig/brabus850_sounds.dat54.rel', 'sfx/dlc_brabus850/brabus850.awc', 'sfx/dlc_brabus850/brabus850_npc.awc', 'audioconfig/shonen_game.dat151.rel', 'audioconfig/shonen_sounds.dat54.rel', 'sfx/dlc_shonen/shonen.awc', 'sfx/dlc_shonen/shonen_npc.awc', 'audioconfig/toysupmk4_game.dat151.nametable', 'audioconfig/toysupmk4_game.dat151.rel', 'audioconfig/toysupmk4_sounds.dat54.nametable', 'audioconfig/toysupmk4_sounds.dat54.rel', 'sfx/dlc_toysupmk4/toysupmk4.awc', 'sfx/dlc_toysupmk4/toysupmk4_npc.awc', 'audioconfig/rb26dett_amp.dat10.rel', 'audioconfig/rb26dett_game.dat151.rel', 'audioconfig/rb26dett_sounds.dat54.rel', 'sfx/dlc_rb26dett/rb26dett.awc', 'sfx/dlc_rb26dett/rb26dett_npc.awc', 'audioconfig/rotary7_game.dat151.rel', 'audioconfig/rotary7_sounds.dat54.rel', 'sfx/dlc_rotary7/rotary7.awc', 'sfx/dlc_rotary7/rotary7_npc.awc', 'audioconfig/m297zonda_amp.dat10.nametable', 'audioconfig/m297zonda_amp.dat10.rel', 'audioconfig/m297zonda_game.dat151.nametable', 'audioconfig/m297zonda_game.dat151.rel', 'audioconfig/m297zonda_sounds.dat54.nametable', 'audioconfig/m297zonda_sounds.dat54.rel', 'sfx/dlc_m297zonda/m297zonda.awc', 'sfx/dlc_m297zonda/m297zonda_npc.awc', 'audioconfig/m158huayra_amp.dat10.nametable', 'audioconfig/m158huayra_amp.dat10.rel', 'audioconfi…

http://stackoverflow.com/a/77924414
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/137377405
has comment: http://stackoverflow.com/comment/137377378
has body: I changed 1 to 0 like this get_services_result[0].name and it works. But doesn't subscript in lua start from 1?
answers question: http://stackoverflow.com/q/77924312
score: 0
accepted answer of: http://stackoverflow.com/q/77924312

mingw-w64
type: Tag
tags question: http://stackoverflow.com/q/77922338
tag name: mingw-w64
tags question: http://stackoverflow.com/q/79200725

http://stackoverflow.com/q/77930867
tagged with: game-development
score: 0
has body: I have an object moving "freely" with body:applyForce( x, y ). I want to track it's previous position. 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. 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. 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. object = {} object.x = 250 object.y = 200 object.body = love.physics.newBody(world, object.x, object.y, 'dynamic') object.shape = love.physics.newCircleShape(5) object.fixture = love.physics.newFixture(object.body, object.shape, 1) -- object.body:applyForce( 5, 0 ) -- the object is moving to the right, on the x-axis what i want is to track it's position while it's traveling. something like function objectTracking() timer = timer + dt -- if timer == 0 then varPreviousPositionX = object.body:getX() varPreviousPositionY = object.body:getY() elseif timer == 1 then timer = 0 end end that doesn't work. just wanted to write something quick to help you see the problem.
type: Question
has title: How to get the position of a moving object once? without it being updated
tagged with: lua
tagged with: lua-table
has answer: http://stackoverflow.com/a/77933920
tagged with: love2d
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137388806

http://stackoverflow.com/q/77951468
type: UnansweredQuestion
tagged with: vim-plugin
tagged with: neovim
upvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/137429981
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/137430818
has comment: http://stackoverflow.com/comment/137428343
has body: I installed indent-blankline https://github.com/lukas-reineke/indent-blankline.nvim 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? lua &lt;&lt; EOF require('ibl').setup{} EOF
has title: Neovim: indent-blankline plugin, can't configure mixed indentation
type: Question
answer count: 0
tagged with: lua

http://stackoverflow.com/comment/137439013
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77959155
has text: `for found in S:gmatch("[%d%.]+") do print(found) end`
type: Comment

http://stackoverflow.com/comment/137319305
comment on: http://stackoverflow.com/a/77890429
type: Comment
score: 0
type: AnswerComment
has text: Apparently this may have been something related to lsp

http://stackoverflow.com/comment/137438282
comment on: http://stackoverflow.com/a/77959479
has text: Thank you so much. you solve all of my problem
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137396077
type: QuestionComment
score: 0
type: Comment
has text: The correct tag is `lua-api`
comment on: http://stackoverflow.com/q/77930478

http://stackoverflow.com/comment/137418709
comment on: http://stackoverflow.com/a/77933920
has text: How does your code currently look like? It might be that scoping is incorrectly defined, or the function is called within the same frame.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/137203231
score: 0
comment on: http://stackoverflow.com/q/77824918
type: Comment
has text: `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.
type: QuestionComment

http://stackoverflow.com/comment/138978446
type: QuestionComment
has text: Hey did you find out how to do this? I'm trying to do the same.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77913819

http://stackoverflow.com/a/77899918
type: Answer
has body: %W is the complement of %w, meaning it matches all non-alphanumeric characters. From §6.4.1 – Patterns (Lua 5.4): %w: represents all alphanumeric characters. 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.
downvote count: 0
answers question: http://stackoverflow.com/q/77899840
score: 6
upvote count: 6

http://stackoverflow.com/q/77815499
tagged with: lua
tagged with: debugging
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/77824030
has comment: http://stackoverflow.com/comment/137186835
answer count: 1
has body: -- 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? local debug = require "debug" -- Maximum "steps" that can be performed local steplimit = 1000 local count = 0 -- Counter for steps -- Set of authorized functions local validfunc = {} -- Hook function to check if the called function is authorized local function hook(event) local info if event == "call" then local info = debug.getinfo(2, "fn") if not validfunc[info.func] then error("calling bad function: " .. (info.name or "?")) end end count = count + 1 if count > steplimit then error("script uses too much CPU") end print(string.format('func_name:%s, count:%d', info.name, count)) end -- Load chunk local chunkEnv = setmetatable({}, { __index = _G }) local f, errorMsg = loadfile("test_lua_exercise_25_8.lua", "t", chunkEnv) if not f then error("Error loading file: " .. errorMsg) end -- Set hook debug.sethook(hook, "c", 100) -- Run chunk f() -- Capture the functions defined in the chunk and add them to the validfunc table for k, v in pairs(chunkEnv) do if type(v) == "function" then validfunc[k] = true end end -- Set hook to nil to disable it after the execution debug.sethook() -- Print the authorized functions for k, v in pairs(validfunc) do print(k, v) end test_lua_exercise_25_8.lua local debug = require "debug" local count = 0 local function hook (event) if event == "call" then local info = debug.getinfo(1, "fn") end count = count + 1 if count > 1000 then error("script uses too much CPU") end end for i = 1, 10 do hook('call') end 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.
has comment: http://stackoverflow.com/comment/137187816
type: Question
has title: account local functions as valid while making a debugger in lua
has comment: http://stackoverflow.com/comment/137184547

http://stackoverflow.com/q/77863272
type: Question
has answer: http://stackoverflow.com/a/77870019
tagged with: lua
has title: Grapple hooking with LineForces in Roblox Studio?
has body: 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 very confused. I tried using this code: local player = game.Players.LocalPlayer local HumanoidRootPart = player.Character:WaitForChild("HumanoidRootPart") local mouse = player:GetMouse() local debounce = false local mouseDown = false local MaxDistance = 300 local Magnitude = 10000 local RopeVisible = true local RopeColor = BrickColor.new("Cocoa") local function distance_between_vectors(u, v) local difference = u - v local distance = difference.Magnitude distance = math.floor(distance / 1 + 0.5) * 1 return distance end local function Attachment(method, parent) if method == "Create" then local Attachment = Instance.new("Attachment") Attachment.Parent = parent else parent.Attachment:Destroy() end end mouse.Button1Up:Connect(function() mouseDown = false end) mouse.Button1Down:Connect(function() mouseDown = true if debounce == false then debounce = true local hitPosition = mouse.Hit.Position local distance = distance_between_vectors(hitPosition, HumanoidRootPart.Position) if distance <= MaxDistance then local newPart = Instance.new("Part") newPart.Anchored = true newPart.Parent = game.Workspace newPart.Position = hitPosition newPart.Transparency = 0 Attachment("Create", newPart) Attachment("Create", HumanoidRootPart) local Rope = Instance.new("LineForce") Rope.Parent = newPart Rope.Attachment0 = newPart.Attachment Rope.Attachment1 = HumanoidRootPart.Attachment Rope.Magnitude = Magnitude Rope.Visible = RopeVisible Rope.Color = RopeColor Rope.MaxForce = 1000 while mouseDown == true do wait() end Attachment("Destroy", newPart) Attachment("Destroy", HumanoidRootPart) newPart.LineForce:Destroy() newPart:Destro…
accepted answer: http://stackoverflow.com/a/77870019
tagged with: roblox-studio
type: AnsweredQuestion
answer count: 1
score: 0

http://stackoverflow.com/q/77959155
has title: How to capture the integer or point number from string?
tagged with: match
tagged with: lua
type: Question
accepted answer: http://stackoverflow.com/a/77959479
tagged with: string
has answer: http://stackoverflow.com/a/77959479
has body: I have this string S = "564186207, 399.4989929 , ABC, degds, 2425, 335.232" and I want to capture the only integer and point number. Like this: string.gfind(S, ???) --> 564186207, 399.4989929, 2425, 335.232 I have tried: string.gfind(S, "%d+") string.gfind(S, "%d\*") string.gfind(S, "^%d") How can I capture the only number from that string?
answer count: 1
score: 0
type: AnsweredQuestion
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/137439013

http://stackoverflow.com/a/78294674
has comment: http://stackoverflow.com/comment/138051217
answers question: http://stackoverflow.com/q/77891743
has body: There are 3 issues: HealthDisplayDistance isn't actually the player's health. You're trying to get the player from StarterPlayer, which isn't the player. You're trying to change the player's health, but you have to do it by changing the Health property in the character's humanoid. You can do that by doing these changes to the script: local Object = game.Workspace.Baseplate local Killbrick = game.Workspace.Part --I only set the variable here because it's recommended to set the variables before doing anything to the script. Object.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. Character.Parent:WaitForChild("Humanoid").Health = 50 end) That should work. 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 "decrease that person's health", and you can't decrease a person's health from their minds, but from their heart (damaging the heart). I hope you understood. Extra: StarterPlayer is where you will put scripts which can be either in the model which is in the Workspace, also known as character or you can put scripts in the actual player, which can be found in Players. This is just a image to show what's the Players object:
score: 0
type: Answer

http://stackoverflow.com/comment/137187816
comment on: http://stackoverflow.com/q/77815499
has text: Why can't you make it run? Any errors?
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/77892559
answer count: 1
has comment: http://stackoverflow.com/comment/137320371
has answer: http://stackoverflow.com/a/77895334
type: Question
has title: Getting Error with high_phone script on fivem
upvote count: 0
tagged with: lua
tagged with: fivem
has body: 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' MySQL.Async.fetchScalar("SELECT `id` FROM phone_mail WHERE `owner` = @owner AND `subject` = @subject ORDER BY `id` DESC LIMIT 1", {}, function(_ARG_0_) ({}).id = _ARG_0_ ;({}).subject = _UPVALUE1_ if "table" ~= type(_UPVALUE2_) or _UPVALUE2_ then end ;({}).recipients, ({})[1] = {}, _UPVALUE2_ ;({}).address = _UPVALUE3_.address ;({}).name = _UPVALUE3_.name ;({}).sender, ({}).photo = {}, _UPVALUE3_.photo ;({}).content = _UPVALUE4_ ;({}).time = _UPVALUE5_ ;({}).attachments = _UPVALUE6_ TriggerClientEvent("high_phone:receivedMail", _UPVALUE0_.source, {}) end end) We tried to remove and set new ) but nothing happend so the code is back in normal condition
type: UnansweredQuestion
favorite count: 0
score: -1
downvote count: 1

http://stackoverflow.com/q/77826394
has comment: http://stackoverflow.com/comment/137204565
answer count: 1
has answer: http://stackoverflow.com/a/77834599
has comment: http://stackoverflow.com/comment/137206946
tagged with: calculus
score: 0
type: Question
has body: 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 function derivative(Function, x) local dxlog = math.log(Function(x), x) return dxlog * x^(dxlog - 1) end print(derivative(function(x) return x^3 end, 10)) and its so bad it cant even calculate y^x with respect to x.. tried everything I can think of, too dumb to fix this btw this is the old way I did this: function derivative(Function, x) local d = (Function(x + 6.7219579999763e-006) - Function((x - 6.7219579999763e-006))) / 1.3443915999953e-005 if math.abs(math.round(d) - d) &lt; 4.1212121212e-6 then return math.round(d) end return d end
has title: Can't find out how to compute derivative
tagged with: lua
has comment: http://stackoverflow.com/comment/137203985
type: UnansweredQuestion

http://stackoverflow.com/comment/137223239
score: 0
has text: Right now you never actually execute the script, only fetch it from the Script array.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77837754

http://stackoverflow.com/q/77941484
tagged with: class
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/137406548
favorite count: 0
tagged with: object
downvote count: 0
score: 1
tagged with: oop
tagged with: lua
has title: Approaching OOP in Lua
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77941555
tagged with: metatable
has body: this is the first time I try to apply OOP in Lua. This class is a derivative of the "Frame" class already present in the game LibListView = {} function LibListView:New(self) local listviewmt = { buttons = {}, data = {}, initiated = true, OldSetScript = SetScript, SetScript = nil, -- more parameters and methods SetScript = function(self,handler,fnctn) local scripts = "OnHide,OnLoad,OnMouseWheel,OnSizeChanged,OnShow,OnUpdate" if string.find(scripts,handler) then self:HookScript(handler,fnctn) else self.OldSetScript(handler,fnctn) end end, } setmetatable(self, { __index = setmetatable(listviewmt, getmetatable(self)) }) -- not simply setmetatable(main, class) to avoid already present meta overwritting end If I write listview = LibListView:New(self) the code works fine. At this point, I would like to make sure that the class is created without passing self as a parameter: in short, using the wording listview = LibListView:New() to make the code more elegant. Some advice?

http://stackoverflow.com/comment/137403580
has text: 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?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77939546

http://stackoverflow.com/q/77879660
type: Question
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77880646
score: 0
tagged with: mysql
has title: Need the latest entry in a specific column for Fivem Lua/MySQL
has body: 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. function QBCore.Player.CreateCitizenId() local UniqueFound = false local CitizenId = nil while not UniqueFound do local lastID = MySQL.prepare.await('SELECT MAX(citizenid) FROM players') local lastIDStr = tostring(lastID) local lastIDInt = tonumber(lastIDStr) if lastIDInt == 0 then CitizenId = 1 elseif lastIDInt &gt;= '1' then CitizenId = lastID + 1 end local result = MySQL.prepare.await('SELECT COUNT(*) as count FROM players WHERE citizenid = ?', { CitizenId }) if result == 0 then UniqueFound = true end end return CitizenId end 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 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
tagged with: lua

http://stackoverflow.com/a/77884499
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77882406
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/77882406
has body: From the Programming In Lua book, 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. And from the Quarto shortcodes documentation, shortcodes function signature is function(args, kwargs, meta). So in your implementation, meta is matched with args, instead of meta. And that's why meta.authors returns nil and you are getting "ORCID not found.". 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. test-shortcodes.lua local str = pandoc.utils.stringify return { ['orcid'] = function(args, kwargs, meta) local author_id = str(args[1]) local authors = meta.authors or meta['by-author'] if authors then for _, author in ipairs(authors) do if author.id == author_id then if author.orcid then local orcid_value = str(author.orcid) local orcid_link = "orcid" return pandoc.Para(pandoc.RawInline("html", orcid_link)) end return pandoc.Para(pandoc.Str("ORCID not found")) end end end end } --- Title: Lua Test format: html author: - name: First Author orcid: 0000-0000-0000-0000 - name: Second Author orcid: 0000-0000-0000-0001 shortcodes: - test-shortcodes.lua --- First Author {{< orcid 1 >}} Second Author {{< orcid 2 >}}
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/137305961
type: Answer

http://stackoverflow.com/comment/137453875
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77958049
has text: corutines - that's the only way, am I right?
type: Comment

simulator
type: Tag
tag name: simulator
tags question: http://stackoverflow.com/q/77802584

http://stackoverflow.com/q/77951212
linked to: http://stackoverflow.com/q/1426954
type: Question
has comment: http://stackoverflow.com/comment/137429128
answer count: 0
tagged with: markdown
tagged with: lua
tagged with: http://stackoverflow.com/tag/html
has body: Good evening, I built a Pandoc Lua filter to convert the Markdown syntax code for the menukeys to HTML, inspired by the $\LaTeX$ package menukeys. Here is an example of Markdown syntax code: Path: `&gt; C &gt; Users &gt; {usuario} &gt; AppData &gt; Roaming &gt; nvm` Path: `&gt; Network &amp; Internet &gt; Wi-Fi &gt; Hardware Properties` It will become into HTML: &lt;p&gt; Path: &lt;span class=&quot;menukeys&quot;&gt; &lt;span class=&quot;menukey&quot;&gt;C&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;Users&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;{usuario}&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;AppData&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;Roaming&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;nvm&lt;/span&gt; &lt;/span&gt; &lt;/p&gt; &lt;p&gt; Path: &lt;span class=&quot;menukeys&quot;&gt; &lt;span class=&quot;menukey&quot;&gt;Network &amp; Internet&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;Wi-Fi&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;Hardware Properties&lt;/span&gt; &lt;/span&gt; &lt;/p&gt; But only the second paragraph was wrongly converted due a space for the symbols or the sentence, because it became into: &lt;p&gt; Path: &lt;span class=&quot;menukeys&quot;&gt; &lt;span class=&quot;menukey&quot;&gt;Network&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;Internet&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;Wi-Fi&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;Hardware&lt;/span&gt; &lt;span class=&quot;menukey&quot;&gt;Properties&lt;/span&gt; &lt;/span&gt; &lt;/p&gt; It looked like: It should look like: Follow the follow Pandoc Lua filter code: function string:split(separator) local fields = {} local pattern = string.format(&quot;([^%s]+)&quot;, separator) self:gsub(pattern, function(c) fields[#fields + 1] = c end) return fields end function Code(elem) if elem.text:sub(1, 1) == &quot;&gt;&quot; then local parts = elen.text:sub…
has comment: http://stackoverflow.com/comment/137426987
type: UnansweredQuestion
tagged with: pandoc
has title: Pandoc Lua filter wraps the space or the symbols with an element instead of wrapping the keys with an arrow element
score: 0

http://stackoverflow.com/a/78866322
score: 0
type: Answer
has body: See: https://github.com/hrsh7th/nvim-cmp/issues/37 require('cmp').setup { window = { documentation = false, } }
answers question: http://stackoverflow.com/q/77888576

http://stackoverflow.com/comment/137403589
comment on: http://stackoverflow.com/q/77939546
type: Comment
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137208294
has text: @MertMalaves - Make sure you have standard action "Back" assigned to physical MB4 in GHub GUI (on the big picture of mouse)
type: AnswerComment
comment on: http://stackoverflow.com/a/77827117
type: Comment
score: 0

http://stackoverflow.com/a/78281895
answers question: http://stackoverflow.com/q/77916441
has body: i hope this code can help you. local function getEquippedTool(plr) if not plr.Character then return end -- returns nil because character doesn't exist return plr.Character:FindFirstChildOfClass("Tool") -- returns tool if member of Character end
score: 0
type: Answer

http://stackoverflow.com/a/77836369
score: 3
type: Answer
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/77836329
has comment: http://stackoverflow.com/comment/137220903
has body: I solved it. ch = "A" if string.match(ch, "%u") then --Press Shift end This will check if a character is an uppercase letter and do whatever.

http://stackoverflow.com/q/77823700
tagged with: lua
answer count: 1
tagged with: camera
tagged with: viewport
type: UnansweredQuestion
has title: Viewport Frame for Camera System in Roblox Studio not Working
has answer: http://stackoverflow.com/a/79316967
score: 0
has body: 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. On every client, after recieving this message, this function is ran: local function onCameraEvent(cameraName) print("Clicked") for _, child in game.StarterGui.CamerasUI.Cameras:GetChildren() do if (child.Name ~= cameraName) then child.Visible = false for _, descendant in pairs(child:GetDescendants()) do descendant:Destroy() end end end game.StarterGui.CamerasUI.Cameras[cameraName].Visible = true local cam = Instance.new("Camera", game.StarterGui.CamerasUI.Cameras[cameraName]) cam.Name = "Cam" cam.CameraType = Enum.CameraType.Scriptable cam.FieldOfView = 70 game.StarterGui.CamerasUI.Cameras[cameraName].CurrentCamera = cam local model = Instance.new("WorldModel", game.StarterGui.CamerasUI.Cameras[cameraName]) model.Name = "World Model" for i, minimapObjects in pairs(game.Workspace.Map:GetChildren()) do if minimapObjects:IsA("Sound") or minimapObjects:IsA("SoundGroup") or minimapObjects:IsA("SoundEffect") then return end minimapObjects:Clone().Parent = model end local camPart = game.Workspace.Cameras:WaitForChild(cameraName) game["Run Service"].RenderStepped:Connect(function() local camFr = game.Workspace.Cameras[cameraName].CFrame cam.CFrame = camFr end) end 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 "CurrentCamera" property is linked to the newly created camera. This creates a copy of the map within the viewport frame, with its camera in th…
tagged with: roblox
type: Question

autocommand
tags question: http://stackoverflow.com/q/77886971
type: Tag
tag name: autocommand

http://stackoverflow.com/comment/137330015
type: Comment
has text: 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.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/77895884

http://stackoverflow.com/comment/137323113
type: AnswerComment
comment on: http://stackoverflow.com/a/77892721
type: Comment
has text: Thanks for the Reply. I was just asking for a Killbrick but thanks for the Help. Very Much Appreciated.
score: 0

http://stackoverflow.com/q/77792860
tagged with: neovim
upvote count: 1
type: Question
has body: I want anything that I select in visual mode to go to the X11 buffer. My ideal workflow would be something like: I enter visual mode by pressing v (or V or ctrl V etc.) Select some text by some usual movements hjkl, wb or similar Outside of the terminal I do a middle click (click with the scroll-wheel) and the selection from 2 is pasted where I pressed I can get something almost like this with e.g. a keymap: vim.keymap.set("v", "<leader>y", "*ygv) and then adding a step between (2) and (3) where I press <leader>y. My actual question is for how to make this yanking (while keeping visual selection (gv in my example keymap)) happen automatically. 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: vim.api.nvim_create_autocmd({"CursorMoved", "ModeChanged"}, { callback = function() local mode = vim.fn.mode(false) if mode == "v" or mode == "V" or mode == "^V" then vim.cmd("*y) end end, }) but there are some problems: it might be a bit aggressive in how often it runs "^V" is not the right character to match against it messes up :V as the the initial line selection is removed (but adding gv to the command didn't seem to work) What would be a better approach? I'm running nvim v0.9.4 on gnome.
downvote count: 0
tagged with: lua
has title: Autocmd in visual mode neovim for syncing selection to X11 buffer
has answer: http://stackoverflow.com/a/77799598
accepted answer: http://stackoverflow.com/a/77799598
answer count: 1
score: 1
favorite count: 0
type: AnsweredQuestion

loops
tags question: http://stackoverflow.com/q/77849932
tag name: loops
type: Tag
tags question: http://stackoverflow.com/q/78483956

lua-5.1
type: Tag
tags question: http://stackoverflow.com/q/77918731
tag name: lua-5.1
tags question: http://stackoverflow.com/q/79510694

http://stackoverflow.com/comment/137160246
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77799598
has text: @VRehnberg The code fits within a line and is totally trivial. You need a minute or so to check this.
score: 0

http://stackoverflow.com/comment/137390539
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77926541
has text: Hi iThorgrim, thanks for your answer, i'me a little busy irl but i will test this soon. Best regards
type: Comment

calculus
tag name: calculus
tags question: http://stackoverflow.com/q/77826394
type: Tag

http://stackoverflow.com/a/77799598
has comment: http://stackoverflow.com/comment/137166559
has comment: http://stackoverflow.com/comment/137154797
downvote count: 0
has comment: http://stackoverflow.com/comment/137165646
accepted answer of: http://stackoverflow.com/q/77792860
score: 1
has comment: http://stackoverflow.com/comment/137154787
has comment: http://stackoverflow.com/comment/137156402
answers question: http://stackoverflow.com/q/77792860
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/137155892
upvote count: 1
has body: 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). 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. So, technically, you maybe could trap CursorMoved event and then (while the current mode is visual, of course) keep updating "star" register per each invocation. But, honestly, I don't think that's a good idea. 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. 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.
has comment: http://stackoverflow.com/comment/137160246

http://stackoverflow.com/a/77973239
has comment: http://stackoverflow.com/comment/137477708
score: 5
downvote count: 0
upvote count: 5
type: Answer
has body: return { "nvim-neo-tree/neo-tree.nvim", opts = { event_handlers = { { event = "neo_tree_buffer_enter", handler = function(arg) vim.cmd(setlocal relativenumber ) end, }, }, } } You can refer to https://www.reddit.com/r/neovim/comments/16siats/show_my_neotree_config_allow_you_to_telescope/
answers question: http://stackoverflow.com/q/77927924

http://stackoverflow.com/comment/137172238
comment on: http://stackoverflow.com/a/77790137
score: 0
type: AnswerComment
has text: i made it to run correctly , it should be as my prototype, to test the implementation as initial reffered above, tnhx
type: Comment

conky
type: Tag
tags question: http://stackoverflow.com/q/77852183
tag name: conky
tags question: http://stackoverflow.com/q/79132438

http://stackoverflow.com/a/77830864
has comment: http://stackoverflow.com/comment/137217628
answers question: http://stackoverflow.com/q/77829116
score: 6
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77829116
downvote count: 0
has body: In your configuration, you need to call setup function for the nvim-tree.lua plugin and you could also disable netrw in init.lua => see "Setup" section in https://github.com/nvim-tree/nvim-tree.lua -- disable netrw at the very start of your init.lua vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 nvim/lua/moorby/plugins/nvim-tree.lua: return { "nvim-tree/nvim-tree.lua", config = function() require("nvim-tree").setup({ filters = { dotfiles = true, }, lazy = false }) end, }
upvote count: 6
has comment: http://stackoverflow.com/comment/137211116

http://stackoverflow.com/comment/137154797
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77799598
type: Comment
has text: Would you like to add any motivation for why you don't think that is a good idea?

http://stackoverflow.com/comment/137377405
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77924414
has text: See: https://luajit.org/ext_ffi_semantics.html#cdata_array

http://stackoverflow.com/comment/137153256
comment on: http://stackoverflow.com/q/77797865
score: 2
type: Comment
has text: I am counting 8 issues in 5 lines of code, that's a new record ^^
type: QuestionComment

http://stackoverflow.com/a/77962694
has body: The technical term for what you're trying to do is called "function overloading". And currently it's not possible in Lua or Luau. An engine feature request was made for it back in 2020, but that didn't get much traction. You cannot have multiple functions with the same name with different signatures. In your example, think of the table var as as a collection of buckets. When you define the get(a:number):any function, you put it into the bucket named get. The next time you try to define get():any, you empty out the bucket named get 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. However, if you want to achieve something like function overloading, vanilla Lua does allow you to call a function with any number of arguments. This is called a variadic function, they are very useful and Luau supports them too. local var = {} function var.get(...):any local args = {...} -- store all the extra arguments in an array --print(...) -- print out the arguments provided to get -- figure out how people have called this function if #args == 0 then -- called as get() print("get() called with no arguments!") else if #args == 1 then print("get() called with one argument : ", args[1]) else print("get() called with many arguments : ", ...) end return args end -- allows you to use it like... var.get() var.get("hello") var.get("this", "is", "a", "test", 123, false) 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. local var = {} functio…
downvote count: 0
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/77961269

http://stackoverflow.com/comment/137204565
type: Comment
type: QuestionComment
has text: 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
score: 0
comment on: http://stackoverflow.com/q/77826394

http://stackoverflow.com/a/77870019
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77863272
has body: 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: local player = game.Players.LocalPlayer local HumanoidRootPart = player.Character:WaitForChild("HumanoidRootPart") local mouse = player:GetMouse() local debounce = false local mouseDown = false local MaxDistance = 500 local RopeVisible = true local RopeColor = BrickColor.new("Cocoa") local function distance_between_vectors(u, v) local difference = u - v local distance = difference.Magnitude distance = math.floor(distance / 1 + 0.5) * 1 return distance end local function Attachment(method, parent) if method == "Create" then local Attachment = Instance.new("Attachment") Attachment.Parent = parent else if parent:FindFirstChild("Attachment") then parent.Attachment:Destroy() end end end mouse.Button1Up:Connect(function() mouseDown = false end) mouse.Button1Down:Connect(function() mouseDown = true if debounce == false then debounce = true local hitPosition = mouse.Hit.Position local distance = distance_between_vectors(hitPosition, HumanoidRootPart.Position) if distance <= MaxDistance then local newPart = Instance.new("Part") newPart.Anchored = true newPart.Parent = game.Workspace newPart.Position = hitPosition newPart.Transparency = 1 newPart.CanCollide = false Attachment("Create", newPart) Attachment("Create", HumanoidRootPart) local Rope = Instance.new("RodConstraint") Rope.Parent = newPart Rope.Attachment0 = newPart.Attachment Rope.Attachment1 = HumanoidRootPart.Attachment Rope.Color = RopeColor Rope.Length = distance Rope.Visible = RopeVisible Rope.Thickness = 0.25 local tween = game:GetService("TweenService"):Create(Rope, TweenInfo.new(0.6, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false), {Length = 0}) tween:Play() newPart.Touched:Connect(function(touched) if touched then if touched == HumanoidRootPart then wait(0.1) Attachment("Destroy", newPart) Attachment("Destroy", HumanoidRootPart) newPa…
answers question: http://stackoverflow.com/q/77863272
score: 0

http://stackoverflow.com/a/79316967
answers question: http://stackoverflow.com/q/77823700
has body: Your problem is fixable, but i wouldn't recommend you to create any camera systems in Roblox Studio at all. But if you really wanna to suffer, your problem can be easily fixed by doing the following list of things: Place the SurfaceGUI inside the StarterGUI; Set SurfaceGUI's Adornee property to the part you want it to appear on. Tip: you can do that with local scripts as well.
type: Answer
score: 0

http://stackoverflow.com/q/77930478
has title: lua api call, on lua functions int the stack
has comment: http://stackoverflow.com/comment/137396077
has body: 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. Any suggestion? int main() { lua_State *L = luaL_newstate(); luaL_openlibs(L); const char *luaCode = "function jj() print('Hello from Lua!') end"; if (luaL_dostring(L, luaCode) != LUA_OK) { fprintf(stderr, "Error executing Lua code: %s\n", lua_tostring(L, -1)); lua_close(L); return 1; } // Call a Lua function to populate the stack lua_getglobal(L, "jj"); lua_pcall(L, 0, 0, 0); // Try to get stack information lua_Debug ar; int gg = lua_getstack(L, 0, &ar); if (gg == 0) { fprintf(stderr, "No stack information available\n"); } else { printf("Stack level: %d\n", 0); printf(" Function: %s\n", ar.name ? ar.name : "(no name)"); printf(" Source: %s\n", ar.short_src); printf(" Line: %d\n", ar.currentline); } lua_close(L); return 0; }
answer count: 1
score: 0
type: Question
tagged with: http://stackoverflow.com/tag/c
tagged with: lua
has answer: http://stackoverflow.com/a/77939110
tagged with: lua-api
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137396094

http://stackoverflow.com/q/77797082
has title: Issue with Cloning Player Characters in Roblox Studio(Lua)
score: 0
type: Question
tagged with: lua
has body: Hello Stack Overflow community, 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. 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 "Failed to clone character for player [PlayerName]." I would appreciate any insights or suggestions on how to resolve this issue and successfully duplicate the player's character. Thank you in advance for your assistance! I have currently tried a few different things but this is the best that I've gotten: game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) local humanoid = character:WaitForChild("Humanoid") local newCharacter = character:Clone() if newCharacter then newCharacter.Parent = workspace newCharacter:MoveTo(Vector3.new(0, 10, 0)) else warn("Failed to clone character for player " .. player.Name) end end) end)
tagged with: roblox
tagged with: roblox-studio
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77798023
answer count: 1

http://stackoverflow.com/a/77850126
score: 6
has body: For an array-like table (one with a sequence), you can use a numeric for, with the upper bound being the length of the table. local list = { "one", "two", "four", "five", "six" } for i = 3, #list do print(i, list[i]) end 3 four 4 five 5 six Note that starting with a certain key (index) usually only makes sense given an array-like table - which your list is. The key-value pairs in a table have no stable order as far as next/pairs is concerned (note that ipairs is for operating on a sequence). If the arbitrary keys in an associative array-like table follow a particular generation order (i.e., they are deterministic), it is possible to iterate through them in a stable way, but that is a specific use-case. You can also write a function similar in form to ipairs - one that returns an iterator function (alongside the initial state and control) used by the generic for, but starts from a given index. Here is a cursory example where the iterator returns index, value to be assigned to the loop variables. local function ipairsfrom(tab, n) return function (t, i) i = i + 1 return t[i] ~= nil and i or nil, t[i] end, tab, n and n - 1 or 0 end local list = { 'a', 'b', 'c', 'd', 'e' } for index, value in ipairsfrom(list, 3) do print(index, value) end 3 c 4 d 5 e There are many ways to write such an iterator and the function that creates it. For example, returning value, index might be preferred since the value is often more interesting, and allows us to omit the second variable (as opposed to using for _, value in). local function ipairsfrom(t, i) i = i and i - 1 or 0 return function () i = i + 1 return t[i], i end end for value, index in ipairsfrom({ 'a', 'b', 'c' }, 2) do print(index, value) end 2 b 3 c
downvote count: 0
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/77849932

http://stackoverflow.com/q/77789995
has answer: http://stackoverflow.com/a/78854391
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137137086
tagged with: dry
has body: There is a way to not rewrite the same part (the cycle for i = 1...end) twice? local function myfunc(frame,method) if frame:IsShown() then for i = 1, #frame.buttons do frame.buttons[i]:HookScript("OnMouseDown", method) end else frame:SetScript( "OnShow", function(frame) for i = 1, #frame.buttons do frame.buttons[i]:HookScript("OnMouseDown", method) end end ) end end Where IsShown(), HookScript() and SetScript() are all in-game API EDIT Maybe a recursive function? It seems to work: local function myfunc(frame,method) if frame:IsShown() then for i = 1, #frame.buttons do frame.buttons[i]:HookScript("OnMouseDown", method) end else frame:SetScript( "OnShow", --when "OnShow" is fired, IsShown() become true function() myfunc(frame,method) end ) end end
tagged with: lua
has comment: http://stackoverflow.com/comment/137153394
answer count: 1
has comment: http://stackoverflow.com/comment/137136800
score: 0
type: Question
has title: DRY: don't repeat yourself in Lua
tagged with: function
has comment: http://stackoverflow.com/comment/137136968
tagged with: world-of-warcraft

http://stackoverflow.com/a/77852267
answers question: http://stackoverflow.com/q/77848964
score: 0
type: Answer
has body: 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. 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 (https://create.roblox.com/docs/studio/properties#instance-attributes) for more info. So instead of calling SetAttribute, just index the Visible property and set it local button = script.Parent local menu = script.Parent.Parent.Parent local function onButtonClicked() if menu.Visible then menu.Visible = false else menu.Visible = true end end button.MouseButton1Down:Connect(onButtonClicked) Also, to make your code neater, you could instead of the if statement simply use some boolean logic to invert it. local function onButtonClicked() menu.Visible = not menu.Visible end

http://stackoverflow.com/comment/137399810
type: Comment
score: 0
type: AnswerComment
has text: 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).
comment on: http://stackoverflow.com/a/77867501

http://stackoverflow.com/comment/137338563
type: Comment
score: 0
type: QuestionComment
has text: Why not measuring it yourself?
comment on: http://stackoverflow.com/q/77902368

http://stackoverflow.com/q/77882406
favorite count: 0
has body: 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 {{< orcid >}}, expecting it to be replaced with a hyperlink containing the ORCID number from the YAML metadata. Here's an example of my YAML metadata: --- author: - name: Your Name orcid: 0000-0000-0000-0000 --- And here's my Lua script: return { ['orcid'] = function(meta) local authors = meta.authors or meta['by-author'] if authors then for _, author in ipairs(authors) do if author.orcid then local orcid_link = "orcid" return pandoc.Para(pandoc.RawInline("html", orcid_link)) end end end return pandoc.Para(pandoc.Str("ORCID not found")) end } However, despite having the ORCID number in the YAML header, the shortcode always returns "ORCID not found." I've noticed that the meta fields for the author are empty in Lua. Could someone help me understand how to correctly extract the ORCID number from the YAML header using Lua? Any assistance would be greatly appreciated!
type: AnsweredQuestion
downvote count: 0
tagged with: lua
tagged with: yaml
type: Question
accepted answer: http://stackoverflow.com/a/77884499
tagged with: quarto
has title: how to access meta data from quarto YAML in lua script
has answer: http://stackoverflow.com/a/77884499
score: 1
upvote count: 1
answer count: 1

http://stackoverflow.com/q/77924312
type: AnsweredQuestion
has body: I am tring to call c function in lua, the c function is in a so file and code is like this: typedef struct attributes_s { char name[256]; char id[256]; }attributes_t int get_service_instances(attributes_t **array, size_t *service_nums); This function will assign a value to array and service_nums, array may have several instances of attributes_t, right now I only have it return one. lua code is like this local ffi_Cli = ffi.load("client") ffi.cdef[[ typedef struct attributes_s { char name[256]; char id[256]; }attributes_t int get_service_instances(attributes_t **array, size_t *service_nums); ]] local get_services_result = ffi.new("attributes_t*[1]") local res_len = ffi.new("size_t[1]") if ffi_Cli.get_service_instances(get_services_result, res_len) ~= 0 then print("get failed") return end print(get_services_result[1].name) -- get cdata<char (&)[256]> print(ffi.string(get_services_result[1].name, 256)) -- get coredump If I use ffi.string(get_services_result[1].name, 256) or change 256 to other number, it will coredump, the gdb bt is like this #0 0x00007f55a558cff1 in __strlen_sse2_pminub () from /lib64/libc.so.6 Missing 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 (gdb) bt #0 0x00007f55a558cff1 in __strlen_sse2_pminub () from /lib64/libc.so.6 #1 0x00007f55a78a64a6 in lj_cf_ffi_string (L=0x7f55a831a380) at lib_ffi.c:691 I donot know how can I get the value of attributes_t, why can not I get char* using ffi.string()
downvote count: 0
tagged with: lua
type: Question
has title: How to get the value of char* in lua
upvote count: 1
accepted answer: http://stackoverflow.com/a/77924414
score: 1
tagged with: luajit
has answer: http://stackoverflow.com/a/77924414
answer count: 1
favorite count: 0

http://stackoverflow.com/a/78854391
downvote count: 0
answers question: http://stackoverflow.com/q/77789995
score: 1
type: Answer
upvote count: 1
has body: You can extract the for i = 1...end part as a separate function. In addition, since we are on the topic of clean code, you can also make the if block return. Then the else code block can be inside the function body and de-nested for one level. local function hook(frame, method) for i = 1, #frame.buttons do frame.buttons[i]:HookScript("OnMouseDown", method) end end local function myfunc(frame, method) if frame:IsShown() then hook(frame, method) return end frame:SetScript( "OnShow", function(frame) hook(frame, method) end ) end

oop
tags question: http://stackoverflow.com/q/77941484
type: Tag
tag name: oop
tags question: http://stackoverflow.com/q/78135524
tags question: http://stackoverflow.com/q/78360664
tags question: http://stackoverflow.com/q/78959804
tags question: http://stackoverflow.com/q/79345546
tags question: http://stackoverflow.com/q/79498050

http://stackoverflow.com/a/77941555
downvote count: 0
has body: This defines self twice function LibListView:New(self) when you make a method using : instead of . the first param is hidden and named self. What you did here is made the second param also called self. you have 2 options, do not put self in the signature just leave it without any params: function LibListView:New(), you will still have access to the param self within the method. do not use : and define the first param as self: function LibListView.New(self), you can still call this using the : sugar syntax. Here is a resource for learning more about how : works in lua: Programming in Lua: Chapter 16 – Object-Oriented Programming This is a particularly relevant quote from the chapter: 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 function Account:withdraw (v) self.balance = self.balance - v end
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/77941484

vim-plugin
tag name: vim-plugin
tags question: http://stackoverflow.com/q/77951468
type: Tag

http://stackoverflow.com/q/77853630
has title: Part is positioned To WorldOrigin instead of intended CFrame
answer count: 1
has answer: http://stackoverflow.com/a/77906341
favorite count: 0
has body: 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. 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? for _, plug in pairs(collectionservice:GetTagged('Plug')) do plug.PrimaryPart.ProximityPrompt.Triggered:Connect(function(plr) local plugval = plr.Character:WaitForChild('HoldingPlug', 1) plugval.Value = plug plug.PrimaryPart.Anchored = false plr.Character:WaitForChild('Humanoid'):UnequipTools() game:GetService('ReplicatedStorage').Events.EquipPlug:FireClient(plr) local arm = plr.Character:FindFirstChild('Right Arm') plug.PrimaryPart.CFrame = CFrame.new(arm.CFrame.Position.X,arm.CFrame.Position.Y,arm.CFrame.Position.Z) local rx,ry,rz = plr.Character:FindFirstChild('Right Arm').CFrame:ToOrientation() plug.PrimaryPart.CFrame = CFrame.Angles(math.rad(rx),math.rad(ry),math.rad(90)) local weld = Instance.new('WeldConstraint') weld.Parent = plug.PrimaryPart weld.Name = 'PlayerWeld' weld.Part0 = arm weld.Part1 = plug.PrimaryPart plug.PrimaryPart.CanCollide = false end) end
tagged with: roblox
type: Question
downvote count: 0
tagged with: lua
score: 1
tagged with: roblox-studio
upvote count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/137204366
comment on: http://stackoverflow.com/q/77824918
score: 0
type: QuestionComment
has text: You get your values from: `net.Receive("SendToPlayer", function() config = net.ReadTable() new_config = config PrintTable(config) end)` Which in turn links to the second hook of the server side code. The config is initially saved in the first hook of the database.
type: Comment

http://stackoverflow.com/a/77789666
type: Answer
answers question: http://stackoverflow.com/q/77789112
score: 0
has body: Both Vector3.new and CFrame.Angles expect three (3) number arguments. You only provide two (2) numbers to each: local PositionOffset = Vector3.new(Rng:NextNumber(-2, 2), Rng:NextNumber(-2, 2)) local RotationOffset = CFrame.Angles(Rng:NextNumber(-3, 3), Rng:NextNumber(-3, 3))

http://stackoverflow.com/comment/137360927
type: AnswerComment
type: Comment
has text: 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!
score: 0
comment on: http://stackoverflow.com/a/77915148

daemon
type: Tag
tag name: daemon
tags question: http://stackoverflow.com/q/77958049

http://stackoverflow.com/comment/137413656
comment on: http://stackoverflow.com/q/77945374
type: QuestionComment
score: 2
type: Comment
has text: 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.

http://stackoverflow.com/q/77836329
favorite count: 0
type: Question
upvote count: 2
score: 2
tagged with: lua
type: UnansweredQuestion
has body: How do I check if a character is uppercase? ch = "A" if isupper(ch) then --Press shift end Checked Google. Nothing was there.
has answer: http://stackoverflow.com/a/77836369
answer count: 2
has answer: http://stackoverflow.com/a/77836370
has title: How do I check if a character in a string is uppercase in Standard Lua 5.1?
downvote count: 0

http://stackoverflow.com/comment/137222660
has text: Sorry, I already tried this, just thought maybe there any way to compute numerical derivative different way with most accuracy
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77834599

rss
type: Tag
tag name: rss
tags question: http://stackoverflow.com/q/77852183

http://stackoverflow.com/q/77913819
upvote count: 3
type: Question
score: 3
answer count: 0
has body: I've been using kickstart.nvim 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 lua_ls server, and each programming language has its own file, covering treesitter, mason, and conform configs. The only issue is I'm struggling to expand the servers for lspconfig but can't make it to work. This is my lsp.lua file. { 'neovim/nvim-lspconfig', branch = 'master', event = { 'BufReadPost', 'BufNewFile', 'BufWritePre' }, dependencies = { 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', { 'j-hui/fidget.nvim', opts = {} }, }, opts = {}, config = function() local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) -- This function gets run when an LSP connects to a particular buffer. local on_attach = function(_, bufnr) -- bunch of kepmaps here end local servers = { lua_ls = { Lua = { workspace = { checkThirdParty = false }, telemetry = { enable = false }, diagnostics = { globals = { 'vim' }, }, }, }, } require('mason-lspconfig').setup({ ensure_installed = vim.tbl_keys(servers), handlers = { function(server_name) require('lspconfig')[server_name].setup({ capabilities = capabilities, on_attach = on_attach, settings = servers[server_name], filetypes = (servers[server_name] or {}).filetypes, }) end, }, }) end, }, This is my go.lua file -- mason and treesitter stuff here { "neovim/nvim-lspconfig", opts = function(_, opts) vim.tbl_keys(opts.ensure_installed, { 'gopls' }) end, }, And it gives me this error Expected table, got nil. What am I doing wrong here?
has comment: http://stackoverflow.com/comment/138978446
downvote count: 0
tagged with: lua
type: UnansweredQuestion
favorite count: 0
has title: How to properly extend lspconfig server list from another file
tagged with: neovim-plugin
tagged with: neovim

http://stackoverflow.com/comment/137208279
comment on: http://stackoverflow.com/a/77827117
type: Comment
score: 0
type: AnswerComment
has text: this is not stoping on press again

recursion
type: Tag
tag name: recursion
tags question: http://stackoverflow.com/q/77950812
tags question: http://stackoverflow.com/q/78647470
tags question: http://stackoverflow.com/q/79179000

http://stackoverflow.com/a/77890429
has comment: http://stackoverflow.com/comment/137319305
has body: The area highlighted in yellow is referred to as the Documentation window. To customize its behavior, you can explore the available options documented in :help cmp-config.window. For a specific solution, you can refer to the :help cmp-faq, particularly the section likely titled How to disable the documentation window?. To disable the Documentation window, use the following Lua code in your Neovim configuration: require"cmp".setup{ -- Other configuration options here window = { documentation = cmp.config.disable } -- More configuration options here }
has comment: http://stackoverflow.com/comment/137316931
answers question: http://stackoverflow.com/q/77888576
score: 0
type: Answer

http://stackoverflow.com/q/77888368
type: Question
tagged with: eluna-lua-engine
tagged with: lua
has title: Elunas script issues
has answer: http://stackoverflow.com/a/77926541
type: UnansweredQuestion
tagged with: azerothcore
answer count: 1
has body: 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: The first issue is that the chest desappear when the player resurect and not after the time i specified here: local secondsInADay = 86400 local event = CreateLuaEvent(function() if grave and grave:IsInWorld() then grave:Despawn() end end, secondsInADay * 1000, 1) The second issue is that the stuff of the player don't go in the GOB. local function CreateGrave(player) if player:GetLevel() < 15 then return end local chestGameObjectEntry = 8000015 -- Utilisez l'ID du modèle de coffre que vous souhaitez local secondsInADay = 86400 -- Durée pendant laquelle le cimetière restera spawn en secondes (1 jour) local x, y, z, o = player:GetLocation() local grave = player:SummonGameObject(chestGameObjectEntry, x, y, z, o) if grave then local graveGUID = grave:GetGUIDLow() -- Obtenir le GUID du gardien d'âmes for slot = 0, 18 do local item = player:GetItemByPos(255, slot) -- Emplacement des équipements if item then grave:AddLoot(item:GetEntry(), 22) -- Ajouter l'objet au coffre (1 quantité) end end for bag = 19, 22 do for slot = 0, 35 do local item = player:GetItemByPos(bag, slot) -- Emplacement des sacs équipés if item then grave:AddLoot(item:GetEntry(), 5) -- Ajouter l'objet au coffre (1 quantité) end end end local event = CreateLuaEvent(function() if grave and grave:IsInWorld() then grave:Despawn() end end, secondsInADay * 1000, 1) print("Tombe (Coffre) GUID: " .. graveGUID) local input_Grave_GUID = "UPDATE hc_dead_log SET grave_guid = '" .. graveGUID .. "' WHERE guid = '" .. player:GetGUIDLow() .. "'" AuthDBExecute(input_Grave_GUID) end end Someone have a tip for me? Thanks in advance.
score: 0

http://stackoverflow.com/q/77860780
has body: 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 teamList. 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. 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 AUTOFOLLOW_END event and then immediately follows it up with the AUTOFOLLOW_BEGIN event. Consequently, if I spam AltF repeatedly in ISBoxer to follow the same character again, it results in the game spamming the "Follow Broken" message. How can I prevent this behavior and ensure that the "Follow Broken" message is not displayed when re-following the same character within a short timeframe? Team.lua local AddonName = ... local DMA = LibStub("AceAddon-3.0"):GetAddon(AddonName) local Team = DMA:NewModule("Team", "AceEvent-3.0", "AceConsole-3.0") -- get a reference to the Communication module local Communication = DMA:GetModule("Communication") -- constants local SLASH_TEAMFOLLOW1 = "teamfollow" local SLASH_TEAMFOLLOW2 = "tf" -- variables local selectedCharacter = nil local masterCharacter = nil local currentlyFollowing = nil local teamList = {} -- options local options = { name = "Team", type = "group", args = { header = { type = "header", name = "Multiboxing Team Management", order = 0, }, description = { type = "description", name = "Manage your multiboxing team members and designate a master character.", fontSize = "medium", order = 1, }, teamControlGroup = { type = "group", name = "Team Controls", inline = true, order = 2, args = { newCharacterName = { type = "input", name = "Add New Character", desc = "Enter the name of a new character to add to your team.", set = function(_, val) Team:AddCharacter(val) end,…
upvote count: 1
favorite count: 0
tagged with: world-of-warcraft
type: Question
downvote count: 0
answer count: 0
tagged with: lua
has title: Preventing AUTOFOLLOW_END and AUTOFOLLOW_BEGIN Spam in WoW Addon
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/137395911
has text: Could it be http vs https?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77935205
type: Comment

neomutt
type: Tag
tag name: neomutt
tags question: http://stackoverflow.com/q/77854806

http://stackoverflow.com/a/77800109
score: 0
type: AcceptedAnswer
type: Answer
has body: missing a comma after 'sfx/dlc_veyronsound/veyronsound_npc.awc' it's the 4th last in that block
accepted answer of: http://stackoverflow.com/q/77800090
answers question: http://stackoverflow.com/q/77800090
has comment: http://stackoverflow.com/comment/137155042

flags
tag name: flags
type: Tag
tags question: http://stackoverflow.com/q/77802584

http://stackoverflow.com/a/77803728
type: Answer
has comment: http://stackoverflow.com/comment/137162338
has body: Let's break down your program to help understand your assumptions and how to correct them. print ('Hello, make a face, ') This does exactly what it you think it does, it prints the string 'Hello, make a face, ' into the console on its own line. This is correct. local face = io.read() Likewise, this correctly requests a line of text from the user, and stores it in the local variable face local t = {"{:) , :), "} This is the first incorrect assumption. Whilst local t = would correctly assign to the value t, {"{:) , :), "} does not do what you seem to expect. This creates a table with one value, "{:) , :), ". 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 {":)", ":)"}, which contains two values instead. 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. if local face (t1) then print (" :0 ") There are a handful of incorrect assumptions here. local face in this instance is incorrect, face was already previously assigned as a local variable. The local keyword should only be used when defining the variable, not referencing it. Additionally, you seem to be attempting to compare face to the first entry of the table via face (t1), this is very wrong, and should be done via face == t[1]. Note that [1] is used to retreive the value at position 1 from the table t, and equality is checked with the equality operator, ==. Finally, you have not closed your if then statement. Lua, unlike other langauges, does not support single-expression statements, and must be closed with an end. if local (t2) then print (" :) ") This contains many of the same assumptions as the previous line, though for reasons I cannot assume, you have neglected to include face. Additionally, this should probably be an elseif statement, rather than just another if statement, if the behaviour is intended to be ex…
answers question: http://stackoverflow.com/q/77797865
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/77915148
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/137360927
downvote count: 0
has body: If myinput is just add(1, 1), that's a function call statement, so the return value(s) of add will be discarded. You can't recover them afterwards. It is not possible to circumvent this without modifying myinput. 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. However, all chunks in Lua are effectively functions, so you can just return any values you want to. In the Lua 5.1 / 5.2 REPLs, you could write return 1 + 1, and it would print 2. Because this is slightly cumbersome, they offer = at the start of the input as syntactic sugar for return . What you can do - and what the Lua 5.3 / 5.4 REPLs do - is first try prepending return and appending ; (see the source), 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. (Also, what is lua_dostring? It doesn't appear in the reference manual or the PUC sources.) I am implementing a Lua interpreter. Nitpick: It sounds like you're implementing a Lua REPL (read-eval-print-loop, an interface to an interpreter) rather than a Lua interpreter (the software that interprets the Lua code). Also, what happens if the code surrounded by return ; do a side effect AND fail... The side effect (say, a print) will happen as normal, there is no "isolation" here. The "failure" will make the REPL print a stacktrace; no "values" will be printed. You can easily test this yourself using print and error.
has comment: http://stackoverflow.com/comment/137361075
score: 2
accepted answer of: http://stackoverflow.com/q/77914976
answers question: http://stackoverflow.com/q/77914976
has comment: http://stackoverflow.com/comment/137361915
upvote count: 2

http://stackoverflow.com/comment/137423309
comment on: http://stackoverflow.com/q/77950812
type: Comment
score: 1
has text: At a glance: `self.compute_Recursively` should be `self:compute_Recursively`. There may be more issues.
type: QuestionComment

http://stackoverflow.com/comment/137220903
score: 0
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/77836369
type: AnswerComment

polygon
tags question: http://stackoverflow.com/q/77904973
type: Tag
tag name: polygon

http://stackoverflow.com/comment/137438248
type: Comment
score: 0
type: AnswerComment
has text: This doesn't match negative number (-123.45) but you're example didn't include any. Let me know if that is an issue.
comment on: http://stackoverflow.com/a/77959479

http://stackoverflow.com/q/77922338
has comment: http://stackoverflow.com/comment/137407512
downvote count: 0
type: UnansweredQuestion
tagged with: build
score: 1
has title: I need advice on setup compiler for c library with embedded lua in Cygwin with Mingw on Windows
has comment: http://stackoverflow.com/comment/137377295
has comment: http://stackoverflow.com/comment/137377766
tagged with: mingw-w64
favorite count: 0
type: Question
upvote count: 1
answer count: 0
tagged with: http://stackoverflow.com/tag/c
tagged with: lua
has body: 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. First I install lua and liblua-dev in Cygwin. I chose version 5.3.6-4. From Cygwin, I can run lua script.lua which print a string on the Cygwin terminal. print('Hi from script.lua!') Then I install MinGW-w64 toolchain and add "C:\msys64\ucrt64\bin" to the user environment variables. From Cygwin, I can test the gcc version work correctly. $ cc --version cc.exe (Rev3, Built by MSYS2 project) 13.2.0 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I create a doscript.c file as below #include "lauxlib.h" #include "lua.h" #include "lualib.h" int main(){ lua_State *L = luaL_newstate(); luaL_openlibs(L); luaL_dofile(L, "script.lua"); lua_close(L); return 0; } When I ran command to compile, I got below error $ cc doscript.c -o doscript -llua C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64 -mingw32/bin/ld.exe: cannot find -llua: No such file or directory collect2.exe: error: ld returned 1 exit status From Cygwin if I list the usr/lib, I can see the liblua5.3.dll.a $ ls /usr/lib charset.alias engines-3 liblua-5.3.dll.a ossl-modules pkgconfig csih gawk liblua.dll.a p11-kit-proxy.so sasl2_3 engines-1.0 groff liblua5.3.dll.a perl5 security engines-1.1 libcbor.a lua pkcs11 terminfo I also tried with the actual library name but still get error $ cc doscript.c -o doscript -L/usr/lib -llua-5.3.dll C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64 -mingw32/bin/ld.exe: cannot find -llua-5.3.dll: No such file or directory collect2.exe: error: ld returned 1 exit status Is there anything else I should try? Thank you …
tagged with: cygwin-64

http://stackoverflow.com/comment/137199848
comment on: http://stackoverflow.com/q/77824896
has text: @Marc i added my code and it doesn't stop
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137204008
comment on: http://stackoverflow.com/q/77824918
has text: They are assigned `nil`s there. Where have you assigned objects to these variables?
type: Comment
score: 0
type: QuestionComment

leaderboard
tag name: leaderboard
tags question: http://stackoverflow.com/q/77936647
type: Tag
tags question: http://stackoverflow.com/q/77864170

http://stackoverflow.com/comment/137396484
type: QuestionComment
has text: @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
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77935205

http://stackoverflow.com/a/77965863
has body: 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. local function overloaded (signatures) local concat = table.concat -- Serialise signatures beforehand to compare them as strings at call time: local serialised_signatures, fallback = {}, nil for signature, implementation in pairs (signatures) do if type (signature) == 'number' or signature == 'void' then -- syntactic sugar for an empty signature: signature = '' elseif type (signature) == 'table' then -- long signatures: signature = concat (signature, ', ') elseif signature == '...' then -- fallback: any unrecognised signature: fallback = implementation end -- otherwise, it is a signature with one argument, which remains a string. serialised_signatures [signature] = implementation end -- Get the serialised signature of a function call at runtime: local function arg_types (...) local types = {} for i, arg in ipairs {...} do types [i] = type (arg) end return concat (types, ', ') -- to make comparing easier. end return function (...) local called_with_args = arg_types (...) for signature, implementation in pairs (serialised_signatures) do if called_with_args == signature then return implementation (...) end end -- fallback: return fallback (...) end end local get = overloaded { -- no arguments. [{}], or [''], or void index will have the same effect: function () return 'If you want to get something, give something' end, -- one argument, number: number = function (number) return 'You have given the number ' .. number end, -- one argument, string, but passed as a list: [{ 'string' }] = function (string) return 'You have given the string "' .. string .. '"' end, -- several arguments: [{ 'number', 'number' }] = function (no1, no2) return 'You have given two numbers: ' .. no1 .. ' and ' .. no2 end, -- any other signature: ['...'] = function…
answers question: http://stackoverflow.com/q/77961269
score: 4
accepted answer of: http://stackoverflow.com/q/77961269
has comment: http://stackoverflow.com/comment/137458406
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/77790137
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Your loadwithprefix implementation is incorrect: 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. 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 chunk - not a function, if chunk is a proper "reader". It also fails to account for chunk being a string. Your testing code also has a minor flaw: f(i)() should be just f(i) if loadwithprefix was implemented correctly. (I also can't make much sense of the prefix. Do you want your suffixes to be something like + 42?) Here's how I would implement loadwithprefix: local function loadwithprefix(prefix, chunk, ...) local loaded_prefix = false return load(function() -- first read the prefix if not loaded_prefix then loaded_prefix = true return prefix end if type(chunk) == "string" then local str = chunk -- remember the string chunk = function() end -- return nothing the next time return str end return chunk() -- delegate to the original reader end, ...) end The ... is to pass mode and env arguments (and whatever else might be added in the future) through.
accepted answer of: http://stackoverflow.com/q/77789757
upvote count: 1
has comment: http://stackoverflow.com/comment/137172238
answers question: http://stackoverflow.com/q/77789757
score: 1

http://stackoverflow.com/q/77888576
score: 0
tagged with: nvim-lspconfig
answer count: 3
type: Question
has answer: http://stackoverflow.com/a/77892819
accepted answer: http://stackoverflow.com/a/77892819
tagged with: nvim.cmp
has answer: http://stackoverflow.com/a/78866322
possible better answer: http://stackoverflow.com/a/77890429
tagged with: lua
tagged with: neovim
has title: Is there any way to disable the code descriptions showing up on the autocompletion list performed by cmp plugin?
has answer: http://stackoverflow.com/a/77890429
type: AnsweredQuestion
has body: I'm a newbie in Neovim and I've built my almost overall configuration based on Nvchad. And, here's an only thing that I could never find the way to change: Notice the texts that I pointed out with yellow on the screenshot. I don't even know what those are called. Code "descriptions," I guess? 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 doc/cmp.txt and found nothing helpful. I also checked out doc/lspconfig.txt if this was related to lsp. I would appreciate if anyone could teach me the way.

http://stackoverflow.com/q/77848964
has body: 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. This is my code, I am trying to make the frame called "MenuFrame" toggle visibility when the button is clicked. The GUI is under "StarterGUI" local button = script.Parent local menu = script.Parent.Parent.Parent:FindFirstAncestor("MenuFrame") local function onButtonClicked() if menu.Visible then menu.SetAttribute(menu,Visible,false) else menu.SetAttribute(menu,Visible,true) end end button.MouseButton1Down:Connect(onButtonClicked) The error is 7: attempt to index nil with 'Visible' Is there any suggestions on what I could change or fix
tagged with: lua
has title: How do I change the visibility of a GUI Frame
tagged with: roblox
has answer: http://stackoverflow.com/a/77852267
type: UnansweredQuestion
answer count: 1
score: 0
type: Question

http://stackoverflow.com/q/77895884
has comment: http://stackoverflow.com/comment/137333631
type: Question
has title: Cannot define paths in Lua
has answer: http://stackoverflow.com/a/77905622
tagged with: lua
score: 1
downvote count: 1
answer count: 1
type: UnansweredQuestion
favorite count: 0
upvote count: 2
has body: I have this directories project/src/main.lua project/assets/font.ttf And I want to define the path to font.ttf in main.lua so I can load it. I've tried defining FONT_PATH = '../assets/font.ttf' and many variations but they don't work
has comment: http://stackoverflow.com/comment/137330015

http://stackoverflow.com/comment/137391312
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77927881
type: AnswerComment
has text: 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. A 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`.

http://stackoverflow.com/q/77945374
tagged with: lua
type: UnansweredQuestion
tagged with: sprite
has body: 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. I've stumbled through different solutions with ChatGPT but it either misinterpreted what I asked or I couldn't make sense of it.
answer count: 1
score: 0
tagged with: math
type: Question
has comment: http://stackoverflow.com/comment/137413656
has answer: http://stackoverflow.com/a/77945524
has title: Get Direction a Sprite Appears to Be Facing Relative to the Camera
tagged with: trigonometry

http://stackoverflow.com/a/77990070
score: 0
accepted answer of: http://stackoverflow.com/q/77936647
has comment: http://stackoverflow.com/comment/137507370
answers question: http://stackoverflow.com/q/77936647
has body: 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: local player = game:GetService("Players") local dataStore = game:GetService("DataStoreService") local SufferingsDataStore = dataStore:GetDataStore("Sufferings") local SufferCoinsDataStore = dataStore:GetDataStore("SufferCoins") player.PlayerAdded:Connect(function(plr) print(plr.Name .." joined") local folder = Instance.new("Folder", plr) folder.Name = "leaderstats" local Sufferings = Instance.new("IntValue", folder) Sufferings.Name = "Sufferings" Sufferings.Value = 0 local SufferCoins = Instance.new("IntValue", folder) SufferCoins.Name = "SufferCoins" SufferCoins.Value = 0 local infoSaved = nil local infoSaved2 = nil local succeful, fail = pcall(function() infoSaved = SufferingsDataStore:GetAsync(plr.UserId) infoSaved2 = SufferCoinsDataStore:GetAsync(plr.UserId) end) if succeful then plr.leaderstats.Sufferings.Value = infoSaved plr.leaderstats.SufferCoins.Value = infoSaved2 warn("Data loaded successfully") end end) player.PlayerRemoving:Connect(function(plrE) warn("Goodbye " ..plrE.Name.."!") local points1 = plrE.leaderstats.SufferCoins.Value local points2 = plrE.leaderstats.Sufferings.Value local succeful, fail = pcall(function() SufferingsDataStore:SetAsync(plrE.UserId, points2) SufferCoinsDataStore:SetAsync(plrE.UserId, points1) end) if succeful then warn("Data saved correctly") end end) 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 plr.leaderstats.Sufferings.Value = infoSaved when player removing do the same with points1 set points to plr.leaderstats.yourValue.value, also set async data with points.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/77834599
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77826394
has comment: http://stackoverflow.com/comment/137222660
has body: I presume, you want to get numerical derivative, not symbolic. Then why not use the most straightforward approach? -- lim_{x -&gt; x0} f(x): local function limit (f, x0, left) local x0 = x0 or 0 local y0 = f (x0) if y0 == y0 --not NaN, i.e. 0/0 then -- Simplest case: lim_{x -&gt; x0} f(x) = f (x0) (not for derivative, anyway): return y0 end local abs = math.abs local delta_x = left and -2e-9 or 2e-9 local y, y1, y2 -- old values of f (x). -- Halve delta_x while it is measureable or until f(x) starts to lose accuracy: while not y1 or not y2 or abs (delta_x) &gt; 0 and abs (y - y1) &lt; abs (y1 - y2) do delta_x = delta_x / 2 -- Remember changes of y: y, y1, y2 = f (x0 + delta_x), y, y1 end return y end -- f'(x): local function derivative (f, left) return function (x) -- f'(x) = lim_{delta -&gt; 0} (f (x + delta) - f(x)) / delta: return limit (function (delta) return (f (x + delta) - f (x)) / delta end, --delta -&gt; 0, left) end end -- Example: local f = function (x) return x ^ 3 end local df = derivative (f) for _, x in ipairs {-3, -2, -1, 0, 1, 2, 3} do print (x, df (x)) end or simplified: local delta = 1e-9 local function derivative (f) return function (x) return (f (x + delta) - f (x)) / delta end end -- Example: local f = function (x) return x ^ 3 end local df = derivative (f) for _, x in ipairs {-3, -2, -1, 0, 1, 2, 3} do print (x, df (x)) end

http://stackoverflow.com/q/77788967
score: 0
type: Question
has title: Hitbox always hitting more than once in combat system (roblox)
tagged with: lua
has body: 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: local deb = game:GetService("Debris") game.ReplicatedStorage.Remotes.M1.OnServerEvent:Connect(function(player, combo) local debounce = false --//Debug\\-- print("Current Combo: " .. combo) --//Debug--\\ local anims = player.Character:WaitForChild("Anims") local animator = player.Character.Humanoid:WaitForChild("Animator") local combo1 = animator:LoadAnimation(anims.Combo1) local combo2 = animator:LoadAnimation(anims.Combo2) local combo3 = animator:LoadAnimation(anims.Combo3) local combo4 = animator:LoadAnimation(anims.Combo4) local endlag = 1 if combo == 1 then combo1:Play() elseif combo == 2 then combo2:Play() elseif combo == 3 then combo3:Play() elseif combo == 4 then combo4:Play() end local character = player.Character if character then local hrp = character:FindFirstChild("HumanoidRootPart") if hrp then local damagePart = Instance.new("Part") damagePart.Material = "ForceField" damagePart.Parent = workspace damagePart.Size = Vector3.new(5, 5, 5) damagePart.Anchored = false damagePart.CanCollide = false damagePart.Transparency = 0 damagePart.Name = "DamagePart" deb:AddItem(damagePart, 0.4) local weld = Instance.new("Weld") weld.Part0 = hrp weld.Part1 = damagePart weld.C0 = CFrame.new(0, 0, 0) -- Adjust the offset as needed weld.Parent = hrp damagePart.Touched:Connect(function(otherPart) local humanoid = otherPart.Parent:FindFirstChild("Humanoid") if humanoid and humanoid.Parent ~= player.Character and not debounce then spawn(function() debounce = true wait(1) debounce = false end) local stunned = otherPart.Parent:FindFirstChild("Stunned") if not stunned then stunned = Instance.new("BoolValue") stunned.Name = "Stunned" stunned.Parent = otherPart.Parent end local blocking = otherPart.Parent:FindFirstChild("Blo…
tagged with: roblox
has answer: http://stackoverflow.com/a/77789767
type: UnansweredQuestion
answer count: 1

http://stackoverflow.com/a/77810559
has body: You can try this: local path = "/path/to/your/file/filename.txt" local filename, extension = path:match("^.+/(.+)%.(.+)$") print("Filename: " .. filename) print("Extension: " .. extension)
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77810553
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/77810553
type: Answer

http://stackoverflow.com/a/77794827
has body: So here's the thing about wait, 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. So in this code : sonido:Play() wait(.1) visual.Transparency = .8 wait(.1) visual.Transparency = 1 sonido.Ended:Wait() It's possible that your sound will have finished playing before the it makes it to the sonido.Ended:Wait() 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 cannot progress from this point. You should check if the sound is still playing before blocking. if sonido.Playing then sonido.Ended:Wait() end
accepted answer of: http://stackoverflow.com/q/77790831
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/77790831
score: 0

http://stackoverflow.com/comment/137238931
score: 0
type: QuestionComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/77846650

http://stackoverflow.com/q/77851596
answer count: 1
type: AnsweredQuestion
score: 0
has body: 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. 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: Server-Side Script local plr local mouseTarget game.ReplicatedStorage.Tool.OnServerEvent:Connect(function(player, mouseTarget2) plr = player mouseTarget = mouseTarget2 end) print(plr, mouseTarget) script.Parent.Equipped:Connect(function() game.ReplicatedStorage.LanternEvents.Equipped:FireClient(plr) end) script.Parent.Unequipped:Connect(function() game.ReplicatedStorage.LanternEvents.UnEquipped:FireClient(plr) end) script.Parent.Activated:Connect(function() if mouseTarget:FindFirstChildWhichIsA("ClickDetector") then if mouseTarget.Name == "Paper" then game.ReplicatedStorage.PaperEvents.PaperEvent1:FireClient(plr) plr.CameraMode = Enum.CameraMode.Classic elseif mouseTarget.Parent.Name == "Keypad" then game.ReplicatedStorage.KeypadEvent:FireClient(plr) elseif mouseTarget.Parent.Name == "Lighter" then game.Workspace.Values.CollectedLighter.Value = true mouseTarget:Destroy() else game.Workspace.Values.Collected.Value += 1 mouseTarget:Destroy() end end end) Local Script: local player = game.Players.LocalPlayer local mouse = player:GetMouse() local mouseTarget = mouse.Target while wait(0.01) do game.ReplicatedStorage.Tool:FireServer(mouseTarget) end The Output is: Nil Nil. Thank you in advance, Programming_Good_Games.
type: Question
has answer: http://stackoverflow.com/a/77852307
has title: How would I access the player's local mouse from a server-side script in Roblox Studio?
tagged with: lua
accepted answer: http://stackoverflow.com/a/77852307
tagged with: roblox-studio

http://stackoverflow.com/comment/137448554
has text: [lua-http](https://daurnimator.github.io/lua-http/0.1/) with [cqueues](http://25thandclement.com/~william/projects/cqueues.html)
type: QuestionComment
comment on: http://stackoverflow.com/q/77958049
type: Comment
score: 0

http://stackoverflow.com/q/77886971
tagged with: neovim
upvote count: 1
answer count: 2
has comment: http://stackoverflow.com/comment/137377681
favorite count: 0
has body: I have been using nvim for a couple months now and 90% of the time everything works smoothly. Sometimes when I open nvim on my laptop (the same config works fine on my PC) I get the following error: Error detected while processing BufReadPost Autocommands for "*": Error executing lua callback: /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: Error executing lua: /home/fergus/nvim-linux64/share/nvim/runtime/filetype .lua:25: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders /init.lua:139: attempt to index field 'loaded_fts' (a nil value) stack traceback: ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders/init.lua:139: in function 'load_lazy_loaded' ...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:87: in function <...fergus/.local/share/nvim/lazy/LuaSnip/plugin/luasnip.lua:86> [C]: in function 'nvim_cmd' /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:25: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24> [C]: in function 'nvim_buf_call' /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10> stack traceback: [C]: in function 'nvim_cmd' /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:25: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24> [C]: in function 'nvim_buf_call' /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10> stack traceback: [C]: in function 'nvim_buf_call' /home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:24: in function </home/fergus/nvim-linux64/share/nvim/runtime/filetype.lua:10> Error detected while processing BufWinEnter Autocommands for "*": Error executing lua callback: ...cal/share/nvim/lazy/LuaSnip/lua/luasnip/loaders/init.lua:139: attempt to index field 'loaded_fts' (a nil valu…
type: Question
downvote count: 0
score: 1
has title: Nvim: Error detected while processing BufReadPost Autocommands for "*":
tagged with: lua
has answer: http://stackoverflow.com/a/78949478
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77952065
tagged with: autocommand

http://stackoverflow.com/comment/137238908
has text: Is this the real dockerfile? How do you set env variables? Because according to the docs, the syntax is `ENV <key>=<value> ...`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77846650
score: 1

http://stackoverflow.com/comment/137915107
has text: 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
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77817799
type: Comment

http://stackoverflow.com/comment/137416516
has text: 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.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/77939546
type: QuestionComment

http://stackoverflow.com/q/77850861
has title: Error executing lua /home/user/.config/nvim/lua/init.lua:7: module 'vscode.colors' not found:
has answer: http://stackoverflow.com/a/77854180
type: Question
tagged with: lua
type: UnansweredQuestion
upvote count: 2
tagged with: neovim-plugin
has body: I'm trying to update the theme of my neovim similar to vscode. I found this Plugin for the neovim to do that: https://github.com/Mofiqul/vscode.nvim I followed the documentation which what I did is put Plug 'Mofiqul/vscode.nvim' in the ~/.config/nvim/init.vim, and ran the command :PlugInstall which it installed the Plugin on the ~/.config/nvim/Plugged/vscode.nvim After that I create a lua directory and a init.lua file to create the usage for the plugin: ~/.config/nvim/lua/init.lua After I did those step when I tried to open nvim It shows me this: Error detected while processing /home/user/.config/nvim/init.vim: line 3: E5108: Error executing lua /home/user/.config/nvim/lua/init.lua:7: module 'vscode.colors' not found: no field package.preload['vscode.colors'] no file './vscode/colors.lua' no file '/usr/share/luajit-2.1.0-beta3/vscode/colors.lua' no file '/usr/local/share/lua/5.1/vscode/colors.lua' no file '/usr/local/share/lua/5.1/vscode/colors/init.lua' no file '/usr/share/lua/5.1/vscode/colors.lua' no file '/usr/share/lua/5.1/vscode/colors/init.lua' no file './vscode/colors.so' no file '/usr/local/lib/lua/5.1/vscode/colors.so' no file '/usr/lib/x86_64-linux-gnu/lua/5.1/vscode/colors.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file './vscode.so' no file '/usr/local/lib/lua/5.1/vscode.so' no file '/usr/lib/x86_64-linux-gnu/lua/5.1/vscode.so' no file '/usr/local/lib/lua/5.1/loadall.so' stack traceback: [C]: in function 'require' /home/user/.config/nvim/lua/init.lua:7: in main chunk [C]: in function 'require' [string ":lua"]:1: in main chunk This is my init.vim file: :set number lua require('init') call plug#begin() Plug 'http://github.com/tpope/vim-surround' " Surrounding ysw) Plug 'https://github.com/preservim/nerdtree' " NerdTree Plug 'https://github.com/tpope/vim-commentary' " For Commenting gcc & gc Plug 'https://github.com/vim-airline/vim-airline' " Status bar Plug 'https://github.com/ap/vim-css-color' " CSS Color Preview Plug 'https://github.com/rafi/awe…
score: 2
tagged with: neovim
answer count: 1
favorite count: 0
downvote count: 0

http://stackoverflow.com/comment/137199928
has text: @Marc i edit question again can you help me ?
comment on: http://stackoverflow.com/q/77824896
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/137162338
type: Comment
has text: bro thank you i read the basics and i thought i did the if and local stamens correct but not thaks
comment on: http://stackoverflow.com/a/77803728
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137377766
comment on: http://stackoverflow.com/q/77922338
type: Comment
type: QuestionComment
score: 0
has text: 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: C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llua: No such file or directory collect2.exe: error: ld returned 1 exit status

http://stackoverflow.com/a/78623298
type: Answer
answers question: http://stackoverflow.com/q/77790950
has body: 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. local anims = { id, id, id } Next you will want to identify the character animator. local animator = Player.Humanoid:WaitForChild("Animator") Then you'll want to load one of the animations onto your character animator: local anim = animator:LoadAnimation(math.random(1, #anims)) You will want the line above to be under your if input.KeyCode == Enum.KeyCode.W then. Under Player.Humanoid.WalkSpeed = Speeds.Extra you should add: anim:Play() 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 anim:Stop(). Hope this helps!
score: 0

sprite
tags question: http://stackoverflow.com/q/77945374
tag name: sprite
type: Tag

http://stackoverflow.com/comment/137429128
has text: Replace `split(" > ")` with `split(">")`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77951212

treesitter
type: Tag
tags question: http://stackoverflow.com/q/77933538
tags question: http://stackoverflow.com/q/77852628
tag name: treesitter
tags question: http://stackoverflow.com/q/78294508
tags question: http://stackoverflow.com/q/78845415
tags question: http://stackoverflow.com/q/78951239

http://stackoverflow.com/comment/137428343
type: QuestionComment
has text: *"Their documentation probably has a mistake"* - file a bug. Have it fixed, improve the situation for everybody.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77951468

http://stackoverflow.com/q/77891743
type: Question
has answer: http://stackoverflow.com/a/77892721
possible better answer: http://stackoverflow.com/a/78294674
tagged with: roblox
upvote count: 0
score: -2
has body: I don't know how to change the Player's Health in Roblox. I tried this: local Object = game.Workspace.Baseplate Object.Touched:Connect(function() game.StarterPlayer.HealthDisplayDistance = 50 end) local Killbrick = game.Workspace.Part I thought the 3rd Line changed the health of the Player but it didn't do anything.
tagged with: lua
answer count: 2
has answer: http://stackoverflow.com/a/78294674
favorite count: 0
downvote count: 2
type: AnsweredQuestion
has title: Change Player's Health
accepted answer: http://stackoverflow.com/a/77892721
tagged with: luau

viewport
type: Tag
tag name: viewport
tags question: http://stackoverflow.com/q/77823700

http://stackoverflow.com/comment/137174263
has text: 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)*".
type: Comment
comment on: http://stackoverflow.com/q/77810553
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138802533
comment on: http://stackoverflow.com/q/77854806
score: 1
type: Comment
type: QuestionComment
has text: 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.

http://stackoverflow.com/q/77916441
tagged with: lua
has title: How do I get an equipped tool in Roblox Studio?
has answer: http://stackoverflow.com/a/78281895
tagged with: roblox-studio
type: UnansweredQuestion
answer count: 1
score: 0
tagged with: roblox
type: Question
has body: 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. I've tried a bunch of different ways to get the gun from the player's character, including ":WaitForChild" and for loops, but they never end up working. Here is my code: local players = game:GetService("Players") local replicatedStorage = game:GetService("ReplicatedStorage") local function getEquippedTool(player: Player): Tool? local character = player.Character if not character then print("no character") return nil else local shotgun = character:WaitForChild("Shotgun") if not shotgun then print("no shotgun") return nil else print("success") return shotgun end end end replicatedStorage:WaitForChild("ShotgunShoot").OnServerEvent:Connect(function(plr,part,pos,damage) print("Server: Triggered") local char = plr.Character local tool = getEquippedTool(plr) if tool == nil then print("tool doesnt exist") else print(tool.Name) local handle = tool:WaitForChild("Handle") if part then print("part=true") if part.Parent and part.Parent:FindFirstChild("Humanoid") then local humanoid = part.Parent.Humanoid humanoid:TakeDamage(damage) print("HIT") else print("MISS") local bullet = Instance.new("Part") bullet.Size = Vector3.new(0.1,0.1,0.1) bullet.Position = pos bullet.BrickColor = BrickColor.Black() bullet.Anchored = true bullet.CanCollide = false bullet.Parent = workspace game.Debris:AddItem(bullet, 5) end end if handle:FindFirstChild("ShotgunSound") then local sound = handle.ShotgunSound sound:Play() end end end) Can someone help me fix this? EDIT: To clarify, the function getEquippedTool() is returning nil and I want it to return player.Character.Shotgun which I know is equipped when running the script.

http://stackoverflow.com/comment/137154787
score: 0
has text: Thanks for the extra keywords to search for found this issue discussing the same thing https://github.com/neovim/neovim/issues/2325
type: AnswerComment
comment on: http://stackoverflow.com/a/77799598
type: Comment

http://stackoverflow.com/q/77790950
answer count: 1
type: Question
tagged with: lua
tagged with: roblox
has answer: http://stackoverflow.com/a/78623298
has title: How do I add a different animation to a sprint mechanic (ROBLOX Lua)
type: UnansweredQuestion
score: 0
has body: `Hi, sorry first time asking a question. Straight 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. My script is simple. The 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. THIS IS THE SCRIPT IN QUESTION: local Player = { ["Player"] = game.Players.LocalPlayer, ["Character"] = script.Parent, ["Humanoid"] = script.Parent:WaitForChild("Humanoid"), } local Speeds = { ["Normal"] = 16, ["Extra"] = 32, } local Debounces = { ["MaxTicks"] = 0.2, ["Cooldown"] = 0, ["Debounce"] = false, ["Running"] = false, ["LastTime"] = tick() } -- What do Debounces do? How do they work? local Services = { ["UIS"] = game:GetService("UserInputService") } -- What does Connect Function do Services.UIS.InputBegan:Connect(function(input, isTyping) if isTyping then return end -- ^^^ Why do we put this line of code if input.KeyCode == Enum.KeyCode.W then if not Debounces.Debounce and not Debounces.Running then if tick() - Debounces.LastTime <= Debounces.MaxTicks then Debounces.Debounce = true Debounces.Running = true Player.Humanoid.WalkSpeed = Speeds.Extra Debounces.LastTime = tick() else Debounces.LastTime = tick() -- What are all these Debounces stuff for end end end end) Services.UIS.InputEnded:Connect(function(input, isTyping) if isTyping then return end if Debounces.Running and input.KeyCode == Enum.KeyCode.W then Debounces.Running = false Player.Humanoid.WalkSpeed = Speeds.Normal wait(Debounces.Cooldown) Debounces.Debounce = false -- Same for these end end)`

http://stackoverflow.com/comment/137316931
score: 0
has text: I had actually tried that one before and it didn't do the trick.
type: AnswerComment
comment on: http://stackoverflow.com/a/77890429
type: Comment

http://stackoverflow.com/comment/137153394
type: Comment
score: 0
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/77789995

http://stackoverflow.com/comment/137136800
has text: Make another function with the loop, call that function from the two places you have the loop today.
score: 4
comment on: http://stackoverflow.com/q/77789995
type: QuestionComment
type: Comment

reflection
tags question: http://stackoverflow.com/q/77902368
tag name: reflection
type: Tag

http://stackoverflow.com/comment/137361915
type: AnswerComment
score: 0
has text: Also, what happens if the code surrounded by `return ;` do a side effect AND fail...
comment on: http://stackoverflow.com/a/77915148
type: Comment

http://stackoverflow.com/comment/137361075
score: 0
type: AnswerComment
has text: If you add this link to the code I'll accept you answer: https://github.com/lua/lua/blob/e288c5a91883793d14ed9e9d93464f6ee0b08915/lua.c#L574
comment on: http://stackoverflow.com/a/77915148
type: Comment

http://stackoverflow.com/a/77933920
type: Answer
has body: 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. 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). The following code will work as expected: local varPreviousPositionX local varPreviousPositionY local function objectTracking() if varPreviousPositionX and varPreviousPositionY then -- do something with it end -- move body varPreviousPositionX = object.body:getX() varPreviousPositionY = object.body:getY() end
answers question: http://stackoverflow.com/q/77930867
has comment: http://stackoverflow.com/comment/137394601
has comment: http://stackoverflow.com/comment/137418709
score: 0

http://stackoverflow.com/a/77854053
score: 0
has body: According to this, 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.
type: Answer
answers question: http://stackoverflow.com/q/77852628

http://stackoverflow.com/comment/137184547
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77815499
has text: Could you provide Figure 25.6 (or a good description of what it is)?
type: Comment

http://stackoverflow.com/comment/137393503
has text: Hi xTerrene, Good to hear that it is working now. The ; syntax is merely meant as syntactic sugar and nothing else.
type: AnswerComment
comment on: http://stackoverflow.com/a/77927881
type: Comment
score: 0

http://stackoverflow.com/comment/137173418
comment on: http://stackoverflow.com/q/77809496
has text: Where are the Script and LocalScript located?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/a/77827117
has comment: http://stackoverflow.com/comment/137219161
has body: You should write a function to poll the MB4 status while sleeping. Transition of IsMouseButtonPressed(4) from false to true means MB4 is pressed for the second time. local MB4_pressed, second_MB4_press local function InterruptableSleep(ms) local tm_stop = GetRunningTime() + ms while not second_MB4_press and GetRunningTime() < tm_stop do Sleep(10) local MB4 = IsMouseButtonPressed(4) MB4_pressed, second_MB4_press = MB4, MB4 and not MB4_pressed end end function OnEvent(event, arg) --OutputLogMessage("event = %s, arg = %s\n", event, tostring(arg)) if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then MB4_pressed = not MB4_pressed if MB4_pressed then second_MB4_press = false repeat PressKey("2") InterruptableSleep(math.random(40, 90)) ReleaseKey("2") InterruptableSleep(math.random(40, 90)) until second_MB4_press end end end
answers question: http://stackoverflow.com/q/77824896
has comment: http://stackoverflow.com/comment/137208294
score: 0
has comment: http://stackoverflow.com/comment/137208279
type: Answer

http://stackoverflow.com/a/77885012
score: 0
has comment: http://stackoverflow.com/comment/137329045
has body: 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. For example: local currentlyRunning = false function test() if currentlyRunning then return end currentlyRunning = true task.wait(5) -- Very important if you have any return statements, put this line infront of them. -- Otherwise, the execution of the function may stop and currentlyRunning = false end 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. For example: local enemies = 0 event:Connect(function() enemies +=1 end) RunService:Hearbeat:Connect(function() print(enemies) end) 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.
type: Answer
answers question: http://stackoverflow.com/q/77884118

http://stackoverflow.com/a/77939110
has body: After lua_pcall returns, jj is no longer on the call stack. You can use lua_getinfo: int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); Starting the what string with > pops a function from the stack, and fills out the debug structure with information based on the rest of the characters in the what string (see: lua_Debug for details). #include <lauxlib.h> #include <lua.h> #include <lualib.h> #include <stdio.h> int main(void) { lua_State *L = luaL_newstate(); luaL_openlibs(L); const char *luaCode = "function jj() print('Hello from Lua!') end"; luaL_dostring(L, luaCode); lua_getglobal(L, "jj"); lua_Debug ar; if (lua_getinfo(L, ">Sn", &ar)) { printf("Function (%s): %s\n", ar.what, ar.name ? ar.name : "(no name)"); printf("Source: %s\n", ar.short_src); printf("Line: %d\n", ar.linedefined); } lua_close(L); } Function (Lua): (no name) Source: [string "function jj() print('Hello from Lua!') end"] Line: 1 Or set a hook with lua_sethook. Here is a hook that runs every time a function is called: #include <lauxlib.h> #include <lua.h> #include <lualib.h> #include <stdio.h> static void hook(lua_State *L, lua_Debug *ar) { if (LUA_HOOKCALL == ar->event && lua_getinfo(L, "Snl", ar)) { printf("Function (%s): %s\n", ar->what, ar->name ? ar->name : "(no name)"); printf("Source: %s\n", ar->short_src); printf("Line: %d\n", ar->currentline); } } int main(void) { lua_State *L = luaL_newstate(); luaL_openlibs(L); const char *luaCode = "function jj() print('Hello from Lua!') end"; luaL_dostring(L, luaCode); lua_sethook(L, hook, LUA_MASKCALL, 0); lua_getglobal(L, "jj"); lua_pcall(L, 0, 0, 0); lua_close(L); } Function (Lua): (no name) Source: [string "function jj() print('Hello from Lua!') end"] Line: 1 Function (C): print Source: [C] Line: -1 Hello from Lua! Whereas lua_getstack is for collecting the activation record for a currently active function call (which you can then use with lua_getinfo to collect debug information). #include <lauxlib.h> #include <lua.h> #include <lualib…
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77930478

http://stackoverflow.com/a/77906506
has comment: http://stackoverflow.com/comment/137346134
score: 1
has comment: http://stackoverflow.com/comment/137381196
upvote count: 1
has body: I am using it like this and it works: local inputDir = 'D:/Lua/' local fileNames = {} local filesString = io.popen('dir "'..inputDir..'" /b /a-d'):read("*a") for fileName in filesString:gmatch("[^\r\n]+") do fileName = fileName:gsub("%.txt", "") table.insert(fileNames, fileName) end
answers question: http://stackoverflow.com/q/77906120
type: Answer
has comment: http://stackoverflow.com/comment/137381081
downvote count: 0

http://stackoverflow.com/a/77852307
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77851596
answers question: http://stackoverflow.com/q/77851596
has body: There is no understating how much of a bad idea this is. Firstly, and most importantly, you should never be sending constant requests to the server since this will cause poor performance. You should instead Listen to the RunService Heartbeat event on the client 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. You 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. To continue, it is impossible to directly access the mouse from the server since the mouse only exists on the client.

http://stackoverflow.com/comment/137336927
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77899954
type: Comment
has text: thanks, seems to work with `let list: Cars = value.as_userdata().unwrap().take().unwrap();`

http://stackoverflow.com/comment/137458406
has text: This is a very clever way to handle defining the signatures.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/77965863
type: Comment

filenames
type: Tag
tags question: http://stackoverflow.com/q/77810553
tag name: filenames

http://stackoverflow.com/comment/137334861
has text: 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`
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/77899954
type: Comment

http://stackoverflow.com/comment/137203974
has text: Both tables are created in shared.lua in lines 7 and 8. The code is already above.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77824918

design-patterns
tag name: design-patterns
type: Tag
tags question: http://stackoverflow.com/q/77959155

http://stackoverflow.com/comment/137198441
comment on: http://stackoverflow.com/q/77817799
score: 0
type: QuestionComment
has text: 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)
type: Comment

http://stackoverflow.com/comment/137377378
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/77924414
score: 2
has text: FFI arrays start from 0, as in C.

http://stackoverflow.com/comment/137208284
has text: 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)`
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77824918

camera
tags question: http://stackoverflow.com/q/77823700
tag name: camera
type: Tag
tags question: http://stackoverflow.com/q/79299671

http://stackoverflow.com/comment/137299109
score: 1
type: Comment
type: QuestionComment
has text: Well, the thing you pass to `getHRP()` is `nil`.
comment on: http://stackoverflow.com/q/77880937

http://stackoverflow.com/a/77836370
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/77836329
has body: To check if a single-character string is uppercase, you could use the string.upper method like so: Lua 5.3.6 Copyright (C) 1994-2020 Lua.org, PUC-Rio > b = "a" == string.upper("a") > b false > b = "A" == string.upper("a") > b true Alternatively, if you really just want to check single characters e.g. of ASCII, you can use string.byte to get the character code and check if it matches the uppercase ASCII range (65 -- 90): > string.byte("A") 65 > string.byte("Z") 90 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.
upvote count: 2

http://stackoverflow.com/q/77838212
has comment: http://stackoverflow.com/comment/137224059
tagged with: random
tagged with: lua
type: UnansweredQuestion
has body: I'm trying to create in a lua script a function for generating random strings. This is my code: math.randomseed(os.time()) local charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" function string.random(length) if length > 0 then return string.random(length - 1) .. charset:sub(math.random(1, #charset), 1) else return "" end end -- Create the string local scenarioname = string.random(10) print ('the scenario name is ' .. scenarioname) but the scenarioname string is always empty. What I'm doing wrong? I'm using luajit
tagged with: string
score: 0
type: Question
has title: Random string in lua
has comment: http://stackoverflow.com/comment/137229958
answer count: 0

http://stackoverflow.com/q/77933538
answer count: 1
type: UnansweredQuestion
tagged with: neovim
score: 0
has answer: http://stackoverflow.com/a/78178993
has title: vim-dadbod-ui configuration for treesitter
tagged with: lua
type: Question
has body: 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. I tried reading the documentation but there was nothing related that could help me.
tagged with: sql
tagged with: treesitter

domoticz
type: Tag
tag name: domoticz
tags question: http://stackoverflow.com/q/77802738

http://stackoverflow.com/comment/137161769
type: QuestionComment
comment on: http://stackoverflow.com/q/77802738
score: 1
has text: 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?
type: Comment

http://stackoverflow.com/a/77909693
has comment: http://stackoverflow.com/comment/137366635
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/77904973
score: 3
has body: The correct formula of the triangle signed area is (x1*y2 - x2*y1)/2 assuming the third vertex is at (0,0) A point is inside a convex poly when all point-edge-traingle areas are of the same sign. local function polyEdgeIterator(poly) -- poly as {x1,y1, x2,y2, x3,y3, ...} local i, imax = 0, #poly local x2, y2 = poly[imax-1], poly[imax] return function() i = i + 2 if i &lt;= imax then local x1, y1 = x2, y2 x2, y2 = poly[i - 1], poly[i] return x1, y1, x2, y2 end end end local function getTriangleArea(x0,y0, x1,y1, x2,y2) -- area of the triangle, its sign is determined by the triangle vertices sequence direction (CW/CCW) return ((x1-x0) * (y2-y0) - (x2-x0) * (y1-y0)) * 0.5 end local function pointInConvexPolygon(x, y, poly) local minArea, maxArea = 0, 0 for x1,y1, x2,y2 in polyEdgeIterator(poly) do local area = getTriangleArea(x,y, x1,y1, x2,y2) minArea = math.min(minArea, area) maxArea = math.max(maxArea, area) if minArea * maxArea &lt; 0 then return false end end return true end print(pointInConvexPolygon(2,1, {1,-1, 2,2, 4,1})) -- true print(pointInConvexPolygon(3,0, {1,-1, 2,2, 4,1})) -- false
has comment: http://stackoverflow.com/comment/137367032
answers question: http://stackoverflow.com/q/77904973

http://stackoverflow.com/a/77902316
downvote count: 0
score: 1
type: Answer
has body: That’s not how you use the until statement. Your until statement with the wait is saying "if wait(5) doesn’t return anything", 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. This is what I would do instead: local success, result do repeat success, result = pcall(money.GetAsync, money, key) if not success then wait(5) end until success or MAX_RETRIES A note on MAX_RETRIES: this is a placeholder making a note that you should add a retry cap. Repeatedly calling this function is bad use of DataStores. It would create a loop that runs forever until DataStores return true, which can cause an issue if DataStores are down or the call is not succeeding. I’m not sure why you would use a loop statement with data anyway. The simple response here is to do error handling. If there’s no data in the key (which then GetAsync returns nil), you handle that case instead of making a loop. local success, result = pcall(money.GetAsync, money, key) if success then if result then -- Data non-nil else -- Data nil end else -- Success false, do something about it end
upvote count: 1
answers question: http://stackoverflow.com/q/77901201

http://stackoverflow.com/a/77906341
has body: CFrame.Angles creates a new CFrame, what you want is to do add them (multiplying replaces adding for CFrames idk why) So: plug.PrimaryPart.CFrame = plug.PrimaryPart.CFrame * CFrame.Angles(math.rad(rx),math.rad(ry),math.rad(90))
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77853630

http://stackoverflow.com/a/77824030
score: 0
type: Answer
has body: I'm not sure there's an answer I would find fully satisfactory. The given implementation gathers functions from chunkEnv after loading the file. If the sandboxed code's "own functions" are simply these functions, things are easy. We can detect when new functions are added via a __newindex metamethod and immediately add them to the validfunc set. 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. Also, this method is potentially insecure -- the file can whitelist any function simply by adding it to chunkEnv. (This already seems like a vulnerability in the existing code if validfunc is used later, but adding immediately would allow any read-accessible function to be used inside the f() 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?) 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 chunkEnv as an upvalue -- they may define a new environment, or they might not use _ENV. (And in general, there is no guarantee a forbidden function can't end up using chunkEnv.) In terms of book-keeping, then, we are left with debug info. The source 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 source -- do the file system and loading model allow two files to end up with the same source? Does the attacker have access to package.loaded? (With loading binary chunks t…
answers question: http://stackoverflow.com/q/77815499

http://stackoverflow.com/comment/137151687
comment on: http://stackoverflow.com/q/77797865
type: QuestionComment
has text: You need to study logic and programming more.
score: 1
type: Comment

http://stackoverflow.com/q/77945609
type: Question
answer count: 0
tagged with: lua
tagged with: fivem
has body: 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. [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') [script:qb-multichara] &gt; CheckPlayerData (@qb-core/server/player.lua:164) [script:qb-multichara] &gt; ref (@qb-core/server/player.lua:30) [script:qb-multichara] &gt; rawExecute (@oxmysql/dist/build.js:26552) [script:qb-multichara] &gt; processTicksAndRejections (node:internal/process/task_queues:96) [script:qb-multichara] [script:qb-multichara] &gt; handler (@qb-multicharacter/server/main.lua:107) [script:qb-multichara] &gt; rawExecute (@oxmysql/dist/build.js:26552) [script:qb-multichara] &gt; processTicksAndRejections (node:internal/process/task_queues:96) I don't know what to do here. 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.
type: UnansweredQuestion
score: 0
has title: SCRIPT ERROR: @qb-core/server/player.lua:164: attempt to index a nil value (field 'Jobs')

http://stackoverflow.com/comment/137306323
type: Comment
comment on: http://stackoverflow.com/a/77880646
score: 0
type: AnswerComment
has text: Yep that looks like the issue.

http://stackoverflow.com/comment/137165646
type: Comment
comment on: http://stackoverflow.com/a/77799598
has text: 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.
score: 0
type: AnswerComment

http://stackoverflow.com/a/77953378
type: Answer
has body: 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. 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. -- get complex.lua from https://codereview.stackexchange.com/questions/252982/complex-number-class-in-lua. local complex = require 'complex' --Get the iteration, at which the recursive function exceeds the limit. Not recursive. @param function func -- the recursive function to check, @param number limit -- limit to exceed, @param number max_iterations -- maximum number of iterations, @return number -- iteration at which the limit is exceeded, but not more than max_iterations. -- local function iteration (func, limit, max_iterations) local z, iteration = complex (0), 0 while iteration &lt; max_iterations and z:abs () &lt;= limit do z, iteration = func (z), iteration + 1 end return iteration end --[[ Get the iteration, at which the recursive function exceeds the limit. Recursive. @param function func -- the recursive function to check, @param number limit -- limit to exceed, @param number max_iterations -- maximum number of iterations, @param complex z -- current value in the series; 0 by default, @param number iteration -- the current iteration; 0 by default. @return number -- iteration at which the limit is exceeded, but not more than max_iterations. --]] local function iterationRecursive (func, limit, max_iterations, z, iteration) local z, iteration = z or complex (0), iteration or 0 if iteration &gt;= max_iterations or z:abs() &gt; limit then return iteration end z, iteration = func (z), iteration + 1 return iterationRecursive (func, li…
score: 0
answers question: http://stackoverflow.com/q/77950812

http://stackoverflow.com/comment/137307862
type: Comment
has text: The module system is a new feature, so I can understand why there are no compilation instructions.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77878004

http://stackoverflow.com/a/78954259
score: 2
has body: Here's my lazy config for neo-tree.nvim. Previous answers didn't work for me, so I edited my keymaps to set relative line numbers each time. return { 'nvim-neo-tree/neo-tree.nvim', version = '*', dependencies = { 'nvim-lua/plenary.nvim', 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended 'MunifTanjim/nui.nvim', }, cmd = 'Neotree', keys = { -- here's the keymap that sets the relative numbers { '\\', ':Neotree reveal&lt;CR&gt;:set relativenumber&lt;CR&gt;', desc = 'NeoTree reveal', silent = true }, }, opts = { filesystem = { window = { mappings = { ['\\'] = 'close_window', }, }, }, }, }
upvote count: 2
answers question: http://stackoverflow.com/q/77927924
downvote count: 0
type: Answer

dynamic-tables
tags question: http://stackoverflow.com/q/77838818
type: Tag
tag name: dynamic-tables

http://stackoverflow.com/a/78949478
score: 0
has body: I had the same issue. The fix is to install the language pack. PHP wasn't recognized for me. I installed through :TSInstall php
type: Answer
answers question: http://stackoverflow.com/q/77886971

http://stackoverflow.com/comment/137407512
comment on: http://stackoverflow.com/q/77922338
has text: I tested the compilation work with VMWare Ubuntu 2204 with lua 5.4.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/77905622
has body: You can always add other paths to the package paths as: local path1 = ';'..'d:/LuaProjects/'..'?.lua' local path2 = ';'..'d:/LuaProjects/'..'?/?.lua' package.path = package.path .. path1 .. path2 Use the print (package.path) for other examples. But normally the project structure must have main.lua in the root of project: project/ main.lua fonts/ font.ttf and now you are need to define it as: customFont = love.graphics.newFont("fonts/font.ttf", 24)
answers question: http://stackoverflow.com/q/77895884
score: 0
type: Answer

http://stackoverflow.com/comment/138837896
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77854806
has text: @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.

http://stackoverflow.com/a/77907650
has body: The workaround is to make lpeg.Cmt(…) consume at least one character. Since the function passed to lpeg.Cmt(…) 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 lpeg.Cmt(…) may accept an empty string. The workaround: local lpeg = require 'lpeg' local pattern = lpeg.Cmt (lpeg.P (1), function (s, p) local p = p - 1 -- compensate for the one character consumed by lpeg.P (1). local n = f (s, p) -- f is not calculatable beforehand. if not ((n or 0) &gt; 0) then return false -- cannot advance, therefore fail. else return p + n, string.sub (s, p, n) -- advance. end end) ^ 1 Note lpeg.P (true) → lpeg.P (1) and inserted local p = p - 1.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/77899869
type: Answer
answers question: http://stackoverflow.com/q/77899869

http://stackoverflow.com/comment/137224059
type: QuestionComment
score: 3
has text: Second argument of `:sub` method is **not** the length of substring.
comment on: http://stackoverflow.com/q/77838212
type: Comment

http://stackoverflow.com/comment/137206946
type: Comment
comment on: http://stackoverflow.com/q/77826394
has text: "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
score: 0
type: QuestionComment

http://stackoverflow.com/q/77797865
answer count: 1
type: UnansweredQuestion
has title: i am trying my have my program diside which to respond with but it wont work and i dont know why lua
favorite count: 0
has answer: http://stackoverflow.com/a/77803728
score: -2
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/137151687
has body: print ('Hello, make a face, ') local face = io.read() local t = {&quot;{:) , :), &quot;} if local face (t1) then print (&quot; :0 &quot;) if local (t2) then print (&quot; :) &quot;) please help me fix it and help me understand why this is happening.
upvote count: 0
has comment: http://stackoverflow.com/comment/137151666
has comment: http://stackoverflow.com/comment/137153256
tagged with: lua

http://stackoverflow.com/comment/137329045
type: AnswerComment
comment on: http://stackoverflow.com/a/77885012
has text: I'm still a bit confused, can you please explain more about how these work?
type: Comment
score: 0

http://stackoverflow.com/comment/137238943
comment on: http://stackoverflow.com/q/77846650
type: Comment
score: 0
has text: I use docker compose to init the env variables
type: QuestionComment

http://stackoverflow.com/a/77881066
accepted answer of: http://stackoverflow.com/q/77880937
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77880937
has body: As @AKX pointed out, the error is telling you that for some reason c is nil. So you need to look where you call getHRP... for _, p in pairs(game.Players:GetPlayers()) do local c = game.Players:FindFirstChild(p.Name, true).Character if getHRP(c) ~= nil then When a player joins the game or has just died, there is a brief time where their Character model doesn't exist. So player.Character will be nil until their character respawns in the world. So you need to add safety checks so you aren't trying to access an object that doesn't exist : for _, player in pairs(game.Players:GetPlayers()) do local c = player.Character if c and getHRP(c) ~= nil then

http://stackoverflow.com/comment/137477708
comment on: http://stackoverflow.com/a/77973239
type: Comment
has text: 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).
type: AnswerComment
score: 0

load
type: Tag
tag name: load
tags question: http://stackoverflow.com/q/77789757

http://stackoverflow.com/a/77945524
score: 0
has comment: http://stackoverflow.com/comment/137417157
has body: 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.
answers question: http://stackoverflow.com/q/77945374
type: Answer

http://stackoverflow.com/comment/137199992
score: 1
type: Comment
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/77824896

lpeg
tags question: http://stackoverflow.com/q/77899869
type: Tag
tag name: lpeg
tags question: http://stackoverflow.com/q/78894927

http://stackoverflow.com/a/77892721
has body: Your issue is that the Health property isn't on a Player, but rather their Character model's Humanoid. -- set health to 50 when touching the baseplate local bp = game.Workspace.Baseplate bp.Touched:Connect(function(otherPart) -- double check that the other part is a character model local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player then -- set the player's health player.Character.Humanoid.Health = 50 end end) -- make a kill brick local Killbrick = game.Workspace.Part Killbrick.Touched:Connect(function(otherPart.Parent) -- double check that the other part is a character model local player = game.Players:GetPlayerFromCharacter(otherPart) if player then -- kill the player player.Character.Humanoid.Health = 0 end end)
has comment: http://stackoverflow.com/comment/137323113
type: Answer
accepted answer of: http://stackoverflow.com/q/77891743
downvote count: 0
has comment: http://stackoverflow.com/comment/137325004
type: AcceptedAnswer
score: 1
answers question: http://stackoverflow.com/q/77891743
upvote count: 1

http://stackoverflow.com/q/77838818
has comment: http://stackoverflow.com/comment/137229953
linked to: http://stackoverflow.com/q/67801776
score: 0
type: Question
answer count: 0
tagged with: lua
tagged with: lua-table
has title: Lua: Handle dynamic nested table (get and set)
has body: 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 set (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) Here is a kind of code, which obviously doesn't work (it will always return 3), but gives an idea of what I need: t={a={b={c=3}}} path={"a","b","c"} r=setmetatable(t, for _,i in pairs(path) do r=r[i] end r=1 print(t["a"]["b"]["c"]) I thought of using __index, __newindex and metatable, but I still struggle to use those, and all my experiments failed Otherwise, getting the address of the table, rather than its value would be the solution, but I don't know how to do that...
tagged with: dynamic-tables
has comment: http://stackoverflow.com/comment/137242091
has comment: http://stackoverflow.com/comment/137235022
type: UnansweredQuestion

http://stackoverflow.com/comment/137381081
type: Comment
comment on: http://stackoverflow.com/a/77906506
score: 0
has text: @Fernando try `:gmatch('([^\n]*)\n')` instead of `:gmatch("[^\r\n]+")`
type: AnswerComment

http://stackoverflow.com/comment/137286904
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/77872527
has text: 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).
type: Comment

http://stackoverflow.com/comment/137415721
type: Comment
score: 1
type: QuestionComment
has text: (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. The 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/
comment on: http://stackoverflow.com/q/77939546

rust
tags question: http://stackoverflow.com/q/77899954
tag name: rust
type: Tag
tags question: http://stackoverflow.com/q/78402894
tags question: http://stackoverflow.com/q/79068981

http://stackoverflow.com/comment/137235098
type: Comment
comment on: http://stackoverflow.com/q/77824918
score: 1
type: QuestionComment
has text: You should define the function `shallow_copy` in your code. It's not a standard Lua function.

http://stackoverflow.com/comment/137406548
type: Comment
comment on: http://stackoverflow.com/q/77941484
has text: 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?
type: QuestionComment
score: 2

http://stackoverflow.com/comment/137377681
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77886971
has text: Run this command `:TSInstall vimdoc` it helped me get rid of error you are getting.

http://stackoverflow.com/a/77871793
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/77864170
score: 1
upvote count: 1
has body: There is multiple problems with this, Firstly, you are listening to the same RemoteEvent multiple times, this is going to cause problems since you can only handle a RemoteEvent once. You should move this event outside of the setup function and have a function to update the statistic for any inputted player. 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 "Client". see (https://devforum.roblox.com/t/live-script-runcontext/1938784)

http://stackoverflow.com/a/77867501
has comment: http://stackoverflow.com/comment/137399810
has comment: http://stackoverflow.com/comment/137278830
answers question: http://stackoverflow.com/q/77866808
has body: I looked and didn't find anything wrong. I tried to tweak it a little try this code and see if it works: script.Parent["Kick/Ban"].OnServerEvent:Connect(function(plr, plrname, reason, kb) if game.Players:FindFirstChild(plrname) then local target = game.Players:FindFirstChild(plrname) if kb == "Kick" then if reason ~= "" then target:Kick(reason) elseif reason == "" then target:Kick() end elseif kb == "Ban" then local part = Instance.new("WedgePart") print(target.Name .. " has been banned") part.Parent = game.Workspace part.Name = target.Name .. " / Banned" part.CanCollide = false part.Transparency = 1 part.Anchored = true target:Kick("Banned") elseif kb == "Unban" then local tn = plrname .. " / Banned" local part2 = game.Workspace:FindFirstChild(tn) if part2 then part2:Destroy() print(target.Name .. " has been unbanned") else print(target.Name .. " is not banned") end end end end)
score: 0
type: Answer

http://stackoverflow.com/comment/137381196
score: 0
has text: If you want to catch carriage return as well, then `:gmatch('([^\r\n]*)\r?\n')` should work
comment on: http://stackoverflow.com/a/77906506
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/137297521
type: Comment
has text: Yes, that's correct, later editions changed the terminology. However, I couldn't find any compilation instructions for them in the book.
comment on: http://stackoverflow.com/a/77878004
type: AnswerComment
score: 0

shared-libraries
tags question: http://stackoverflow.com/q/77872527
type: Tag
tag name: shared-libraries

http://stackoverflow.com/comment/137278830
comment on: http://stackoverflow.com/a/77867501
has text: Sadly, doesnt work. Maybe problem is here? https://cdn.discordapp.com/attachments/1192088216677912576/1199457390467235880/image.png?ex=65c29cbe&is=65b027be&hm=5fd8cc7d35c81ec72777db6634c5601bd9fd61f8c2a2f95c0d583296c694ef7b&
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137166559
type: Comment
score: 0
comment on: http://stackoverflow.com/a/77799598
type: AnswerComment
has text: @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.

http://stackoverflow.com/a/77873224
score: 0
has body: The Lua file shouldn't be referred to in the lua object. The object should be simply {lua conky_rss}. The Lua file should be referred to in a lua_load option in the conky.config section of Conky.text. That option should be lua_load = '/home/Cthulhu/.conky/My_Script/Script_Sources/conky-rss.lua',.
type: Answer
accepted answer of: http://stackoverflow.com/q/77852183
answers question: http://stackoverflow.com/q/77852183
has comment: http://stackoverflow.com/comment/137296947
type: AcceptedAnswer

http://stackoverflow.com/a/77952065
has body: As Abdul Basit commented: Run this command :TSInstall vimdoc fixes this issue.
score: -1
type: Answer
upvote count: 1
downvote count: 2
answers question: http://stackoverflow.com/q/77886971

http://stackoverflow.com/comment/137219161
type: Comment
comment on: http://stackoverflow.com/a/77827117
score: 0
type: AnswerComment
has text: Just checked my script on GHub - it works.

http://stackoverflow.com/a/77789767
upvote count: 1
score: 1
type: Answer
has body: 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. local debounce = false game:GetService("ReplicatedStorage").Remotes.M1.OnServerEvent:Connect(function(player) if debounce then return end debounce = true ... task.wait(1) -- ensure that debounce is true for at least one second debounce = false end)
downvote count: 0
answers question: http://stackoverflow.com/q/77788967

http://stackoverflow.com/comment/137304275
score: 0
comment on: http://stackoverflow.com/a/77880646
type: Comment
has text: 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
type: AnswerComment

kong-plugin
tags question: http://stackoverflow.com/q/77847916
tag name: kong-plugin
type: Tag
tags question: http://stackoverflow.com/q/78587137
tags question: http://stackoverflow.com/q/78601647
tags question: http://stackoverflow.com/q/79053069

eluna-lua-engine
tags question: http://stackoverflow.com/q/77888368
tag name: eluna-lua-engine
type: Tag

http://stackoverflow.com/comment/137388806
type: Comment
score: 0
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/77930867

http://stackoverflow.com/comment/137367032
comment on: http://stackoverflow.com/a/77909693
score: 1
type: Comment
type: AnswerComment
has text: @darkfrei - Yes, you can rename the function to `getTriangleDoubleArea`, it will not affect `pointInConvexPolygon`

http://stackoverflow.com/comment/137235022
type: Comment
type: QuestionComment
has text: Does this answer your question? [Writing to Dynamic Multidimensional table via path](https://stackoverflow.com/questions/67801776/writing-to-dynamic-multidimensional-table-via-path)
comment on: http://stackoverflow.com/q/77838818
score: 2

http://stackoverflow.com/comment/137305961
has text: thank you so much!!!!! Made my day, it works here, now, too!!!! THX!!
score: 1
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/77884499

http://stackoverflow.com/comment/137217628
type: Comment
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/77830864
has text: Some Neovim plugins need a `setup` function to read options from the configuration or to initialize starting state.

http://stackoverflow.com/comment/137229958
type: QuestionComment
has text: 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`.
score: 0
comment on: http://stackoverflow.com/q/77838212
type: Comment

http://stackoverflow.com/a/78178993
has body: I haven't worked with vim-dadbod-ui 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. Simplest method first Requires Neovim >= 0.9.0 Confirm the filetype by executing :echo &filetype with the buffer open and focused. Assuming it returns a value, let's denote it as <vim-dadbod-ui-query-filetype> (If not, this approach won't work, move on to the next one). Add the following line to your script: vim.treesitter.language.register("sql", "<vim-dadbod-ui-query-filetype>") This is mentioned in the Tree-sitter README. Neovim should treat it as SQL 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 vim.filetype.add(). Assuming it's a pattern that consistently includes the -query- field and lacks an extension (basically a . after -query-) and we want it to be treated as SQL by Neovim (and Treesitter): vim.filetype.add({ pattern = { [".*-query-[^%.]*"] = "sql" }, }) Note: This approach also activates any plugins designed to work with SQL, such as formatters and/or linters, specified in your Neovim configuration. Only Tree-sitter should treat it as SQL Requires Neovim >= 0.9.0 If you would rather not prefer this, you have to assign such a files a custom filetype, and tell Treesitter to use SQL parser to parse these files. vim.filetype.add({ pattern = { [".*-query-[^%.]*"] = "dadbod-sql-custom" }, }) vim.treesitter.language.register("dadbod-sql-custom", "<filetype>") 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.
answers question: http://stackoverflow.com/q/77933538
score: 0
type: Answer

tui
tags question: http://stackoverflow.com/q/77852628
tag name: tui
type: Tag

http://stackoverflow.com/comment/137136968
has text: @ViaTech ok, deleted my comment too.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77789995
score: 0

http://stackoverflow.com/comment/137417157
score: 1
type: Comment
comment on: http://stackoverflow.com/a/77945524
type: AnswerComment
has text: Please refer to ESkri's comment under your question, that's the way to go.

http://stackoverflow.com/comment/137296947
type: AnswerComment
comment on: http://stackoverflow.com/a/77873224
has text: thank for the help, I finally used another service for my RSS feeds. but your comment teach me something at least
type: Comment
score: 0

http://stackoverflow.com/a/77895334
has body: You open two blocks (function(_ARG_0_) and if "table" ... but have three ends. Delete one.
score: 0
answers question: http://stackoverflow.com/q/77892559
type: Answer

http://stackoverflow.com/comment/137155042
comment on: http://stackoverflow.com/a/77800109
score: 1
type: Comment
type: AnswerComment
has text: Oh god thank you! Because of your comment i search for commas and there is another one missing in 'sfx/dlc_p60b40/p60b40_npc.awc'

http://stackoverflow.com/a/77892819
accepted answer of: http://stackoverflow.com/q/77888576
type: AcceptedAnswer
score: 0
type: Answer
has body: I've found the trick. Here's my overall cmp.lua: local lspkind = require "lspkind" local default_options = require "plugins.configs.cmp" local overriding_options = { completion = { keyword_length = 3, }, performance = { max_view_entries = 7, }, view = { docs = { auto_open = false, }, }, -- that's it formatting = { format = lspkind.cmp_format { before = function(_entry, vim_item) if vim_item.menu ~= nil and string.len(vim_item.menu) > 0 then vim_item.menu = string.sub(vim_item.menu, 1, 0) .. "" end return vim_item end, }, }, } local overall_options = vim.tbl_deep_extend("force", default_options, overriding_options) return overall_options And the result:
answers question: http://stackoverflow.com/q/77888576

http://stackoverflow.com/a/77854180
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/77850861
has body: You need to move lua require('init') after call plug#end(), otherwise the plugin hasn't loaded yet, and you can't use it.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/137366635
has text: Is multiplying by *0.5 in the triangle area necessary? I see that we need just sign, not value: local area = ((x1-x0) * (y2-y0) - (x2-x0) * (y1-y0))
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77909693

http://stackoverflow.com/comment/138051217
comment on: http://stackoverflow.com/a/78294674
type: Comment
has text: Bro thanks but its like been a while for this question. But Thanks.
score: 0
type: AnswerComment

random
type: Tag
tags question: http://stackoverflow.com/q/77838212
tag name: random
tags question: http://stackoverflow.com/q/78143839
tags question: http://stackoverflow.com/q/78275372
tags question: http://stackoverflow.com/q/79350389

http://stackoverflow.com/comment/137507370
type: Comment
has text: 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?**
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77990070

http://stackoverflow.com/q/77880937
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77881066
answer count: 1
type: Question
tagged with: roblox
accepted answer: http://stackoverflow.com/a/77881066
has title: :GetChildren() not working for an unknown reason
has comment: http://stackoverflow.com/comment/137299109
has body: so, i'm trying to make a baldi's basics type game (here's my code for the hearing script) local baldi = script.Parent local neededConfig = require(game.ReplicatedStorage.modules.configs.tags) local targ = baldi.Target local crime = targ.Crime local minDistance = 200 function getHRP(c:Model) local t = c:GetChildren() for _, part in pairs(t) do if part:IsA("BasePart") then if part.Name == "HumanoidRootPart" then return part end end end return nil end function speedup(boostTime, briefSpeedup) baldi.Speed.Value += briefSpeedup task.delay(boostTime, function() baldi.Speed.Value -= briefSpeedup end) end function listen() local nearest = minDistance crime.Value = "baldi" for _, p in pairs(game.Players:GetPlayers()) do local c = game.Players:FindFirstChild(p.Name, true).Character if getHRP(c) ~= nil then local hrp = getHRP(c) local dist = (hrp.Position - baldi.HumanoidRootPart.Position).magnitude if dist <= nearest and c:HasTag(neededConfig.tags.sound) then nearest = dist targ.Value = p if baldi.Wandering.Value ~= 0 then speedup(15, 1.25) baldi.Wandering.Value = 0 task.delay(30, function() baldi.Wandering.Value = 1 end) end end end end end spawn(function() repeat task.wait() listen() until baldi == nil end) on line 8 when i call GetChildren, it errors saying attempted to index nil with GetChildren and i cant figure out why i havent seen any solutions yet, so i'm just kind of confused as to why my code is failing
tagged with: lua

match
tag name: match
tags question: http://stackoverflow.com/q/77959155
type: Tag
tags question: http://stackoverflow.com/q/78638506

http://stackoverflow.com/comment/137426987
comment on: http://stackoverflow.com/q/77951212
type: Comment
has text: 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
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137325004
has text: Oops, had a small mistake that I needed to fix
type: Comment
comment on: http://stackoverflow.com/a/77892721
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137211116
type: AnswerComment
has text: Thank you! Thats it! Clearly I didn't read or understand the nvim-tree docs well enough. Why 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?)
comment on: http://stackoverflow.com/a/77830864
score: 2
type: Comment

http://stackoverflow.com/a/77926541
score: 0
type: Answer
answers question: http://stackoverflow.com/q/77888368
has body: I took the liberty of rewriting your code. The despawn problem is fixed and to see the loot of your object you need to update your gameobject like this : UPDATE `gameobject_template` SET `Data1` = 0 WHERE (`entry` = 8000015); For your lua script I allowed myself a few optimizations and reworking : local Constant = { GameObjectEntry = 8000015, SecondsInDelay = 86400, } local function print_format(msg, values) print(string.format(msg, table.unpack(values))) end local function AddItemToObject(object, item) if ( item ) then local item_entry = item:GetEntry() local item_count = item:GetCount() object:AddLoot(item_entry, item_count) print_format("Log:: Gameobject GUID %s now contains item %s in %s exemplars.", {object:GetGUIDLow(), item_entry, item_count}) end end local function OnPlayerDied(player) local player_level = player:GetLevel() if ( player_level < 15 ) then return end local object = player:SummonGameObject(Constant.GameObjectEntry, player:GetLocation()) if ( object ) then local object_guid = object:GetGUIDLow() print_format("Log:: Gameobject GUID %s as spawn", {object_guid}) for slot = 0, 22 do if ( slot <= 18 ) then AddItemToObject(object, player:GetItemByPos(255, slot)) end if ( slot >= 19 ) then for bag_slot = 0, 35 do AddItemToObject(object, player:GetItemByPos(slot, bag_slot)) end end end object:RegisterEvent( function(_, _, _, game_object) game_object:Despawn() print_format("Log:: Gameobject GUID %s as despawn", {object_guid}) end, Constant.SecondsInDelay * 1000, 1 ) end end Best regards, iThorgrim
has comment: http://stackoverflow.com/comment/137390539

http://stackoverflow.com/comment/137413762
comment on: http://stackoverflow.com/q/77944117
type: QuestionComment
has text: 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?
type: Comment
score: 0

fractals
tag name: fractals
type: Tag
tags question: http://stackoverflow.com/q/77950812

build
type: Tag
tags question: http://stackoverflow.com/q/77922338
tag name: build

macos
tags question: http://stackoverflow.com/q/77872527
type: Tag
tags question: http://stackoverflow.com/q/77802584
tag name: macos
tags question: http://stackoverflow.com/q/78628036
tags question: http://stackoverflow.com/q/78987682
tags question: http://stackoverflow.com/q/78985787
tags question: http://stackoverflow.com/q/79118768

dry
tags question: http://stackoverflow.com/q/77789995
tag name: dry
type: Tag

http://stackoverflow.com/comment/137396094
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77930478
has text: Probably there is no Lua stack because you have already exited `lua_pcall`.

contains
type: Tag
tags question: http://stackoverflow.com/q/77904973
tag name: contains

http://stackoverflow.com/comment/137420634
has text: End is fine as it will be sorted after script is ran
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77944117
type: Comment

registry
tags question: http://stackoverflow.com/q/77935205
type: Tag
tag name: registry

resources
tags question: http://stackoverflow.com/q/77800090
type: Tag
tag name: resources

http://stackoverflow.com/a/77878004
has body: The PiL book you read is the first edition which was written for Lua 5.0. In the newer edition (since 2nd) the term "C Packages" has been changed to "C Modules". So the answer is already very clear. In addition, the book also provides the definition of package: Starting in version 5.1, Lua has defined a set of policies for modules and packages (a package being a collection of modules).
has comment: http://stackoverflow.com/comment/137297521
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/137307862
answers question: http://stackoverflow.com/q/77872527

class
tags question: http://stackoverflow.com/q/77941484
type: Tag
tag name: class

mutt
type: Tag
tag name: mutt
tags question: http://stackoverflow.com/q/77854806

trigonometry
tags question: http://stackoverflow.com/q/77945374
tag name: trigonometry
type: Tag
tags question: http://stackoverflow.com/q/78300144
tags question: http://stackoverflow.com/q/78214820
tags question: http://stackoverflow.com/q/78262990
tags question: http://stackoverflow.com/q/79137049

http://stackoverflow.com/comment/137507373
has text: `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.
comment on: http://stackoverflow.com/q/77997811
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78061868
score: 0
has comment: http://stackoverflow.com/comment/137617521
answers question: http://stackoverflow.com/q/78059961
type: AcceptedAnswer
type: Answer
has body: 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 like classes through clever use of metatables. So let's talk for a moment about how the __index metamethod works. When you ask a table for a key that doesn't exist, it will return nil. But, if you set the __index property to another table, the lookup will fall-through to that table. local a = { foo = "hello" } local b = { bar = "world" } -- ask b for "foo" which isn't defined on 'b' print(b.foo, b.bar) -- returns nil, "world" -- set the lookup table to 'a' setmetatable(b, { __index = a }) -- ask again for b, which still isn't defined on 'b' print(b.foo, b.bar) -- returns "hello", "world" In this example, b did not become a clone of a with all of its properties, it is still a table with only bar defined. If you were to ask for foo, since it does not find it in b it then checks a to see if it can find it there. So b is not a, but it can act like it. Let's look at what your code is doing : -- create a table with some fields already defined local Cell = { index = nil, coordinates = Vector2.zero, wasVisited = false } -- create a "new" function that will pass the in original Cell object as the `self` variable function Cell:new(index: number, coordinates: Vector2) -- create an empty table that will reference the original Cell table -- note - the first time this is called, the __index metamethod hasn't been set yet local instance = setmetatable({}, self) -- set Cell's __index metamethod to itself self.__index = self -- overwrite the original Cell's index to the passed in index self.index = index -- overwrite the original Cell's coordinates to the passed in coordinates self.coordinates = coordinates -- return an empty table that will reference all of these new values return instance end As you can see, your code is struggling to define copies of Cells because your constructor is constantly overwriting the values in the origina…
accepted answer of: http://stackoverflow.com/q/78059961

http://stackoverflow.com/comment/137664632
score: 0
type: QuestionComment
has text: @harold hold on, let me show you bitshift operations done with `auth("1234123412341234","12345678123456781234567812345678")`
type: Comment
comment on: http://stackoverflow.com/q/78087883

http://stackoverflow.com/q/78102682
upvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/137692170
favorite count: 0
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/137718103
has comment: http://stackoverflow.com/comment/137692074
tagged with: lua
accepted answer: http://stackoverflow.com/a/78128910
answer count: 1
has comment: http://stackoverflow.com/comment/137737474
has comment: http://stackoverflow.com/comment/137692765
type: AnsweredQuestion
has body: Consider the following code: function fun() local o1 = foo:new() -- object with __gc metamethod local o2 = bar:new() -- object with __gc metamethod end Will Lua call the o2 finalizer before o1's because o2 was created later than o1 or is the order finalizers are called undefined?
has answer: http://stackoverflow.com/a/78128910
has title: Are finalizers called in the reverse order of making?

http://stackoverflow.com/comment/137512477
comment on: http://stackoverflow.com/a/77998270
type: Comment
type: AnswerComment
has text: `127.0.0.1:7000> FCALL logMsg 1 a -> Redirected to slot [15495] located at 127.0.0.1:7002 (nil) ` I 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?
score: 0

http://stackoverflow.com/comment/137664420
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78087883
type: QuestionComment
has text: I think it does yea, let me monitor what numbers are passed to bitwise functions and will report it here

http://stackoverflow.com/a/78695122
score: 0
answers question: http://stackoverflow.com/q/77991625
type: Answer
has body: My scrolloff setting wasn't working even on startup. I tried puting the vim.opt.scrolloff = 8 line after all my remaps (it was previously already after the Lazy plugins were imported), and it seems to be working fine now.

http://stackoverflow.com/comment/137735342
score: 1
type: QuestionComment
has text: This code looks good, but it does not match the output you present. Please show the actual code.
type: Comment
comment on: http://stackoverflow.com/q/78126689

http://stackoverflow.com/q/78087883
has comment: http://stackoverflow.com/comment/137664611
has comment: http://stackoverflow.com/comment/137666016
has comment: http://stackoverflow.com/comment/137665169
tagged with: bitwise-operators
has comment: http://stackoverflow.com/comment/137665122
has comment: http://stackoverflow.com/comment/137665746
tagged with: c++
has comment: http://stackoverflow.com/comment/137664557
has comment: http://stackoverflow.com/comment/137665669
has comment: http://stackoverflow.com/comment/137664439
has comment: http://stackoverflow.com/comment/137664455
has comment: http://stackoverflow.com/comment/137664488
score: 1
has comment: http://stackoverflow.com/comment/137664854
has comment: http://stackoverflow.com/comment/137665522
tagged with: cryptography
has comment: http://stackoverflow.com/comment/137664449
has comment: http://stackoverflow.com/comment/137664468
has comment: http://stackoverflow.com/comment/137664639
has comment: http://stackoverflow.com/comment/137665057
has comment: http://stackoverflow.com/comment/137665740
has comment: http://stackoverflow.com/comment/137665918
has title: Lua 5.1 bitwise operations using arithmetic for 64bit numbers
has body: 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. 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. You can find my backport of poly1305 https://pastebin.com/mfNhDqvw 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? local MOD = 2 ^ 32 local MODM = MOD - 1 local function memoize(f) local mt = { } local t = setmetatable( { }, mt) function mt:__index(k) local v = f(k) t[k] = v return v end return t end local function make_bitop_uncached(t, m) local function bitop(a, b) local res, p = 0, 1 while a ~= 0 and b ~= 0 do local am, bm = a % m, b % m res = res + t[am][bm] * p a =(a - am) / m b =(b - bm) / m p = p * m end res = res +(a + b) * p return res end return bitop end local function make_bitop(t) local op1 = make_bitop_uncached(t, 2 ^ 1) local op2 = memoize( function(a) return memoize( function(b) return op1(a, b) end) end) return make_bitop_uncached(op2, 2 ^(t.n or 1)) end local bxor1 = make_bitop( { [0] = { [0] = 0, [1] = 1 }, [1] = { [0] = 1, [1] = 0 }, n = 4 }) local function bxor(a, b, c, ...) local z = nil if b then a = a % MOD b = b % MOD z = bxor1(a, b) if c then z = bxor(z, c, ...) end return z elseif a then return a % MOD else return 0 end end local function band(a, b, c, ...) local z if b then a = a % MOD b = b % MOD z =((a + b) - bxor1(a, b)) / 2 if c then z = bit32_band(z, c, ...) end return z elseif a then return a % MOD else return MODM end end local function bnot(x) return(-1 - x) % MOD end local funct…
type: UnansweredQuestion
tagged with: bit-manipulation
has comment: http://stackoverflow.com/comment/137666019
has comment: http://stackoverflow.com/comment/137664873
has comment: http://stackoverflow.com/comment/137664445
favorite count: 0
has comment: http://stackoverflow.com/comment/137665882
has comment: http://stackoverflow.com/comment/137664482
has comment: http://stackoverflow.com/comment/137664632
has comment: http://stackoverflow.com/comment/137664420
has comment: http://stackoverflow.com/comment/137664529
has comment: http://stackoverflow.com/comment/137668112
has comment: http://stackoverflow.com/comment/137665904
has comment: http://stackoverflow.com/comment/137719295
answer count: 0
upvote count: 2
tagged with: lua
has comment: http://stackoverflow.com/comment/137665664
has comment: http://stackoverflow.com/comment/137664368
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/137668228

http://stackoverflow.com/comment/137678609
type: Comment
score: 0
has text: Is it really necessary to make `love` a global variable rather than local?
type: QuestionComment
comment on: http://stackoverflow.com/q/78095099

http://stackoverflow.com/a/78128910
accepted answer of: http://stackoverflow.com/q/78102682
has body: It is guaranteed that o2 will be finalized before o1 Objects will be finalized in the reverse order that they were "marked". An object is "marked" for finalization when the metatable is set with a __gc metamethod. Reference: https://www.lua.org/manual/5.4/manual.html#2.5.3 At the end of each garbage-collection cycle, the finalizers are called in the reverse order that the objects were marked for finalization, 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. For an object (table or userdata) to be finalized when collected, you must mark it for finalization. You mark an object for finalization when you set its metatable and the metatable has a __gc metamethod. 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. In this example o1 will be finalized before o2: function fun() local o1 = foo:new() -- object without __gc metamethod local o2 = bar:new() -- object without __gc metamethod setmetatable(o2, metaWithGC) setmetatable(o1, metaWithGC) end
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/78102682
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/78035469
answer count: 1
type: UnansweredQuestion
score: 0
tagged with: lua
type: Question
has title: Lua key event with variables (unified remote)
has answer: http://stackoverflow.com/a/78042017
has body: i need some help with unified remote (lua) scriptfile for a keyboard / mouse action. need this events: "F5" toggles (enable / disable) an elevator down right mouse button while key.down "e" start the elevator. action on a button: press: lift goes up >>OK!works! press: lift stops >>OK!Works! press: lift jumps back too ground. >>OK!Works! but: it seems, there is an open Mouse.up event, so i had to do a 4. press only for final mouse.up... my code: --@help Command 7 actions.command7 = function () use = not use; if (use) then kb.down("f5"); ms.down(UseButton); kb.down("e"); else kb.stroke("f5"); ms.up(UseButton); end end any help would be fine. would like to have a code only in three steps with an ended mouse up ...LUA is not mine...

http://stackoverflow.com/q/78053349
tagged with: plugins
has body: 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 —-. I see that other plugin have sectionsForBottom with files and buttons, but I can’t find the problem. No errors Been looking in code of other plugins, but my setup seems correct Pluginprovider function pluginInfoProvider.sectionsForBottomOfDialog(f, propertyTable ) return { { title = "Configuration", bind_to_object = propertyTable, f:view { fill_horizontal = 1, spacing = f:control_spacing(), font = "<system>", ConfigDialogs.DefaultDirectories(f, propertyTable), ConfigDialogs.CameraFilm(f, propertyTable), } }, } end The code function ConfigDialogs.CameraFilm(f, propertyTable) return f:group_box { title = 'Adding Camera and Film', fill_horizontal = 1, --------- Camera -------- f:row { f:static_text { title = "Camera Name:", alignment = "left", width_in_chars = "11", }, f:edit_field { alignment = "left", width_in_chars = 20, immediate = true, value = bind "CameraName", },…. Everything from f:row seems to fail My sectionsForTopOfDialog are working (if the other is disabled) function pluginInfoProvider.sectionsForTopOfDialog( f, propertyTable ) return { { title = "Analoge Fotografie", f:view { fill_horizontal = 1, spacing = f:control_spacing(), font = "<system>", ConfigDialogs.Information(f, propertyTable) } }, } end The code function ConfigDialogs.Information(f, propertyTable) return f:row { spacing = f:control_spacing(), f:static_text { title = "bla bla bla", }, } end
tagged with: lightroom
tagged with: lua
has answer: http://stackoverflow.com/a/78062329
has answer: http://stackoverflow.com/a/78057142
type: AnsweredQuestion
tagged with: sdk
possible better answer: http://stackoverflow.com/a/78062329
score: 0
accepted answer: http://stackoverflow.com/a/78057142
answer count: 2
type: Question
has title: Lightroom plugin does not show sectionsForBottomOfDialog on Windows

http://stackoverflow.com/a/78092591
has comment: http://stackoverflow.com/comment/137673695
answers question: http://stackoverflow.com/q/78063469
has comment: http://stackoverflow.com/comment/137673467
score: 0
has comment: http://stackoverflow.com/comment/137691243
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/137673706
has comment: http://stackoverflow.com/comment/137673815
accepted answer of: http://stackoverflow.com/q/78063469
has body: There are two small problems that prevent this filter from working. I'm listing them below and include explanations and solutions for each. The main issue is return {{Inline = RawInline}}. This causes the RawInline function to be called for all Inline elements, such as Str, Emph, Space, etc. This is causing issues, because some elements don't have a .text attribute, and calling starts_with with nil as the second argument triggers an error. The solution for this is to either use return {{RawInline = RawInline}}, 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. The RawInline function does nothing, because return el and return nil 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 {}. To summarize, this should work: local function starts_with(start, str) return str:sub(1, #start) == start end function RawInline(el) if not starts_with('&lt;!--', el.text) then return {} end end To make ensure that no HTML at all is included in the output, we can use gfm-raw_html as the output format, i.e., we disable the raw_html 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. local function starts_with(start, str) return str:sub(1, #start) == start end function RawInline (el) return starts_with('&lt;!--', el.text) and pandoc.RawInline('markdown', el.text) -- pretend it's md or {} -- not an HTML comment, thus drop it end

http://stackoverflow.com/comment/137718103
type: QuestionComment
has text: @Andreas you should rewrite your example to demonstrate that, something like `local o1 = foo:new() -- object with __gc metamethod`
type: Comment
comment on: http://stackoverflow.com/q/78102682
score: 0

http://stackoverflow.com/q/77997811
has comment: http://stackoverflow.com/comment/137519678
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137515746
has title: Lua not allowing global variables in a table
has comment: http://stackoverflow.com/comment/137510333
tagged with: lua
accepted answer: http://stackoverflow.com/a/78010777
type: Question
has comment: http://stackoverflow.com/comment/137526031
has comment: http://stackoverflow.com/comment/137510317
has answer: http://stackoverflow.com/a/78010777
has body: I have some code in Lua: math.randomseed(os.time()) amount = 0 --math.random(0, 54000) bgItem = mediaPool:AppendToTimeline({ { mediaPoolItem = clip[1], trackIndex = 1, recordFrame = 216000, startFrame = amount, endFrame = amount+total, mediaType = 1 } })[1] Having amount as 0 works perfectly fine, but when I set it to math.random(0, 54000) it gives an error: attempt to perform arithmetic on field 'amount' (a nil value). 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.
has comment: http://stackoverflow.com/comment/137543303
answer count: 1
tagged with: davinci-resolve
has comment: http://stackoverflow.com/comment/137507373
score: 0

http://stackoverflow.com/a/78139533
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/137757156
score: 1
has body: Those locals are still referenced by the global functions. [...] inaccessible from Lua means that neither a variable nor another live object refer to the object. And that reference is, if I understood correctly, a upvalue: 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.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78139158
downvote count: 0
answers question: http://stackoverflow.com/q/78139158

http://stackoverflow.com/comment/137665122
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78087883
has text: @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

http://stackoverflow.com/comment/137665169
comment on: http://stackoverflow.com/q/78087883
has text: 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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78128669
answers question: http://stackoverflow.com/q/78075230
has body: Finally, after trying other things, I added redis.setresp(3) inside the lua function and it is working now.
accepted answer of: http://stackoverflow.com/q/78075230
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/78109755
score: 5
accepted answer of: http://stackoverflow.com/q/78109630
type: AcceptedAnswer
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/78109630
downvote count: 0
has body: To use unpack with sparse arrays, you need to pass two more parameters to it: local one, two, three = unpack ({ [3] = 'Three' }, 1, 3 }) The second parametre is the first element to uppack, 1 by default; the third is the last item to unpack, #{ [3] = 'Three' } by default, which is zero for tables with absent first (…[1]) item, so you have to know it. See Lua 5.1 Reference Manual unpack (list [, i [, j]]) Returns the elements from the given table. This function is equivalent to return list[i], list[i+1], ···, list[j] except that the above code can be written only for a fixed number of elements. By default, i is 1 and j is the length of the list, as defined by the length operator (see §2.5.5).

http://stackoverflow.com/comment/137751062
comment on: http://stackoverflow.com/q/78126689
has text: I tried your first code, and it worked.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/78134354
tagged with: roblox
tagged with: roblox-studio
has body: I cannot get to save data in a roblox game. local players = game:GetService("Players") local dss = game:GetService("DataStoreService") local gameData = dss:GetDataStore("Nara") players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local coins = Instance.new("IntValue") coins.Name = "Coins" coins.Parent = leaderstats local success, result = pcall(function() local r = gameData:GetAsync(player.UserId)["Coins"] return r end) if success then print("success: " .. result) coins.Value = result else print(result) end end) players.PlayerRemoving:Connect(function(player) print("player removed") local key = player.UserId local data = { ["Coins"] = player:WaitForChild("leaderstats").Coins.Value } local success, err = pcall(function() gameData:SetAsync(key, data) end) if success then print("Data saved successfully") else print("Failed to save data with error: ", err) end end) game.ReplicatedStorage.Buy.OnServerInvoke = function(player, item) if not player:FindFirstChild(item) then if player.leaderstats.Coins.Value >= game.ReplicatedStorage.Items:WaitForChild(item).cost.Value then player.leaderstats.Coins.Value = player.leaderstats.Coins.Value - game.ReplicatedStorage.Items:WaitForChild(item).cost.Value local owned = Instance.new("BoolValue") owned.Name = item owned.Parent = player player.Backpack:ClearAllChildren() game.ReplicatedStorage.Items:WaitForChild(item):Clone().Parent = player.Backpack return item else return "not enough coins" end else player.Backpack:ClearAllChildren() game.ReplicatedStorage.Items:WaitForChild(item):Clone().Parent = player.Backpack return "owned " .. item end end i tried more ways i dont know whats wrong. 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 print. Thanks
answer count: 1
has title: I don't seem to get DataStoreService working on Roblox
score: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/78281303
tagged with: lua
type: Question
has answer: http://stackoverflow.com/a/78281303

http://stackoverflow.com/comment/137692074
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/78102682
score: 1
type: Comment

http://stackoverflow.com/q/78077926
has comment: http://stackoverflow.com/comment/137677818
answer count: 0
has body: PROBLEM: Hi The output says: Players.username.PlayerGui.GameGui.GameController:63: attempt to index nil with 'Stats' This is my code: local maxTowers = towerToSpawn.Stats.MaxPlaced.Value local PlacedTowers = towerToSpawn.Stats.Placed.Value What the problem ? CONTEXT: I make a tower defense and I want to restrict the number of each type of tower that can be placed. ps : local towerToSpawn = ReplicatedStorage:WaitForChild("Towers"):FindFirstChild(name):Clone() enter image description here
tagged with: lua
tagged with: roblox
has comment: http://stackoverflow.com/comment/137654539
has title: "Attempt to index nil with 'stat'" How to fix that ? (Roblox)
has comment: http://stackoverflow.com/comment/137653999
has comment: http://stackoverflow.com/comment/137654595
type: UnansweredQuestion
tagged with: comments
has comment: http://stackoverflow.com/comment/137651096
tagged with: nul
score: 0
type: Question

http://stackoverflow.com/q/78059961
tagged with: luau
tagged with: lua
type: Question
possible better answer: http://stackoverflow.com/a/78061517
has answer: http://stackoverflow.com/a/78061868
answer count: 2
has body: 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: local Cell = { index = nil, coordinates = Vector2.zero, wasVisited = false, markAsVisited = function (self) self.wasVisited = true end, new = function(self, index: number, coordinates: Vector2) local cell = table.clone(self) cell.index = index cell.coordinates = coordinates return cell end, } return Cell to local Cell = { index = nil, coordinates = Vector2.zero, wasVisited = false } function Cell:new(index: number, coordinates: Vector2) local instance = setmetatable({}, self) self.__index = self self.index = index self.coordinates = coordinates return instance end function Cell:markAsVisited() self.wasVisited = true end return Cell and instead of I get can someone explain to me why?
has title: Request for explanation about objects/classes
score: 0
accepted answer: http://stackoverflow.com/a/78061868
has answer: http://stackoverflow.com/a/78061517
type: AnsweredQuestion
tagged with: roblox

http://stackoverflow.com/comment/137742972
type: QuestionComment
comment on: http://stackoverflow.com/q/78129002
type: Comment
has text: 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. I haven't repeated the standard vector maths formulas because those are just that - standard!
score: 0

http://stackoverflow.com/a/78235056
score: 1
has body: My NVIM-CONFIG I woudl not recommend any of the ones you listed, I primarly code in Java/Spring-Boot. My recommendation: Formatting: google_java_format Linting: checkstyle config = function() local null_ls = require("null-ls") null_ls.setup({ sources = { -- JAVA null_ls.builtins.formatting.google_java_format, null_ls.builtins.diagnostics.checkstyle.with({ extra_args = { "-c", "/google_checks.xml" }, }), -- -------------------------------------------- -- rest of config... }, }) vim.keymap.set("n", "<leader>cf", vim.lsp.buf.format, {}) end, } My Configurations are linked above. In case you want to see my overall setup for other languages like Js, Ts, Py, Bash.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/77973700
upvote count: 1
answers question: http://stackoverflow.com/q/77973700
downvote count: 0

http://stackoverflow.com/a/77977772
type: Answer
has comment: http://stackoverflow.com/comment/137473087
score: 0
has comment: http://stackoverflow.com/comment/137470888
answers question: http://stackoverflow.com/q/77977460
has body: Even in Lua, it is necessary to check that the returned object is not nil, before calling its methods. Your db:prepare returned nil. Is suppose it's because you had not supplied id, which is a primary key not accepting null.

http://stackoverflow.com/a/78106691
has comment: http://stackoverflow.com/comment/137736710
score: 3
answers question: http://stackoverflow.com/q/78075230
downvote count: 0
type: Answer
upvote count: 3
has body: The issue is that currentValue is set to nil in the call to tonumber(keyGet). From the lua manual for tonumber: 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. So, even though keyGet is not nil, whatever it is, it is still not convertible into a number. Add a line to log the value of keyGet after local keyGet = redis.call(...) redis.log(redis.LOG_NOTICE, keyGet) Hopefully, that will tell you why the value of keyGet isn't working with tonumber.

http://stackoverflow.com/comment/137665904
has text: @harold indeed, I made an EDIT 4 regarding that statement
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78087883
type: Comment

http://stackoverflow.com/a/78085358
score: -1
downvote count: 1
has body: The code language that the Visual Studio supported is limited. Take a look of this: Demos Visual Studio only support these languages: Lua is not listed. And you can also know this when you install visual studio components via visual studio installer. Please consider using visual studio code.
type: Answer
answers question: http://stackoverflow.com/q/78076526
upvote count: 0

http://stackoverflow.com/q/78111131
favorite count: 0
type: AnsweredQuestion
tagged with: callback
tagged with: javascript
type: Question
has answer: http://stackoverflow.com/a/78651655
upvote count: 1
has title: Why FiveM script client callback does not receive the right variable type?
tagged with: lua
accepted answer: http://stackoverflow.com/a/78651655
downvote count: 0
tagged with: types
score: 1
tagged with: fivem
answer count: 1
has body: 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 "object". For minimal reproduction, Here is the JS script that call my client callback on a button click (Working): html/script.js const createOrg = () =>{ var orgName = document.getElementById("neworg-name-input").value; fetch(`https://${GetParentResourceName()}/orgcreateCb`, { method: 'POST', headers: { 'Content-Type': 'application/json; charset=UTF-8', }, body: JSON.stringify({ organizationName: orgName, }) }).then(resp => resp.json()).then(resp => console.log(resp)); //console.log(orgName); }; Here is the server event that return the string (Working): server/main.lua RegisterServerEvent('getPlayerCitizenId') AddEventHandler('getPlayerCitizenId', function(cb) local currentCitizenId = QBCore.Functions.GetPlayer(source).PlayerData.citizenid cb(tostring(currentCitizenId)) end) Here is the client callback that need what the server event returns (Not working): client/main.lua RegisterNUICallback("orgcreateCb", function(data, cb) TriggerServerEvent('getPlayerCitizenId', function(citizenId) print('Citizen ID:', citizenId) end) end) On the print I get -> "SCRIPT ERROR: error object is not a string"

http://stackoverflow.com/comment/137673695
type: AnswerComment
has text: @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.
type: Comment
comment on: http://stackoverflow.com/a/78092591
score: 0

http://stackoverflow.com/q/78039187
has body: 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. So far I have tried the following: Adding the following to init.lua and/or config.lua (or elsewhere in a file linked to in config.lua): lvim.lsp.automatic_servers_installation = false lvim.lsp.automatic_configuration.skipped_servers = {"haskell-language-server"} lvim.lsp.LvimCacheReset() Enabling and disabling Mason in plugins.lua (linked to in config.lua) { "williamboman/mason.nvim", require("mason").setup() }, { { "williamboman/mason-lspconfig.nvim" }, Whatever I do, Mason jumps in and installs the hls. How to stop it?
type: UnansweredQuestion
tagged with: haskell
has answer: http://stackoverflow.com/a/78600853
tagged with: haskell-language-server
answer count: 1
has title: How to stop LunarVim Mason from automatically installing a language server?
score: 0
type: Question
tagged with: mason
tagged with: lunarvim
tagged with: lua

http://stackoverflow.com/q/78062261
tagged with: lua
has answer: http://stackoverflow.com/a/78108609
answer count: 1
type: UnansweredQuestion
has body: 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. If the connection is successful I store data about that connection to make it possible to automatically reconnect at a later device startup. 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 wpa_supplicant. Currently let's say my solution is pretty lousy, it works but it certainly can't be called a good job. I will try to summarize it quickly: Every 10 seconds I update the list of available networks with the command iwlist wlan0 scan then I update the list of available wifi and their characteristics. In 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. To 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. the portion of code that manage this part is the following: if(counter_500ms % 10 == 0 )then local file = io.open("/tmp/connesso","r") if(not(file)) then Connesso_A_Internet = false else local lettura = tonumber(file:read("*a")) file:close() if(lettura == 1)then print("connesso") Connesso_A_Internet = true Tempo_Last_Check_Connection = gre.mstime() / 1000 else if(Connesso_A_Internet and math.abs(Tempo_Last_Check_Connection - gre.mstime() / 1000) >= 20)then Connesso_A_Internet = false First_Connection_Wifi(mapargs) elseif(Connesso_A_Internet and math.abs(Tempo_Last_Check_Connection - gre.mstime() / 1000) < 10)then Connesso_A_Internet = true else Connesso_A_Internet = false if( math.abs(Tempo_Last_Check_Connection - gre.mstime() / 1000) >= 20)then First_Conne…
tagged with: wpa-supplicant
has title: Connect via wpa_supplicant from Lua Application and .sh scripts
tagged with: linux
score: 0
type: Question
tagged with: buildroot

http://stackoverflow.com/q/78118370
tagged with: roblox
downvote count: 0
tagged with: lua
type: UnansweredQuestion
has body: I am a small roblox developper and I ran into a problem. Right 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) Result of the code 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 But I have no idea how to modify my script so that everyone has the same questions at the same time. I tried to learn the RemoteEvent strategy but it never worked after 5 hours of trying again and again Here is the code of the Quiz right now local trivialevel1 = { { --Math question = "What is the mathematical constant π (pi) approximately equal to?", answers = {"2.718","3.142","1.618","0.577"}, correctanswer = 2, category = "Math" }, { question = "What is the result of multiplying any number by zero?", answers = {"1","The number itself","Zero","Infinity"}, correctanswer = 3, category = "Math" }, { question = "What is the term for a polygon with five sides?", answers = {"Hexagon","Octagon","Pentagon","Heptagon"}, correctanswer = 3, category = "Math" }, { question = "What is the value of the square root of 144?", answers = {"144","16","9","12"}, correctanswer = 4, category = "Math" }, { question = "What is the sum of all angles in a triangle?", answers = {"270","180","360","90"}, correctanswer = 2, category = "Math" }, { question = "If a number is divisible by 2 and 3, what other number is it also divisible by?", answers = {"4","8","6","5"}, correctanswer = 3, category = "Math" }, { --Sports question = "Which country won the most recent FIFA World Cup in 2022?", answers = {"Brazil","Germany","France","Argentina"}, correctanswer = 4, category = "Sports" }, { question = "Which sport is associated with the term 'slam dunk'?", answers = {"Soccer","Tennis","Baseball","Basketball"}, correctanswer = 4, category = "Sports" }, { question = "In baseball, how many strikes constitute a strikeout for a batter?", answe…
score: 1
tagged with: roblox-studio
has answer: http://stackoverflow.com/a/78366554
upvote count: 1
answer count: 1
has title: Can't modify my script for multiplayer quiz? Roblox Studio
favorite count: 0
type: Question

http://stackoverflow.com/q/78001723
has title: print call issue in Lua based function
tagged with: lua
accepted answer: http://stackoverflow.com/a/78002136
tagged with: redis
has comment: http://stackoverflow.com/comment/137516711
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137516777
answer count: 1
tagged with: redis-cluster
score: 0
has body: I have a Redis 7.x cluster with 3 master nodes running on ports 7000, 7001, 7002. Each master has 1 slave/replica. I am trying to load and run this Lua based function: #!lua name=printTestLib local function printTest(keys, args) local time = redis.call('TIME'); print("current timestamp in millis: " .. time) end redis.register_function('printTest', printTest) When I run it as 127.0.0.1:7000> fcall printTest 0 I see the error: (error) ERR user_function:4: Script attempted to access nonexistent global variable 'print' script: printTest, on @user_function:4. What is the issue with the call to print statement?
type: Question
has answer: http://stackoverflow.com/a/78002136

http://stackoverflow.com/comment/137664468
type: Comment
has text: @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
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78087883

http://stackoverflow.com/q/78129944
tagged with: luadoc
upvote count: 3
tagged with: neovim
tagged with: typing
downvote count: 0
has answer: http://stackoverflow.com/a/78131855
type: UnansweredQuestion
score: 3
answer count: 1
favorite count: 0
has title: In Lua, is there a way to document a function type including a description for its parameters?
type: Question
has body: I'm doing some maintenance in my NeoVim config, almost entirely written in Lua. For convenience, I created a mini-lib of useful tools to ease this configuration. I 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. Coming mainly from a TypeScript background, you can imagine that I like to go deep with it. In this example, I have a module that reduces the hassle of setting up mappings, also making it more readable. --- Set a keymap using Vim's API ---@param desc string The descritpion that will be shown for your mapping when calling :map ---@param mode MapModeStr The mode that your keymap will work in ---@param lhs string A NeoVim keymap string ---@param rhs MapRHS The action yout keymap will trigger ---@param opts? MapOptions A table of options local set = function(desc, mode, lhs, rhs, opts) opts = opts or {} local finalopts = vim.tbl_deep_extend("keep", { desc = desc }, opts) vim.keymap.set(mode, lhs, rhs, finalopts) end return { set = set, --- Set a keymap for Insert mode ---@param desc string The descritpion that will be shown for your mapping when calling :map ---@param lhs string A NeoVim keymap string ---@param rhs MapRHS The action yout keymap will trigger ---@param opts? MapOptions A table of options i = function(desc, lhs, rhs, opts) set(desc, "i", lhs, rhs, opts) end, --- Set a keymap for Normal mode ---@param desc string The descritpion that will be shown for your mapping when calling :map ---@param lhs string A NeoVim keymap string ---@param rhs MapRHS The action yout keymap will trigger ---@param opts? MapOptions A table of options n = function(desc, lhs, rhs, opts) set(desc, "n", lhs, rhs, opts) end, ---@param desc string The descritpion that will be shown for your mapping when calling :map ---@param lhs string A NeoVim keymap string ---@param rhs MapRHS The action yout keymap will trigger ---@param opts? MapOptions A table of o…
tagged with: lua

http://stackoverflow.com/q/78137732
downvote count: 0
has body: 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 README: require("kanagawa").setup({ commentStyle = { italic = false }, keywordStyle = { italic = false }, }) And this disables most italics in the theme, however keywords like self in Rust or this in Java/Javascript are still showing italicized. I've tried looking for answers in the repo and elsewhere, but haven't found a solution to this.
tagged with: neovim-plugin
answer count: 1
type: UnansweredQuestion
tagged with: neovim
favorite count: 0
has title: How can I fully disable italics with the Kanagawa theme in Neovim?
score: 3
has answer: http://stackoverflow.com/a/78137733
type: Question
upvote count: 3
tagged with: lua

http://stackoverflow.com/a/78140323
type: Answer
has body: Okay, I found this in "The implementation of Lua": --Once a closed upvalue is no longer referred by any closure, it is eventually garbage collected-- Click noice!
has comment: http://stackoverflow.com/comment/137771170
answers question: http://stackoverflow.com/q/78139158
score: 0

http://stackoverflow.com/comment/137756533
has text: 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)
type: QuestionComment
comment on: http://stackoverflow.com/q/78139158
score: 0
type: Comment

http://stackoverflow.com/comment/137630323
has text: Try `cmdRunExifTool = 'cmd /c "'..cmdRunExifTool..'"'` before executing it.
type: Comment
comment on: http://stackoverflow.com/q/78068802
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137510317
type: QuestionComment
comment on: http://stackoverflow.com/q/77997811
type: Comment
has text: Indeed, `local amount = math.random(0, 54000)` might fix the problem
score: 0

http://stackoverflow.com/a/78149168
score: 2
accepted answer of: http://stackoverflow.com/q/78136904
answers question: http://stackoverflow.com/q/78136904
type: AcceptedAnswer
type: Answer
upvote count: 2
downvote count: 0
has body: With Lazyvim buffers/tabs are displayed via bufferline.nvim plugin, see https://www.lazyvim.org/plugins/ui If you don't want to use it, you can disable it in lua/plugins/disabled.lua file (see https://www.lazyvim.org/configuration/plugins). Specifically, you should add: return { { "akinsho/bufferline.nvim", enabled = false, }, }

http://stackoverflow.com/q/78104676
has body: I'm trying to translate a specific vimscript code that moves visual blocks up and down using Ctrl + arrow keys to lua. Here’s the Vimscript code in my .vimrc: vnoremap ^[[1;5A :m '<-2<CR>gv=gv vnoremap ^[[1;5B :m '>+1<CR>gv=gv And here’s the Lua code in my init.lua: -- Global Variable local opts = { noremap = true, silent = true } -- Key Mappings vim.api.nvim_set_keymap('v', '<C-Up>', ':m \'<-2<CR>gv=gv', opts) vim.api.nvim_set_keymap('v', '<C-Down>', ':m \'>+1<CR>gv=gv', opts) However, the issue is that when I reach the top or bottom of the file, I get an E16: Invalid range error and the visual selection gets deselected. To handle this in Vim, I added a check in my .vimrc as follows: vnoremap <expr> ^[[1;5A (line("'<") == 1 ? "" : ":m '<-2<CR>gv=gv") vnoremap <expr> ^[[1;5B (line("'>") == line("$") ? "" : ":m '>+1<CR>gv=gv") Translating this to lua, I came up with the following: -- Global Variable local opts = { noremap = true, silent = true } -- Custom function to move visual block up function _G.move_visual_block_up() if vim.fn.line("'<") > 1 then vim.cmd(":m '<-2<CR>gv=gv") end end -- Custom function to move visual block down function _G.move_visual_block_down() if vim.fn.line("'>") < vim.fn.line("$") then vim.cmd(":m '>+1<CR>gv=gv") end end -- Key Mappings vim.api.nvim_set_keymap('v', '<C-Up>', '<Cmd>lua _G.move_visual_block_up()<CR>', opts) vim.api.nvim_set_keymap('v', '<C-Down>', '<Cmd>lua _G.move_visual_block_down()<CR>', opts) However, hitting ctrl + up has no effect; on the other hand, pressing ctrl + down results in an error… E5108: Error executing lua vim/_editor.lua:0: nvim_exec2(): Vim(move):E20: Mark not set stack traceback: [C]: in function 'nvim_exec2' vim/_editor.lua: in function 'cmd' /etc/nvim/init.lua:206: in function 'move_visual_block_down' [string ":lua"]:1: in main chunk 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. PS: While this question appears alike, it…
has title: Using Lua to Create Conditional Key Mappings in Neovim
tagged with: lua
has answer: http://stackoverflow.com/a/78130284
score: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/73270146
tagged with: neovim
upvote count: 1
answer count: 1
favorite count: 0
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/78130284

http://stackoverflow.com/comment/137611843
type: QuestionComment
comment on: http://stackoverflow.com/q/78049090
score: 0
type: Comment
has text: 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)`.

traffic-simulation
type: Tag
tag name: traffic-simulation
tags question: http://stackoverflow.com/q/78129002

http://stackoverflow.com/comment/137745874
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78126689
has text: hey @Ctx I tested another method, which gives me the actual values. I would appreciate it if you could give an explanation for this.

http://stackoverflow.com/a/77998270
has comment: http://stackoverflow.com/comment/137512986
accepted answer of: http://stackoverflow.com/q/77994508
answers question: http://stackoverflow.com/q/77994508
has body: I see the error: (error) ERR Function not found Because you call FUNCTION LOAD on one node (127.0.0.1:7000), while call FCALL 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. You need to call FUNCTION LOAD on every node in your Redis Cluster. I see the error -&gt; Redirected to slot [15495] located at 127.0.0.1:7002 (error) ERR Function not found 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.
upvote count: 2
has comment: http://stackoverflow.com/comment/137512477
score: 2
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/137670036
type: Comment
score: 0
has text: What's the zeroth character in that line?
type: QuestionComment
comment on: http://stackoverflow.com/q/78090720

http://stackoverflow.com/comment/138134346
type: Comment
has text: The error means that it couldn't find `Zone4Tp` in `workspace`. Make sure that there is a intance called `Zone4Tp` parented to Workspace.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78095935

http://stackoverflow.com/q/78143839
has title: Creating advanced loot systems based on a "luck" value
answer count: 1
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/137768826
has body: 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. Now this is where I am stalled, when the luck value increases by a "tier" 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. Any advice on how to implement this, Thanks! 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. 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. On the topic of "sides" 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.
type: Question
tagged with: random
tagged with: lua
has answer: http://stackoverflow.com/a/78154227
linked to: http://stackoverflow.com/q/1761626

http://stackoverflow.com/comment/137503564
type: AnswerComment
score: 0
has text: Thanks I made sure that it was and it did fix it, my script was setup for ReplicatedStorage by accident.
type: Comment
comment on: http://stackoverflow.com/a/77996276

http://stackoverflow.com/comment/137664854
score: 0
comment on: http://stackoverflow.com/q/78087883
has text: 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.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/78006322
tagged with: neovim
upvote count: 1
has title: Neovim, change background of all splits not just one
has answer: http://stackoverflow.com/a/78478262
type: Question
downvote count: 0
has body: I want to have a transparent background in my neovim. And so far I have found this: vim.api.nvim_set_hl(0, "Normal", {guibg=NONE, ctermbg=NONE})(I have this placed all the way at the bottom of my init.lua) (and I also have this purely vim way: hi Normal guibg=NONE ctermbg=NONE that also work) 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. This is how it looks normally as I want: (The darkening of the background is because of my Terminal settings) When I open neotree(or any other split): 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
tagged with: lua
type: UnansweredQuestion
score: 1
favorite count: 0
answer count: 2
has answer: http://stackoverflow.com/a/78627012

http://stackoverflow.com/a/77996276
answers question: http://stackoverflow.com/q/77994757
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/137503564
has body: In your LocalScript, you fire the event located in ReplicatedStorage : game.ReplicatedStorage.SG_FlightAnnouncementSystem.Events.startAnnouncement But in your Script in ServerScriptService, you register a listener to an event that is also in ServerScriptService : local announcementReciever = script.Parent.Parent.Events.startAnnouncement 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. local Events = game.ReplicatedStorage.SG_FlightAnnouncementSystem.Events local announcementReciever = Events.startAnnouncement local announcementSender = Events.startClientAnnouncement announcementReciever.OnServerEvent:Connect(function(plr, announcement) print("Server Received Announcement") script.Parent.Parent["Sound Effects"].announcementChime.Playing = true announcementSender:FireAllClients(announcement) end)

http://stackoverflow.com/comment/137665740
score: 0
comment on: http://stackoverflow.com/q/78087883
has text: @harold I have added one more edit
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/137668112
comment on: http://stackoverflow.com/q/78087883
type: Comment
has text: @harold so, I have no way to fix it ?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/137719295
has text: @harold porting your C++ link to lua worked, ty ;) But this thread is sadly not solved, maybe u wanna make an answer
comment on: http://stackoverflow.com/q/78087883
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/137516994
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78002123
has text: 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.

http://stackoverflow.com/a/78070873
score: 0
answers question: http://stackoverflow.com/q/78068802
has body: For WIN_ENV you have to surround the whole cmdline with double-quotes (&quot;) function cmdlineQuote() if WIN_ENV then return '&quot;' elseif MAC_ENV then return '' else return '' end end cmdRunExifTool = cmdlineQuote() .. string.format('cd &quot;'..NewTargetDir..'&quot; &amp;&amp; '.._PLUGIN.path..'\\bin\\win\\exiftool.exe '..(optionOverwrite or &quot;&quot;)..' optionAppend=&quot;.\\C+F-'..NewJson..'&quot; .') .. cmdlineQuote() LrTasks.execute(cmdRunExifTool)
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/137668731
has comment: http://stackoverflow.com/comment/137641679
accepted answer of: http://stackoverflow.com/q/78068802

http://stackoverflow.com/comment/137464749
has text: 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.
score: 2
type: Comment
comment on: http://stackoverflow.com/q/77974071
type: QuestionComment

http://stackoverflow.com/comment/137759469
has text: @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).
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78136254

http://stackoverflow.com/comment/137793998
type: QuestionComment
has text: @ESkri It disappears but it is the main line for reducing recoil for such games.
type: Comment
comment on: http://stackoverflow.com/q/78143358
score: 0

http://stackoverflow.com/q/78075230
has comment: http://stackoverflow.com/comment/137640817
tagged with: redis-cluster
favorite count: 0
possible better answer: http://stackoverflow.com/a/78106691
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/78106691
has answer: http://stackoverflow.com/a/78128669
type: Question
accepted answer: http://stackoverflow.com/a/78128669
downvote count: 0
has body: I've a Redis cluster v7.x with 3 masters each having a slave. I've defined a Lua function as following: local keyGet = redis.call('GET', timeSlotKey) local currentValue = 0 if keyGet ~= nil then currentValue = tonumber(keyGet) else currentValue = 0 end redis.log(redis.LOG_NOTICE, currentValue) if currentValue &lt; 5 then redis.call('INCR', timeSlotKey) redis.call('EXPIRE', timeSlotKey, expiryDuration) return 1 else return 0 end When I call the function from command line it throws an error: attempt to compare nil with number at line if currentValue &lt; 5 then What is the issue here? How to use the return value of GET call from the Redis?
tagged with: redis
tagged with: lua
score: 1
has title: Lua function in Redis - error attempt to compare nil with number
upvote count: 1

bitwise-operators
tag name: bitwise-operators
type: Tag
tags question: http://stackoverflow.com/q/78087883

http://stackoverflow.com/comment/137617221
type: AnswerComment
has text: Wow, so the tutorial I was following has a mistake: https://www.tutorialspoint.com/lua/lua_object_oriented.htm
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78061517

http://stackoverflow.com/comment/137651096
comment on: http://stackoverflow.com/q/78077926
has text: 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
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137526031
has text: @ESkri You are of course right - It is not 'above 0' it is 'except 0' - Thanks
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/77997811

http://stackoverflow.com/comment/137673815
type: Comment
has text: 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)?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78092591

http://stackoverflow.com/comment/137692765
comment on: http://stackoverflow.com/q/78102682
type: Comment
has text: @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.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137628185
type: AnswerComment
comment on: http://stackoverflow.com/a/78068183
score: 1
type: Comment
has text: The sorted set you need to access is your key.

http://stackoverflow.com/a/78113125
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78112697
has comment: http://stackoverflow.com/comment/137710915
has comment: http://stackoverflow.com/comment/137710666
score: 1
has comment: http://stackoverflow.com/comment/137710892
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78112697
has body: These \u{xxx} are UTF-8 encoded characters, you can just print them using lua to get its original value, e.g. print("\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}") You will get _IkIkklkIikillIillkilklIkiliIkili. Keep converting all these similar strings, e.g. the first function can be deobfuscated to: return function (self,type,message) _G["_IkIkklkIikillIillkilklIkiliIkili"]["IikiIkIliklilkkillikkklillIlIIIl"][505006082](self,type,message) end 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.

http://stackoverflow.com/q/78132049
has comment: http://stackoverflow.com/comment/137750248
score: 0
type: Question
tagged with: lua
accepted answer: http://stackoverflow.com/a/78136288
tagged with: wxlua
has body: I am using ZeroBrane Studio (2.01; MobDebug 0.805) on Windows 10. I need to insert a white square panel on top of the "panel". This panel should be a square. The panel should scale with the window size. I want to get this: MWE: package.cpath = package.cpath..";./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;" require("wx") frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua sizer test frame", wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE) panel = wx.wxPanel(frame, wx.wxID_ANY) button1 = wx.wxButton(frame, wx.wxID_ANY, "Button1") button2 = wx.wxButton(frame, wx.wxID_ANY, "Button2") topsizer = wx.wxBoxSizer(wx.wxVERTICAL) bottomsizer = wx.wxBoxSizer(wx.wxHORIZONTAL) topsizer:Add(panel, 1, wx.wxGROW + wx.wxALL, 6) topsizer:Add(bottomsizer, 0, wx.wxEXPAND + wx.wxALL, 0); bottomsizer:Add(button1, 1, wx.wxEXPAND + wx.wxALL, 6) bottomsizer:Add(button2, 1, wx.wxEXPAND + wx.wxALL, 6) function onButton1Click(event) wx.wxMessageBox("Button1 clicked!", "Information", wx.wxOK + wx.wxICON_INFORMATION) end button1:Connect(wx.wxEVT_COMMAND_BUTTON_CLICKED, onButton1Click) function onButton2Click(event) wx.wxMessageBox("Button2 clicked!", "Information", wx.wxOK + wx.wxICON_INFORMATION) end button2:Connect(wx.wxEVT_COMMAND_BUTTON_CLICKED, onButton2Click) frame:SetAutoLayout(true) frame:SetSizer(topsizer) wx.wxGetApp():SetTopWindow(frame) frame:Show(true) wx.wxGetApp():MainLoop() I tried using Sizer.
has comment: http://stackoverflow.com/comment/137747402
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78136288
tagged with: wxwidgets
has title: Lua (wxLua) how to create a nested "panel1" square in the center "panel"
answer count: 1

http://stackoverflow.com/q/78135524
score: 0
has body: 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. Some uses metatables, some consider it too much complex and create object using like functions that return table. And I am lost... It is not straightforward what I should use. I want to use real OOP, like for example Java or C# have. 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. What shall I choose though?
type: AnsweredQuestion
tagged with: oop
answer count: 1
type: Question
tagged with: 2d
tagged with: lua
accepted answer: http://stackoverflow.com/a/78136254
has comment: http://stackoverflow.com/comment/137750897
has title: Using metatables in Lua or functions for OOP
has answer: http://stackoverflow.com/a/78136254

http://stackoverflow.com/q/77977304
answer count: 0
tagged with: roblox
type: Question
tagged with: lua
has body: I'm making a timer for a game & it works perfectly fine, but I just want it to show the milliseconds. I tried to ask AI and it was horribly wrong. (Incorrect syntax, missing numbers...) This is what I have string.format("%02d:%02d:%02d", hours, minutes, seconds)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137471397
tagged with: roblox-studio
has title: Format Milliseconds aswell in Lua?
downvote count: 1
upvote count: 1
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/137479499

http://stackoverflow.com/comment/137653999
has text: I check that but the archivable index is set to true
type: QuestionComment
comment on: http://stackoverflow.com/q/78077926
score: 0
type: Comment

http://stackoverflow.com/q/78056160
type: AnsweredQuestion
tagged with: pandoc
has comment: http://stackoverflow.com/comment/137618452
type: Question
has comment: http://stackoverflow.com/comment/137617991
has comment: http://stackoverflow.com/comment/137616934
has comment: http://stackoverflow.com/comment/137619260
tagged with: lua
has comment: http://stackoverflow.com/comment/137614255
tagged with: abstract-syntax-tree
score: 0
has answer: http://stackoverflow.com/a/78062344
answer count: 1
has title: Pandoc Lua Filter: Is there an 'identity function' example?
has body: Is there is an equivalent of the identity transform for Lua Filters for Pandoc available anywhere? This would be a useful starting point for experimentation, assuming such an identity transform explicitly defined all possible function 'slots'. For context: my use-case here is to extract specific parts of Markdown documents - mostly codeblocks - and I want to ignore everything else.
accepted answer: http://stackoverflow.com/a/78062344
has comment: http://stackoverflow.com/comment/137616824

http://stackoverflow.com/comment/137515746
has text: ```math.ramdom(1, 5400)``` will fix it, because with arguments the first argument has to be an integer above 0. See the Lua Reference.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77997811
type: QuestionComment

http://stackoverflow.com/comment/137756460
type: Comment
has text: 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"
comment on: http://stackoverflow.com/q/78139158
score: 0
type: QuestionComment

http://stackoverflow.com/a/77980039
score: 0
has body: local stmt = db:prepare INSERT INTO tips_table (id, time, date, counter) VALUES (NULL, ?, ?, ?); stmt:bind_values(os.date('%H:%M:%S'), os.date('%y/%m/%d'), counter) @Alexander the above code works. Thanks for the help
type: Answer
answers question: http://stackoverflow.com/q/77977460

http://stackoverflow.com/comment/137512986
type: Comment
has text: posted another question https://stackoverflow.com/questions/78001723/print-call-issue-in-lua-based-function
score: 0
comment on: http://stackoverflow.com/a/77998270
type: AnswerComment

http://stackoverflow.com/comment/137750897
score: 1
type: Comment
has text: 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).
type: QuestionComment
comment on: http://stackoverflow.com/q/78135524

http://stackoverflow.com/q/78002123
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/137516994
tagged with: redis
has title: Redis Lua function call failing with CROSSSLOT error
answer count: 1
tagged with: redis-cluster
has answer: http://stackoverflow.com/a/78005089
score: 0
type: AnsweredQuestion
has body: I have a Redis 7.x cluster with 3 master nodes running on ports 7000, 7001, 7002. Each master has 1 slave/replica. I am trying to load and run this Lua based function: #!lua name=paramsLogLib local function paramsLog(keys, args) local param1 = keys[1] local param2 = keys[2] local param3 = keys[3] redis.log(redis.LOG_NOTICE, param1, param2, param3) end redis.register_function('paramsLog', paramsLog) The function has been loaded in all the 3 master nodes. I tried to call the function paramsLog from all the 3 master nodes: 127.0.0.1:7000&gt; fcall paramsLog 3 p1 p2 p3 127.0.0.1:7001&gt; fcall paramsLog 3 p1 p2 p3 127.0.0.1:7002&gt; fcall paramsLog 3 p1 p2 p3 I get the same error: (error) CROSSSLOT Keys in request don't hash to the same slot 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?
has comment: http://stackoverflow.com/comment/137556037
accepted answer: http://stackoverflow.com/a/78005089

http://stackoverflow.com/q/78095935
tagged with: lua
has body: With Roblox, I already tried 3-4 Times but this error still pops up: Zone4Tp is not a valid member of Workspace "Workspace" - Client - LocalScript:3 And if you are wondering, yes it is in Workspace. Here is my Code: local but = script.Parent local localplayer = game:GetService("Players").LocalPlayer local tppart = game:GetService("Workspace").Zone4Tp -- Replace with your TpPart name if you changed it. but.MouseButton1Click:Connect(function(plr) localplayer.Character:MoveTo(tppart.Position) end) When I test it it keeps spamming that it is not available for workspace. Any help?
has answer: http://stackoverflow.com/a/78096648
answer count: 1
type: UnansweredQuestion
tagged with: roblox
has title: Teleport Bug - (Lua)
score: 0
has comment: http://stackoverflow.com/comment/138134346
type: Question

sqlite
type: Tag
tag name: sqlite
tags question: http://stackoverflow.com/q/77977460
tags question: http://stackoverflow.com/q/78220636
tags question: http://stackoverflow.com/q/79461719

http://stackoverflow.com/a/78281303
has body: Have you enabled studio access? If not, you could read this documentation on how to enable it: https://create.roblox.com/docs/cloud-services/datastores 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. To enable Studio access in a published experience: Go to Home &gt; Game Settings &gt; Security. Enable the Enable Studio Access to API Services toggle. Click Save.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78134354
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78134354

http://stackoverflow.com/a/78015580
has comment: http://stackoverflow.com/comment/137540110
type: Answer
has body: PointBall.Touched:Connect(function(player) This function will simply respond with the part that touched the PointBall. This part is of course in the Workspace hence why it isn't working. We have to get the player from the Players folder. To fix this we have the GetPlayerFromCharacter() function, then we can apply the leaderstats change. local Players = game:GetService("Players") PointBall.Touched:Connect(function(hitPart) local player = Players:GetPlayerFromCharacter(hitPart.Parent) local PlayerPoints = player.leaderstats.Dookie PlayerPoints.Value = PlayerPoints.Value + 1 PointBall:Destroy() end)
answers question: http://stackoverflow.com/q/78014625
score: 0

http://stackoverflow.com/a/78627012
score: 0
type: Answer
has body: So I finally found something that works! Using the transparent.nvim plugin I was able to get it working. return { "xiyaowong/transparent.nvim", lazy = false, --this was SUPER IMPORTANT config = function() require("transparent").setup({ -- Optional, you don't have to run setup. groups = { -- table: default groups "Normal", "NormalNC", "Comment", "Constant", "Special", "Identifier", "Statement", "PreProc", "Type", "Underlined", "Todo", "String", "Function", "Conditional", "Repeat", "Operator", "Structure", "LineNr", "NonText", "SignColumn", "CursorLine", "CursorLineNr", "StatusLine", "StatusLineNC", "EndOfBuffer", }, extra_groups = {"NeoTreeNormal","NeoTreeNormalNC"}, -- and this was super important as well exclude_groups = {}, -- table: groups you don't want to clear }) end, } Right now the only thing not working is when you run :help. Other than that everything seems to be working just fine.
answers question: http://stackoverflow.com/q/78006322

http://stackoverflow.com/q/77994508
tagged with: redis
answer count: 1
has answer: http://stackoverflow.com/a/77998270
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/78001723
tagged with: redis-cluster
has body: My setup is a 3 masters, 3 slaves Redis cluster, version 7.x. I created a simple Lua based function as: #!lua name=loggerLib local function logMsg(keys, args) redis.log(redis.LOG_NOTICE, 'Hello!'); end redis.register_function('logMsg', logMsg) and loaded it as cat loggerLib.lua | redis-cli -c -p 7000 -x FUNCTION LOAD REPLACE However, when I execute it from the redis command prompt as 127.0.0.1:7002&gt; FCALL logMsg 1 I see the error: (error) ERR Function not found What am I doing wrong here? When I run it as 127.0.0.1:7000&gt; FCALL logMsg 1 a I see the error -&gt; Redirected to slot [15495] located at 127.0.0.1:7002 (error) ERR Function not found
score: 0
type: Question
tagged with: lua
accepted answer: http://stackoverflow.com/a/77998270
has title: Redis Function not found

http://stackoverflow.com/a/78058644
score: 0
answers question: http://stackoverflow.com/q/78058185
type: Answer
has body: Ah, here's the solution: function Div(el) if el.classes:includes("code") then if el.attributes['hide_input'] == "true" then if el.content[1].t == "CodeBlock" then el.content:remove(1) end end end return el end

http://stackoverflow.com/comment/137468548
has text: 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.
score: 0
comment on: http://stackoverflow.com/a/77975671
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/138662476
has text: @MechWright The 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. I'm sorry if that still doesn't help you.
type: Comment
comment on: http://stackoverflow.com/a/78600853
score: 0
type: AnswerComment

http://stackoverflow.com/a/78062344
upvote count: 1
has body: Identity transform for the Strong element: return { { Strong = function (elem) return elem end, } } Or if you don't need multiple filter runs, you can do the shorthand: function Strong(elem) return elem end You can return nil for elements that you want to filter out. For example removing all Strong elements would be: function Strong(elem) return nil end But there are quite a lot of different elements. So perhaps what you should do is do pandoc -t json and pipe that to a program in your favourite programming language and extract all code blocks. See pandoc filter tools 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. But it's true, you can achieve the same thing with a lua filter: local codeBlocks = {} return { { CodeBlock = function (el) -- on each CodeBlock match, -- append to codeBlocks like it's an array table.insert(codeBlocks, el) end, -- on the next run, we simply return a new -- Pandoc document with the code blocks Pandoc = function() return pandoc.Pandoc(codeBlocks) end } } Example usage (assuming filter code is in 'filter_codeblock.lua', and markdown document is 'main.md') pandoc --lua-filter filter_codeblock.lua main.md -t markdown
accepted answer of: http://stackoverflow.com/q/78056160
answers question: http://stackoverflow.com/q/78056160
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/137510333
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/77997811
score: 0
has text: `math.randomseed(os.time())` should be invoked only once, at the program start.

http://stackoverflow.com/comment/137710915
has text: For example you may get `_G["_IoioIooIOOIo"] = print` finally, then you know that `_IoioIooIOOIo` maps to `print`. But this will be a tedium process.
comment on: http://stackoverflow.com/a/78113125
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/137802381
has text: Probably you can do nothing in GHub to solve the issue.
type: Comment
comment on: http://stackoverflow.com/q/78143358
type: QuestionComment
score: 0

http://stackoverflow.com/q/78058185
tagged with: pandoc
has answer: http://stackoverflow.com/a/78058644
score: 0
type: Question
tagged with: latex
has title: Pandoc Jupyter filter to allow/prevent code blocks
tagged with: lua
has body: I'm (mostly successfully) converting Jupyter to LaTex. I can allow/prevent Jupyter code blocks from appearing in the LaTex by using this Lua filter: function Div(el) if el.classes:includes("code") then if el.content[1].t == "CodeBlock" then el.content:remove(1) end end return el end 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? Alternatively, how about a filter to prevent only Jupyter code blocks that contain specific text? Many thanks.
answer count: 1
type: UnansweredQuestion
tagged with: jupyter-notebook

http://stackoverflow.com/q/78090720
has title: Neovim: Making a function that checks the beginning of line and acts depending on it
type: Question
tagged with: lua
has comment: http://stackoverflow.com/comment/137671924
has answer: http://stackoverflow.com/a/78092474
accepted answer: http://stackoverflow.com/a/78092474
has body: Extra details, The whole code: local obsidianSettingsGroup = vim.api.nvim_create_augroup('Obsidian Group', { clear = true }) vim.api.nvim_create_autocmd('FileType', { pattern = {'markdown'}, callback = function() function entitle() local current_line = vim.api.nvim_get_current_line() if current_line[0] == '#' then return "I#<Esc>A<Esc>" else return "I# <Esc>A<Esc>" end end local keymap = vim.api.nvim_buf_set_keymap local opts = {noremap = true, silent} keymap(0, 'n', '<C-S-p>', ':ObsidianWorkspace<CR>', opts) keymap(0, 'n', '<C-p>', ':ObsidianQuickSwitch<CR>', opts) keymap(0, 'n', '=', entitle(), opts) end, group = obsidianSettingsGroup, }) So the goal is, check if line starts with # if yes, add # to it, if not, add # with space after it. Everything in the code works except the condition, which always returns false. Mind you it still runs, it just gives me the wrong thing. 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.
has comment: http://stackoverflow.com/comment/137670036
tagged with: neovim
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/137670275
score: 1

http://stackoverflow.com/comment/137664445
has text: @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
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78087883
type: Comment

http://stackoverflow.com/a/78191301
type: Answer
has body: You might want to check out Corrade, it has a feature wherein it will order a scripted agent to touch a prim: https://grimore.org/secondlife/scripted_agents/corrade/api/commands/touch
score: 0
answers question: http://stackoverflow.com/q/78140309

http://stackoverflow.com/q/77965624
tagged with: lua
upvote count: 3
type: Question
possible better answer: http://stackoverflow.com/a/77965747
has answer: http://stackoverflow.com/a/77965747
answer count: 2
accepted answer: http://stackoverflow.com/a/77965799
has title: Call string method on string literal
favorite count: 0
has answer: http://stackoverflow.com/a/77965799
type: AnsweredQuestion
has body: If I have a variable of string type, I can use the : syntax to call functions on the string metatable: local s = "%d" print(s:format(s:byte(1))) -- 37 But this doesn't work for string literals: print("%d":format("%d":byte(1))) -- ')' expected near ':' Why? Is there a trick to make this work?
downvote count: 0
score: 3

http://stackoverflow.com/a/77965799
accepted answer of: http://stackoverflow.com/q/77965624
has body: From section 9 of the manual (sic): 9 – The Complete Syntax of Lua [...] var ::= Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name [...] prefixexp ::= var | functioncall | ‘(’ exp ‘)’ functioncall ::= prefixexp args | prefixexp ‘:’ Name args [...] Basically: A "method" functioncall is made of four parts: prefixexp, the colon, the name of the method, and its arguments. A prefixexp can be either a functioncall itself, an exp wrapped inside a pair of parentheses, or a var. A var can be an identifier, or its indexed/dotted counterpart. This effectively disallows using the shorthand :method syntax on all kinds of literal expressions, not just strings. That said, these are all invalid syntax: nil:has_no_methods() true:or_false() 2:too() long strings:same_thing() function() end:really('?') {}:h_yes_definitely('!') ...but this is valid: foo:bar 'baz':qux() -- Parsed as foo:bar('baz'):qux() In conclusion, either use a variable, or just wrap your literal value in parentheses.
score: 4
answers question: http://stackoverflow.com/q/77965624
upvote count: 4
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/137614255
has text: 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
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78056160
type: Comment

http://stackoverflow.com/q/78063469
has title: Lua filter to preserve HTML comments
tagged with: lua
has answer: http://stackoverflow.com/a/78092591
linked to: http://stackoverflow.com/q/78052121
has body: I try to create a Lua filter to preserve HTML comments (but not any other HTML elements). local function starts_with(start, str) return str:sub(1, #start) == start end function RawInline(el) if starts_with('&lt;!--', el.text) then return el else return nil end end return {{Inline = RawInline}} (Based on mb21's answer here: From HTML to Markdwon: As clean Markdown markup as possible, and to preserve HTML comments.) It doesn't currently work. What might be the problem? pandoc -f html+raw_html from.html -o to.md -t gfm --lua-filter preserve-comments.lua
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137672709
tagged with: pandoc
answer count: 1
accepted answer: http://stackoverflow.com/a/78092591
has comment: http://stackoverflow.com/comment/137677469
has comment: http://stackoverflow.com/comment/137670724
type: Question

http://stackoverflow.com/a/78061517
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/137617221
upvote count: 1
score: 1
has body: function Cell:new(index: number, coordinates: Vector2) local instance = setmetatable({}, self) self.__index = self self.index = index self.coordinates = coordinates return instance end You create a new instance, but then continue using self, which is Cell, the class. Use instance to set instance fields.
answers question: http://stackoverflow.com/q/78059961

http://stackoverflow.com/q/78095099
has comment: http://stackoverflow.com/comment/137679340
has title: Lua error "mutating non-standard global variable 'love'"
tagged with: global
type: Question
has body: 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 "love". I have no idea why it happens
has comment: http://stackoverflow.com/comment/137678609
answer count: 0
tagged with: var
tagged with: lua
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/137464468
type: QuestionComment
score: 1
type: Comment
comment on: http://stackoverflow.com/q/77974071
has text: Can you share a complete, runnable [mcve]? Thanks.

http://stackoverflow.com/a/78042017
has body: i think, i found a valid solution by myself: actions.command7 = function () if (f5) then if (Lift) then ms.up(UseButton); kb.up("e"); Lift = not Lift; else kb.stroke("f5"); f5 = not f5; end else kb.stroke("f5"); ms.down(UseButton); kb.down("e"); f5 = true; Lift = true; end end
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/78035469

http://stackoverflow.com/q/78049090
has comment: http://stackoverflow.com/comment/137611843
type: Question
downvote count: 0
tagged with: lua
tagged with: javascript
upvote count: 1
type: UnansweredQuestion
has body: I'm trying to call a javascript function with a single parameter from Lua using Fengari, but the parameter value is always undefined. The following code correctly invokes the "display" function but the argument (64) is not correctly passed into the function, and "digit" is always undefined. Could anyone advise please? const lua = fengari.lua; const lauxlib = fengari.lauxlib; const lualib = fengari.lualib; const interop = fengari.interop; function display(digit) { console.log(`digit is ${digit}`); } let L = lauxlib.luaL_newstate(); lualib.luaL_openlibs(L); interop.luaopen_js(L); interop.push(L,display); lua.lua_setglobal(L,fengari.to_luastring("display")); const result = lauxlib.luaL_dostring(L, fengari.to_luastring('display(64)')); if (result !== lua.LUA_OK) { // Error occurred const errorMessage = lua.lua_tostring(L, -1); console.error("Lua error:", fengari.to_jsstring(errorMessage)); lua.lua_pop(L, 1); } else { // Execution was successful console.log("Lua code executed successfully"); }
score: 1
favorite count: 0
has title: Problem passing parameter to javascript function called from Lua using Fengari-Web
answer count: 0

sdk
type: Tag
tags question: http://stackoverflow.com/q/78053349
tag name: sdk
tags question: http://stackoverflow.com/q/78068802

http://stackoverflow.com/comment/137672709
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78063469
type: Comment
has text: @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?

http://stackoverflow.com/comment/137756425
has text: 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 `local Human = {} function Human:new(name, gender) local obj = { _name = name, _gender = gender, } setmetatable(obj, self) self.__index = self return obj end` and then here use setters and getters `function Human:getName() return self._name en function Human:setName(newName) self._name = newName end ... return Human`
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78136254

http://stackoverflow.com/q/78108133
score: 10
has body: I'm configuring neovim with none-ls and when I'm trying to add eslint_d to the setup I have this error : [null-ls] failed to load builtin eslint_d for method diagnostics; please check your config Here is what my none-ls.lua file looks like return { "nvimtools/none-ls.nvim", config = function() local null_ls = require("null-ls") null_ls.setup({ sources = { null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.prettier, null_ls.builtins.diagnostics.eslint_d, }, }) vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {}) end, } I only have an issue with eslint_d (I tried eslint-lsp too, same issue) I have installed eslint_d with Mason (even tried to uninstall and install it again) I have installed eslint_d globally using npm I have checked none-ls' documentation and it looks like it should work Does anyone know what could be the issue? Thanks a lot!
tagged with: neovim
tagged with: eslint
has answer: http://stackoverflow.com/a/79412028
accepted answer: http://stackoverflow.com/a/78110829
favorite count: 0
possible better answer: http://stackoverflow.com/a/78848738
has title: Issue with none-ls configuration error with eslint_d
type: AnsweredQuestion
upvote count: 10
has answer: http://stackoverflow.com/a/78848738
downvote count: 0
has answer: http://stackoverflow.com/a/78110829
tagged with: lua
answer count: 3
type: Question

http://stackoverflow.com/comment/137489929
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77988153
has text: @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.
type: Comment

http://stackoverflow.com/q/78139158
type: AnsweredQuestion
tagged with: local
has answer: http://stackoverflow.com/a/78139533
has comment: http://stackoverflow.com/comment/137757067
has comment: http://stackoverflow.com/comment/137756316
has answer: http://stackoverflow.com/a/78140323
has title: Do local variables in lua occupy memory after end of scope?
score: 0
answer count: 2
type: Question
has comment: http://stackoverflow.com/comment/137756533
has body: --script.lua local x = 0 --main.lua dofile("script.lua") 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. How 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? I dont need their locals in my memory anymore 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.
has comment: http://stackoverflow.com/comment/137762480
possible better answer: http://stackoverflow.com/a/78140323
tagged with: lua
has comment: http://stackoverflow.com/comment/137756460
tagged with: memory
accepted answer: http://stackoverflow.com/a/78139533

http://stackoverflow.com/q/77994757
tagged with: roblox
has answer: http://stackoverflow.com/a/77996276
has comment: http://stackoverflow.com/comment/137503297
has title: Remote event not sending from client to server
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137502184
has body: I am trying to make an announcement system in Roblox Studio using remote events to transmit the data but the remote events arent firing. Local Script (ADMIN): ... game.ReplicatedStorage.SG_FlightAnnouncementSystem.Events.startAnnouncement:FireServer(announcement) print("Client Sent Announcement") Script (SERVER SCRIPT SERVICE): local announcementReciever = script.Parent.Parent.Events.startAnnouncement local announcementSender = script.Parent.Parent.Events.startClientAnnouncement announcementReciever.OnServerEvent:Connect(function(plr, announcement) print("Server Received Announcement") script.Parent.Parent["Sound Effects"].announcementChime.Playing = true announcementSender:FireAllClients(announcement) end) Local Script (CLIENT RECIEVER): startClientAnnouncement.OnClientEvent:Connect(function(announcement) print("Client Received Announcement") end) I expect it to output 2 client prints and 1 server print but I only get 1 client print from firing the event.
score: 0
type: Question
tagged with: lua

http://stackoverflow.com/a/79412028
has body: I have the exact same content on the file, but I get an error, maybe I'm missing install something? return { "nvimtools/none-ls.nvim", dpendencies = { "nvimtools/none-ls-extras.nvim", }, config = function() local null_ls = require("null-ls") null_ls.setup({ sources = { null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.prettier, require("none-ls.diagnostics.eslint_d"), }, }) vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, { desc = "Format file" }) end, } here is the error message when I start nvim Failed to run `config` for none-ls.nvim /Users/zlnk/.config/nvim/lua/zlnk/plugins/none-ls.lua:13: module 'none-ls.diagnostics.eslint_d' not found: ^Ino field package.preload['none-ls.diagnostics.eslint_d'] cache_loader: module none-ls.diagnostics.eslint_d not found cache_loader_lib: module none-ls.diagnostics.eslint_d not found ^Ino file './none-ls/diagnostics/eslint_d.lua' ^Ino file '/opt/homebrew/share/luajit-2.1/none-ls/diagnostics/eslint_d.lua' ^Ino file '/usr/local/share/lua/5.1/none-ls/diagnostics/eslint_d.lua' ^Ino file '/usr/local/share/lua/5.1/none-ls/diagnostics/eslint_d/init.lua' ^Ino file '/opt/homebrew/share/lua/5.1/none-ls/diagnostics/eslint_d.lua' ^Ino file '/opt/homebrew/share/lua/5.1/none-ls/diagnostics/eslint_d/init.lua' ^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/share/lua/5.1/none-ls/diagnostics/eslint_d.lua' ^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/share/lua/5.1/none-ls/diagnostics/eslint_d/init.lua' ^Ino file './none-ls/diagnostics/eslint_d.so' ^Ino file '/usr/local/lib/lua/5.1/none-ls/diagnostics/eslint_d.so' ^Ino file '/opt/homebrew/lib/lua/5.1/none-ls/diagnostics/eslint_d.so' ^Ino file '/usr/local/lib/lua/5.1/loadall.so' ^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/lib/lua/5.1/none-ls/diagnostics/eslint_d.so' ^Ino file '/Users/zlnk/.local/share/nvim/lazy-rocks/telescope.nvim/lib64/lua/5.1/none-ls/diagnostics/eslint_d.so' ^Ino file './none-ls.so' ^Ino file '/us…
answers question: http://stackoverflow.com/q/78108133
type: Answer
downvote count: 0
score: 2
upvote count: 2

http://stackoverflow.com/q/78112697
has title: I want to disable Lua obfuscation
answer count: 1
tagged with: obfuscation
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137710243
tagged with: deobfuscation
has body: This is Lua from some game. I would like to modify and use this. But it's obfuscated. Here's the structure I figured out: For example, entering a chat calls the following Lua file. return function (self,type,message) _G["\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}"]["\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}"][(530247052)-(442715560)+(417474590)](self,type,message) end The code calls an unknown global variable. I also found a file with many unreadable global variables defined. First, I performed the following calculation (530247052)-(442715560)+(417474590). The result is 505006082 There was a similar pattern in the "chunk.lua" file where global variables were defined. Here are some of them: [(1437643653)+(1949875078)-(2882512649)]=function(__a0,__a1,__a2)local ikiikkiKKk=223266510;ikiikkiKKk+=1811079080;(function(_iI0l1liIioIl,_o01ilio0oI00,_io0l1lioiIo1)local _1o0iIi1o1lo1=_iI0l1liIioIl[_G["\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}"]["\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}"][(1155173479)+(1577632519)-(1688057523)]][_G[_G["\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}"]["\u{06C}\u{006C}\u{6C}\u{6C}\u{0…
has comment: http://stackoverflow.com/comment/137709788
upvote count: 0
accepted answer: http://stackoverflow.com/a/78113125
type: Question
linked to: http://stackoverflow.com/q/66121229
duplicate of: http://stackoverflow.com/q/66121229
has comment: http://stackoverflow.com/comment/137710291
has answer: http://stackoverflow.com/a/78113125
downvote count: 3
tagged with: lua
score: -3

lightroom
type: Tag
tag name: lightroom
tags question: http://stackoverflow.com/q/78053349
tags question: http://stackoverflow.com/q/78068802

http://stackoverflow.com/comment/137654595
type: Comment
has text: 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
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78077926

http://stackoverflow.com/a/78600853
score: 0
has comment: http://stackoverflow.com/comment/138662476
type: Answer
answers question: http://stackoverflow.com/q/78039187
has comment: http://stackoverflow.com/comment/138638845
has body: It looks like "haskell-language-server"'s server name is hls (source). Therefore, you should be able to include this in your config: lvim.lsp.automatic_configuration.skipped_servers = {"hls"} and afterward run :LvimCacheReset to be safe. This works for me locally. In addition, LunarVim has a list of default skipped servers that you may not want to override: vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, {"hls"}) as is recommended in the LunarVim documentation.

mason
tags question: http://stackoverflow.com/q/78039187
tag name: mason
type: Tag

http://stackoverflow.com/a/78131855
type: Answer
answers question: http://stackoverflow.com/q/78129944
has comment: http://stackoverflow.com/comment/137791905
score: 0
has body: 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. It is a 'decorator' that allows to create Lua functions with typed arguments and returns. Function specification is a string, e.g.: Squares its argument. @param number x Number to square @return number The squared number Nullable types (starting with ?) are allowed; so are multiple types, e.g. number|string. local unpack = unpack or table.unpack local tags = { author = 'An author of the module or file', 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)', field = 'Describe a table field definition', param = 'Describe function parameters. It requires the name of the parameter and its description', release = 'Free format string to describe the module or file release', ['return'] = 'Describe a returning value of the function. Since Lua can return multiple values, this tag should appear more than once', see = 'Refers to other descriptions of functions or tables', usage = 'Describe the usage of the function or variable', class = 'If LuaDoc cannot infer the type of documentation (function, table or module definition), the programmer can specify it explicitly', description = 'The description of the function or table. This is usually infered automatically', 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', type = 'Set "type" of a table.', precondition = 'A function that should return true for passed parameters', postcondition = 'A function that should return true for returned parameters' } local tag_fields = { param = 2 } -- Makes an array of possible types out of string '[?]type1|…

http://stackoverflow.com/comment/137664455
comment on: http://stackoverflow.com/q/78087883
type: Comment
has text: @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
score: 0
type: QuestionComment

http://stackoverflow.com/a/78478262
type: Answer
has body: I have tested this, but the separator still opaque: vim.api.nvim_set_hl(0, "Normal", { bg = "none"}) vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none"}) vim.api.nvim_set_hl(0, "NeoTreeNormal", { bg = "none"}) vim.api.nvim_set_hl(0, "NeoTreeNormalNC", { bg = "none"})
answers question: http://stackoverflow.com/q/78006322
score: 0

http://stackoverflow.com/comment/137665522
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78087883
type: Comment
has text: @ESKri I tried your proposal without good results, probably because I have no clue about what I'm actually doing :/

http://stackoverflow.com/comment/137666016
type: Comment
score: 0
type: QuestionComment
has text: To clarify, bitshifting gives a wrong result as soon as the number is converted to double
comment on: http://stackoverflow.com/q/78087883

callback
tag name: callback
tags question: http://stackoverflow.com/q/78111131
type: Tag

redis-cluster
tags question: http://stackoverflow.com/q/78068038
tags question: http://stackoverflow.com/q/78002123
type: Tag
tags question: http://stackoverflow.com/q/78001723
tags question: http://stackoverflow.com/q/77994508
tags question: http://stackoverflow.com/q/78074908
tags question: http://stackoverflow.com/q/78075230
tag name: redis-cluster
tags question: http://stackoverflow.com/q/79504829

http://stackoverflow.com/q/78109630
has answer: http://stackoverflow.com/a/78109755
has body: I am working with some lua code (extracted from an English Wiktionary module) and do not understand the problem: t = { [3] = "continent", } function vprint (val) return val or 'nil' end prev_qualifier, this_qualifier, bare_placetype = unpack(t) print('prev_qualifier=' .. vprint(prev_qualifier) .. ', this_qualifier=' .. vprint(this_qualifier) .. ', bare_placetype=' .. vprint(bare_placetype)) In Lua5.1, I run the code and get : prev_qualifier=nil, this_qualifier=nil, bare_placetype=nil I would expect bare_qualifierto be equal to 'continent'. To go further, the code : prev_qualifier, this_qualifier, bare_placetype = t[1], t[2], t[3] print('prev_qualifier=' .. vprint(prev_qualifier) .. ', this_qualifier=' .. vprint(this_qualifier) .. ', bare_placetype=' .. vprint(bare_placetype)) Will correctly display: prev_qualifier=nil, this_qualifier=nil, bare_placetype=continent In the documentation, it seems that both assignations should be equivalent. What do I miss here ?
favorite count: 0
has title: What do I not understand about unpack in Lua
type: AnsweredQuestion
answer count: 2
possible better answer: http://stackoverflow.com/a/78109682
upvote count: 1
type: Question
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/78109755
tagged with: lua
has answer: http://stackoverflow.com/a/78109682

http://stackoverflow.com/comment/137466794
type: Comment
score: 1
comment on: http://stackoverflow.com/q/77974071
type: QuestionComment
has text: 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.

http://stackoverflow.com/q/78076526
tagged with: lua-c++-connection
has title: Visual Studio debug LUA scripts withing C++ Project
tagged with: debugging
has body: 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 https://github.com/WheretIB/LuaDkmDebugger. However VS Still does not stop at the Break Points. Attached you will find Screenshots of the Warnings and Indications I am currently having. Is there any way to fix this or any external Tool I could use to debug these LUA Scripts? Thanks in Advance
type: UnansweredQuestion
score: -1
downvote count: 1
answer count: 1
upvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/78085358
tagged with: lua

http://stackoverflow.com/comment/137664368
has text: 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?
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/78087883
type: Comment

http://stackoverflow.com/comment/137709788
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78112697
has text: _"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.
type: Comment

http://stackoverflow.com/comment/137736097
has text: @Ctx yes sorry, for testing I was basically skipping the if (!lua_isnumber(L, -1)) check. Edited the code.
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78126689

http://stackoverflow.com/a/78366554
score: 0
answers question: http://stackoverflow.com/q/78118370
type: Answer
has body: 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 RemoteEvent to all the clients using FireAllClients(), then to have the clients send back a number detailing what number they have selected using FireServer() The full process would then be the following: Server selects question/answer set (serverscript) → server sends question/answer set to clients (RemoteEvent:FireAllClients()) → clients receive and display question/answer set (localscript) → player selects → clients send information back to server (RemoteEvent:FireServer()) → server keeps track of who answered what, and awards points or whatever you want to do (serverscript) 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.

http://stackoverflow.com/a/78010777
type: AcceptedAnswer
has body: Thanks to koyaanisqatsi for the comment, the issue lied in the specific function I was using to get a random number. Lua's math.random() function cannot take in 0 as an argument. This was solved by simply changing it to 1 instead.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/77997811
answers question: http://stackoverflow.com/q/77997811
downvote count: 0
score: 1

http://stackoverflow.com/comment/137757067
type: Comment
has text: but numbers are not subject to garbagecollect.
type: QuestionComment
comment on: http://stackoverflow.com/q/78139158
score: 0

deobfuscation
type: Tag
tags question: http://stackoverflow.com/q/78112697
tag name: deobfuscation

http://stackoverflow.com/comment/137736710
type: AnswerComment
has text: Should wrap to_number with a function returning a default value?
type: Comment
comment on: http://stackoverflow.com/a/78106691
score: 0

http://stackoverflow.com/comment/137665918
has text: I don't know what to do tbh, my knowledge in both bit manipulation and cryptography is ridiculous
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78087883
type: Comment

linear-algebra
tag name: linear-algebra
type: Tag
tags question: http://stackoverflow.com/q/78129002

http://stackoverflow.com/comment/137477530
type: QuestionComment
comment on: http://stackoverflow.com/q/77977460
has text: 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.
type: Comment
score: 0

http://stackoverflow.com/a/78092474
has body: 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: :s/^\s*\zs\ze\(.\)/\=submatch(1)=='#'?'#':'# ' This uses the :substitute command to match from the beginning of the line ^, any number of whitespace \s*. Now, \zs starts the match and \ze immediately ends it (we're using this as a poor man's lookaround) and \(.\) 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. See :help :substitute, :help pattern and :help /\zs. To have a condition, we use \= to evaluate the replacement as an expression. Our expression is a ternary condition. If the captured character submatch(1) is a &quot;#&quot;, put another &quot;#&quot; in front of it, else put &quot;# &quot;. References: :help sub-replace-expression, :help submatch() and :help ternary. Going forward with this command, you could create a mapping, you could call it from a function or you could create a user command.
type: AcceptedAnswer
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/78090720
accepted answer of: http://stackoverflow.com/q/78090720
score: 2
downvote count: 1

http://stackoverflow.com/q/77963271
has title: ServerScriptService Script doesn't see changes of player value
score: 0
has body: I want to create a mine pet system for a clicker. I create a value in player Main script in ServerScriptService: local genX=Instance.new("IntValue", player) --actual player multiply by pets genX.Value=10 genX.Name="genPetX" 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) LocalScript in Pet: local player= game.Players.LocalPlayer local Equip=false script.Parent.MouseButton1Click:Connect(function() if Equip==false then player.genPetX.Value+=script.Parent.xClicks.Value Equip=true else player.genPetX.Value-=script.Parent.xClicks.Value Equip=false end end) I even have label that changes every time genPetX changes and print some text LocalScript in Label: local localplayer=game.Players.LocalPlayer localplayer.PlayerGui.ScreenGui.xPet.Text=localplayer.genPetX.Value localplayer.genPetX.Changed:Connect(function () localplayer.PlayerGui.ScreenGui.xPet.Text=localplayer.genPetX.Value game.ReplicatedStorage.getX:FireServer() end) Main script in ServerScriptService: game.ReplicatedStorage.getX.OnServerEvent:Connect(function(player) print ("I watched you chaaaaangeeedddddd") end) but when I click, even when the Label say that it changed, it using default genPetX=10 Value Main script in ServerScriptService: game.ReplicatedStorage.click.OnServerEvent:Connect(function(player) player.leaderstats.Clicks.Value+=player.ClicksPerClick.Value*player.genPetX.Value end) 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.
answer count: 1
has answer: http://stackoverflow.com/a/77975688
tagged with: roblox
type: Question
tagged with: lua
tagged with: scripting
type: UnansweredQuestion

http://stackoverflow.com/a/77988153
type: Answer
has body: For luasocket, since version 3.0.0, you can change the size with setoption. local sock = socket.udp() sock:setoption('send-buffer-size', bytes) By default sending is not buffered, but you can actually achieve buffering by concatenating strings in Lua on your own.
has comment: http://stackoverflow.com/comment/137489929
has comment: http://stackoverflow.com/comment/137488583
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/77986782
upvote count: 0

comments
tags question: http://stackoverflow.com/q/78077926
tag name: comments
type: Tag

unix
tag name: unix
tags question: http://stackoverflow.com/q/77986782
type: Tag

http://stackoverflow.com/comment/137479499
comment on: http://stackoverflow.com/q/77977304
type: Comment
has text: Try ```os.clock()``` and use variables to set or reset your timers depending on the runtime.
score: 0
type: QuestionComment

http://stackoverflow.com/q/77977460
has body: in if a table is created in the following way db:exec CREATE TABLE IF NOT EXISTS tips_table (id INTEGER PRIMARY KEY,time TIME,date DATE, counter INTEGER) and data is inserted as below into the above table local stmt = db:prepare INSERT INTO tips_table (time, date, counter) VALUES (?, ?, ?); stmt:bind_values(os.date('%H:%M:%S'), os.date('%y/%m/%d'), counter) Why am I getting the following error lua: Test.lua:247: attempt to index local 'stmt' (a nil value) I played around with different variable and tried to convert the date and time to strings. I looked at the lsqlite3 syntax from different websites and endlessly Googled, but I cant seem to get it right
has answer: http://stackoverflow.com/a/77980039
score: 0
has answer: http://stackoverflow.com/a/77977772
has title: using stmt = db:prepare and stmt:bind_values to Insert date and a number in to a table
has comment: http://stackoverflow.com/comment/137470115
type: Question
tagged with: sqlite
tagged with: lua
type: UnansweredQuestion
answer count: 2
has comment: http://stackoverflow.com/comment/137477530

http://stackoverflow.com/a/77975671
has comment: http://stackoverflow.com/comment/137468548
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/137468693
has comment: http://stackoverflow.com/comment/137468890
answers question: http://stackoverflow.com/q/77974971
has comment: http://stackoverflow.com/comment/137469213
has body: If you remove myIndex from the table, myTbl.myIndex () will activate the __index metamethod, which can either be a function (table, key) or a table. myIndex () will only be called if __index (table, key) takes care of that, or if there is __index.myIndex function doing what you want. See 13.4.1 – The __index Metamethod from Programming in Lua. Update, after reading comments: By manipulating metatables and redefining functions you can effectively add new metamethods (e.g., by redefining the globals pairs() and ipairs() you can enable in Lua 5.1 __pairs and __ipairs metamethods, introduced in Lua 5.2). The metatable is usually set in a 'wrapper' function that receives a table and returns its extended / enriched version. Like this: local new_metamethod_name = '__method' local function set_extended_metatable (t, mt) local old__index = mt.__index -- remember to emulate later, if any. mt.__index = function (table, index) if type (mt [new_metamethod_name]) == 'function' and type (t [index]) == 'function' then -- invoke the new metamethod for methods only, not properties: mt [new_metamethod_name] (table, index) end return t [index] -- return data from the original table, if any. -- emulate mt.__index, if any: or type (old__index) == 'function' and old__index (table, index) or type (old__index) == 'table' and old__index [index] end return setmetatable ({}, mt) -- for {}, __index will be always called. end local dumb_table = { myIndex = function (myParam) return ('In myIndex(). myParam is ' .. tostring (myParam)) end, someProperty = 43 } local smart_table = set_extended_metatable (dumb_table, { __method = function (tbl, key) print ('Invoking the new metamethod') end }) print (smart_table.myIndex (42)) -- __method() called. print (smart_table.someProperty) -- __method() not called.

http://stackoverflow.com/q/77973700
tagged with: neovim-plugin
has answer: http://stackoverflow.com/a/78235056
score: 2
tagged with: neovim
answer count: 1
has body: 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. This is what my config looks like right now: return { "nvimtools/none-ls.nvim", config = function() local null_ls = require("null-ls") null_ls.setup({ sources = { null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.black, null_ls.builtins.formatting.isort, }, }) vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {}) end, } 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. Thank you for you help!
tagged with: formatting
favorite count: 0
type: AnsweredQuestion
downvote count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/78235056
type: Question
tagged with: java
has title: Neovim configuration setup with none_ls
tagged with: lua

http://stackoverflow.com/comment/137665669
comment on: http://stackoverflow.com/q/78087883
type: Comment
has text: @harold am I right ?
score: 0
type: QuestionComment

http://stackoverflow.com/q/77974971
has body: I hope you all can help me. So, I want to know when I call function in table like this which metamethod is activating: local myTbl = setmetatable({ myIndex = function(myParam) print(myParam) end }, { -- Which is the metamethod that activates itself while using myIndex }) I tried EVERYTHING!!! I mean. I made metatable and I used every single metamethod and nothing is called from the metamethods I used.
score: 0
has title: Where I can get activation from the metamethods while using function in table like this: tbl.myIndex(myParameters)?
type: Question
tagged with: lua
type: UnansweredQuestion
tagged with: meta-method
has answer: http://stackoverflow.com/a/77975671
answer count: 1

http://stackoverflow.com/comment/137619260
has text: 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.
comment on: http://stackoverflow.com/q/78056160
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/137628270
score: 0
comment on: http://stackoverflow.com/a/78068183
type: AnswerComment
has text: 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`
type: Comment

http://stackoverflow.com/comment/137733364
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78108609
has text: Thanks for your suggestion, using wpa_cli shuold be a better solution. Using 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. Regarding lua instead, how can I check the socket connection from lua code?

http://stackoverflow.com/comment/137665882
comment on: http://stackoverflow.com/q/78087883
type: Comment
score: 0
has text: 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
type: QuestionComment

http://stackoverflow.com/q/78126689
tagged with: lua
has comment: http://stackoverflow.com/comment/137745874
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137736097
has body: I want to share a lua table given as an argument for a registered C function and convert this table to an C array. Lua 5.4. The table length is correctly retrieved, however the indices type are always nil. This is my C code: static int myFunction(lua_State *L) { uint16 targetAddress = lua_tointeger(L, 1); // array1 - pay attention to use of 2, -1, and 1. if (lua_istable(L, 2) != 0) { unsigned int userDataSize = lua_rawlen(L, 2); ESP_LOGE(TAG, "length: %d",userDataSize); uint8_t *userData = (uint8_t *)malloc(userDataSize * sizeof(uint8_t)); if (!userData) { ESP_LOGE(TAG, "GenericRequest Failed to allocate memory"); } for (unsigned int i = 0; i < userDataSize; i++) { lua_rawgeti(L, 2, i + 1); // Lua uses 1-based indices. ESP_LOGE(TAG, "type %s", luaL_typename(L, -1)); ESP_LOGI(TAG, "Val: %f", lua_tonumber(L, -1)); userData[i] = (uint8_t)lua_tonumber(L, -1); ESP_LOGI(TAG, "%d: %d", i, userData[i]); lua_pop(L, 1); // Pop the Lua value from the stack } ESP_LOGI(TAG, "TA: 0x%X data:", targetAddress); ESP_LOG_BUFFER_HEX(TAG, userData, userDataSize); free(userData); } else { ESP_LOGE(TAG, "Argument #2 expected table"); } return 0; } And this my lua script: print(\"Hello from Lua\") mylib.myFunction(0xA98, {1, 2, 3, 4, 5}) I also tried to make the table as a local variable first and pass the variable name to myFunction The log output shows: Hello from Lua E (3572) BSW: length: 5 E (3573) BSW: type nil E (3573) BSW: Val: 0.000000 I (3573) BSW: 0: 0 E (3576) BSW: type nil E (3579) BSW: Val: 0.000000 I (3583) BSW: 1: 0 E (3586) BSW: type nil E (3590) BSW: Val: 0.000000 I (3594) BSW: 2: 0 E (3602) BSW: type nil E (3605) BSW: Val: 0.000000 I (3609) BSW: 3: 0 E (3612) BSW: type nil E (3615) BSW: Val: 0.000000 I (3619) BSW: 4: 0 I (3622) BSW: TA: 0xA98 data: I (3627) BSW: 00 00 00 00 00 EDIT: The following code works, explanations appreciated. Thanks uint16 targetAddress = lua_tointeger(L, 1); printf("TA: 0x%X \n", targetAddress); uint8_t idx_table = 2; // Check if the first argume…
score: 0
has title: Lua reading table as array in C returns nil for indices
tagged with: arrays
type: Question
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/137751062
answer count: 0
has comment: http://stackoverflow.com/comment/137735342
has comment: http://stackoverflow.com/comment/137738194

http://stackoverflow.com/q/77974071
tagged with: love2d
upvote count: 1
type: UnansweredQuestion
favorite count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/137466794
answer count: 0
score: 1
has title: Why is the x value in my lua table changing after being created by a for loop?
has comment: http://stackoverflow.com/comment/137464468
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/137466391
has comment: http://stackoverflow.com/comment/137464749
has body: 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. A picture of (seemingly) 1 pawn in the 7H position on a chess board: I wrote a for loop as shown below: for i = 1, 8, 1 do local column = string.char(64+i) _G["pawn7"..column] = Pawn:new(0, i, 2) print(pawn7A.x) end 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? -- Update Okay, 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. pieces = {} function newPiece(c, x, y) self = {} self.c = c self.x = x self.y = y return self end for i = 1, 8, 1 do local column = string.char(64+i) pieces["p7"..column] = newPiece(0, i, 2) end print(pieces.p7A.x)

http://stackoverflow.com/q/78030461
answer count: 1
favorite count: 0
type: Question
has title: How to remove elements inside a table based on a value of those elements?
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/78030599
accepted answer: http://stackoverflow.com/a/78030599
has body: Iam trying to remove elements in a table which have a certain value test = { { id = 473385593, deleted = true, }, { id = 473385619, deleted = true, }, { id = 473432275, deleted = false, }, { id = 473786710, deleted = false, }, } for index, value in ipairs(test) do if value.deleted then table.remove(test, index) end end for _, value in pairs(test) do print(value.id) print(value.deleted) end I would like that i the output is 473432275 false 473786710 false But { id = 473385619, deleted = true, }, is not deleted 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. So how do i remove in lua a tables elements based on their value?
tagged with: lua
tagged with: lua-table
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/a/78005089
accepted answer of: http://stackoverflow.com/q/78002123
has body: 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 CROSSSLOT error. 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. 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 args. If they indeed the keys, you can try to use hash-tag to ensure these keys located on the same slot. So that your script can access all of them.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/78002123
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/137710892
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78113125
type: Comment
has text: 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.

http://stackoverflow.com/comment/137665057
has text: Try to normalize every result of addition. For example, after `h0 = h0 + ...` insert `h0 = h0 % 2^32`
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78087883
type: Comment

http://stackoverflow.com/comment/137803776
comment on: http://stackoverflow.com/q/78143358
has text: @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.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/137664449
comment on: http://stackoverflow.com/q/78087883
has text: The implementation you posted a link to requires only 32-bit numbers
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137556037
score: 0
type: QuestionComment
has text: okay, got it. @for_stack has suggested to use args.
type: Comment
comment on: http://stackoverflow.com/q/78002123

http://stackoverflow.com/q/78143358
tagged with: logitech-gaming-software
has comment: http://stackoverflow.com/comment/137767070
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137803776
score: 0
has comment: http://stackoverflow.com/comment/137764126
has comment: http://stackoverflow.com/comment/137790617
has comment: http://stackoverflow.com/comment/137786130
has comment: http://stackoverflow.com/comment/137793998
has title: Lua script code doesn't work on Battlefield1
has comment: http://stackoverflow.com/comment/137773244
type: Question
has comment: http://stackoverflow.com/comment/137802381
answer count: 0
tagged with: lua
tagged with: scripting
has comment: http://stackoverflow.com/comment/137778891
has comment: http://stackoverflow.com/comment/137764086
has body: 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. EnablePrimaryMouseButtonEvents(true); function OnEvent(event, arg) if IsKeyLockOn("numlock" )then if IsMouseButtonPressed(3)then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0,1) Sleep(33) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end end 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. Here is a video: https://youtu.be/ZJixURBzsyA

http://stackoverflow.com/comment/137468693
comment on: http://stackoverflow.com/a/77975671
type: Comment
has text: 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()`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137516777
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78001723
type: QuestionComment
has text: ...or: ```eval 'return(("millis: %s"):format(redis.call("TIME")[2]))' 0```

http://stackoverflow.com/comment/137778891
comment on: http://stackoverflow.com/q/78143358
type: Comment
score: 0
type: QuestionComment
has text: And it stucks this way ONLY when you run the game with this Lua script?

http://stackoverflow.com/comment/137654539
type: QuestionComment
comment on: http://stackoverflow.com/q/78077926
score: 0
type: Comment
has text: Hmm, and `towerToSpawn` is definitely within scope and executed before the other two lines of code?

http://stackoverflow.com/comment/137516711
comment on: http://stackoverflow.com/q/78001723
type: Comment
score: 1
type: QuestionComment
has text: Simply return it, like ```eval 'return(redis.call("TIME"))' 0```

udp
tags question: http://stackoverflow.com/q/77986782
type: Tag
tag name: udp

http://stackoverflow.com/comment/138134331
has text: 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.
comment on: http://stackoverflow.com/a/78096648
type: AnswerComment
type: Comment
score: 0

typing
tags question: http://stackoverflow.com/q/78129944
type: Tag
tag name: typing

http://stackoverflow.com/q/77986782
upvote count: 1
tagged with: datagram
has title: How to change buffer size for lua socket?
type: Question
downvote count: 0
tagged with: lua
tagged with: unix
answer count: 1
tagged with: udp
type: UnansweredQuestion
has body: I have the following lua function that creates, connects, and sends information on a udp socket. local udp = ngx.socket.udp local function write_to_socket(conf, bytes) local sock = udp() sock:settimeout(conf.timeout) sock:setpeername(conf.socket_host, conf.socket_port) sock:send(bytes) sock:close() end (I've omitted error handling) I would like to increase the writing buffer size with an option similar to so_sndbuf, but as far as I can tell both ngx socket and lua socket don't offer this ability. Is there a way to change writing buffer size in lua? 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 lua_register.
score: 1
has answer: http://stackoverflow.com/a/77988153
favorite count: 0

http://stackoverflow.com/a/78848738
upvote count: 10
answers question: http://stackoverflow.com/q/78108133
has body: Add none-ls-extras to the dependencies. Require the modules you need. return { "nvimtools/none-ls.nvim", dependencies = { "nvimtools/none-ls-extras.nvim", }, config = function() local null_ls = require("null-ls") null_ls.setup({ sources = { null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.prettier, require("none-ls.diagnostics.eslint_d") }, }) vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {}) end, }
score: 9
type: Answer
downvote count: 1

global
tag name: global
type: Tag
tags question: http://stackoverflow.com/q/78095099

http://stackoverflow.com/comment/137664482
type: Comment
has text: @ESkri when I did dump, a and b, a was sometimes superior of INT_MAX
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78087883

http://stackoverflow.com/q/78052804
tagged with: lua
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78053214
tagged with: curl
has title: In the Android app "Lua Interpreter" I want to extract wiki text on demand
score: 0
answer count: 1
has body: In the Android app "Lua Interpreter" I want to extract wiki text on demand. I'm going to use the additional system command "curl". curl -s "https://uk.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&exintro&explaintext&titles=%D0%91%D0%B0%D1%80%D0%B0%D1%85%D1%82%D0%B8" > "/storage/emulated/0/iGO_Pal/save/wiki_data.lua" It works in TerMux" for Android successfully. Only one thing: the target file must exist!! Request https://uk.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&exintro&explaintext&titles=%D0%91%D0%B0%D1%80%D0%B0%D1%85%D1%82%D0%B8 successful in the browser. If I try to use this request os.execute('curl -s "https://uk.wikipedia.org/w/api.php?action=query&format=json&prop=extracts&exintro&explaintext&titles=%D0%91%D0%B0%D1%80%D0%B0%D1%85%D1%82%D0%B8" > "/storage/emulated/0/iGO_Pal/save/wiki_data.lua"') in the Lua interpreter - nothing happens. The file is just empty. All necessary permissions are in the Lua interpreter! What could be the problem?
type: Question

http://stackoverflow.com/comment/137668731
type: AnswerComment
comment on: http://stackoverflow.com/a/78070873
score: 0
type: Comment
has text: 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 '\\'.

http://stackoverflow.com/comment/137616824
score: 0
type: QuestionComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/78056160

2d
type: Tag
tags question: http://stackoverflow.com/q/78135524
tag name: 2d

http://stackoverflow.com/a/78068183
has comment: http://stackoverflow.com/comment/137628141
has comment: http://stackoverflow.com/comment/137628327
upvote count: 1
has comment: http://stackoverflow.com/comment/137628270
has body: 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 MOVED or a CROSSSLOT error. The function doesn't need any keys, but some args. 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 FCALL 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. 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 Hash Tags 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.
has comment: http://stackoverflow.com/comment/137628521
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78068038
score: 1
answers question: http://stackoverflow.com/q/78068038
has comment: http://stackoverflow.com/comment/137628185

http://stackoverflow.com/q/78014625
tagged with: lua
tagged with: roblox
has answer: http://stackoverflow.com/a/78015580
answer count: 1
type: UnansweredQuestion
has title: How do I make this function go to Players instead of Workspace
has body: The thing I'm trying to do here is that when the player touches this randomly spawning ball it adds to his leaderstats score. local spawned = 0 while true do if spawned >= 5 then break end local Randombumber1 = math.random(1, 30) local Randombumber2 = math.random(1, 30) spawned = spawned + 1 wait(3) local PointBall = Instance.new("Part", workspace) PointBall.Size = Vector3.new(1,1,1) PointBall.BrickColor = BrickColor.new("White") PointBall.Material = "Neon" PointBall.Shape = Enum.PartType.Ball -- Makes it a sphere PointBall.Anchored = true -- Anchors the part so it doesn't move PointBall.CanCollide = false -- Makes it so that players can walk through the ball PointBall.Position = Vector3.new(Randombumber1,3,Randombumber2) PointBall.Touched:Connect(function(player) local PlayerPoints = player.Parent.leaderstats.Dookie PlayerPoints.Value = PlayerPoints.Value + 1 PointBall:Destroy() end) end The error message is leaderstats is not a valid member of Model "Workspace.ASWXDYC2" I want it to go to the player in the Players thing, any idea on how to fix this?
score: 0
type: Question

http://stackoverflow.com/comment/137617521
type: Comment
type: AnswerComment
score: 0
has text: great explanation, appreciate :)
comment on: http://stackoverflow.com/a/78061868

http://stackoverflow.com/comment/137513869
score: 0
type: Comment
has text: 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.
type: AnswerComment
comment on: http://stackoverflow.com/a/78002136

http://stackoverflow.com/q/78041511
type: Question
tagged with: python
has title: sending multible inputs to lua-script with subprocess
tagged with: lua
has body: I have a lua script which takes multiple inputs and I now want to run this lua script from a python program. I used a subprocess to run the lua script and it works fine with one input. python code: import subprocess as sp input_data: int = 5 p = sp.Popen(["lua-5.4.2\\lua54.exe", "test.lua"], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE, text=True) result: str = p.communicate(input=str(input_data))[0] Lua file: local input = io.read() local output = input * 10 print(output) I now want to send multiple inputs to this lua script to do something like this: import subprocess as sp input_data_1: int = 5 input_data_2: int = 6 p = sp.Popen(["lua-5.4.2\\lua54.exe", "test.lua"], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE, text=True) result: str = p.communicate(input=[str(input_data_1), str(input_data_2)[0] local input_1 = io.read() local input_2 = io.read() local output = input_1 * input_2 print(output) The problem is that the input of p.communicate() only takes strings. 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. data = [5, 6] data_str = (str(data).replace("'", "") .replace(",", "") .replace("[", "") .replace("]", "")) p = sp.Popen(["lua-5.4.2\\lua54.exe", "test.lua"], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE, text=True) result = p.communicate(input=data_str)[0] How can I do this better?
answer count: 1
has answer: http://stackoverflow.com/a/78045893
accepted answer: http://stackoverflow.com/a/78045893
score: 0
type: AnsweredQuestion

http://stackoverflow.com/a/78096648
has body: --workspace.StreamingEnabled=false
score: 0
answers question: http://stackoverflow.com/q/78095935
type: Answer
has comment: http://stackoverflow.com/comment/138134331

http://stackoverflow.com/comment/137757156
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78139533
has text: So those are upvalues! ♂Ahhh♂, thank you so much, Mister!

http://stackoverflow.com/comment/137767070
type: Comment
score: 0
type: QuestionComment
has text: 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?
comment on: http://stackoverflow.com/q/78143358

http://stackoverflow.com/a/78651655
has body: You can just use QBCore.Functions.GetPlayerData().citizenid client-side, to get the citizenid of the player
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78111131
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78111131

http://stackoverflow.com/comment/137471397
score: 0
type: QuestionComment
has text: Heyo, how are you getting the variables for hours, minutes, and seconds? Is there anything more to your code sample?
type: Comment
comment on: http://stackoverflow.com/q/77977304

http://stackoverflow.com/q/78113574
has comment: http://stackoverflow.com/comment/137711378
tagged with: logitech-gaming-software
has comment: http://stackoverflow.com/comment/137711407
has body: EnablePrimaryMouseButtonEvents(true); function OnEvent(event, arg) if IsKeyLockOn("numlock" )then if IsMouseButtonPressed(1) then Sleep(50) MoveMouseRelative(0, 1) Sleep(100) MoveMouseRelative(0, 16) Sleep(100) MoveMouseRelative(0, 26) Sleep(100) MoveMouseRelative(-2, 25) Sleep(100) MoveMouseRelative(10, 28) Sleep(100) MoveMouseRelative(8, 25) Sleep(100) MoveMouseRelative(10, 15) Sleep(100) MoveMouseRelative(-14, 15) Sleep(100) MoveMouseRelative(-34, -1) Sleep(100) MoveMouseRelative(-18, 0) Sleep(100) MoveMouseRelative(10, 10) Sleep(100) MoveMouseRelative(-13, 5) Sleep(100) MoveMouseRelative(-20, -5) Sleep(100) end coroutine.resume(cor) repeat Sleep(100) coroutine.resume(cor) until not IsMouseButtonPressed(1) end end 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. 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. Thanks
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137711555
answer count: 0
score: 0
has title: loop is not repeating and won't stop
type: Question
tagged with: lua

http://stackoverflow.com/comment/137679340
type: Comment
has text: Why are you requiring `love` at all? `love` will be present in `main.lua`, you don't need to require it.
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/78095099

http://stackoverflow.com/comment/137665746
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78087883
has text: @ESkri i've added one more important edit
type: Comment

http://stackoverflow.com/q/78068802
answer count: 1
type: AnsweredQuestion
tagged with: sdk
score: 0
accepted answer: http://stackoverflow.com/a/78070873
type: Question
tagged with: lightroom
has answer: http://stackoverflow.com/a/78070873
tagged with: lua
has body: I’m porting my lightroom plugin to Windows. On MacOSX everything works perfect. 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. cmdRunExifTool = string.format('cd "'..NewTargetDir..'" && '.._PLUGIN.path..'\\bin\\win\\exiftool.exe '..(optionOverwrite or "")..' optionAppend=".\\C+F-'..NewJson..'" .') LrTasks.execute(cmdRunExifTool) I have added a pop-up window with the command and it show me this: cd "c:\Users\patri\Pictures\TEST-IMAGES\FF690-KTMX-000869\_scans\positives\C+F_exiftool" && c:\Users\patri\Documents\AnalogeFotografie.lrplugin\bin\win\exiftool.exe optionAppend=".\C+F-mybeelden" . But nothing happens. If I run this on the command line it works !
has title: Lua execute windows command in Lightroom SDK
has comment: http://stackoverflow.com/comment/137630323

jupyter-notebook
type: Tag
tag name: jupyter-notebook
tags question: http://stackoverflow.com/q/78058185

nul
tag name: nul
type: Tag
tags question: http://stackoverflow.com/q/78077926

http://stackoverflow.com/a/78057142
has body: Here is the issue: width_in_chars = "11", This must be a numeric value, not a string! Or even better: width = LrView.share 'labelWidth',
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/78053349
answers question: http://stackoverflow.com/q/78053349

http://stackoverflow.com/comment/137747402
has text: 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.
score: 0
comment on: http://stackoverflow.com/q/78132049
type: QuestionComment
type: Comment

http://stackoverflow.com/a/78137733
upvote count: 5
type: Answer
downvote count: 0
has body: After digging through the source code, I found that the option "@variable.builtin" is hardcoded to italic = true. Using the overrides configuration, this particular option can be given an italic = false option: require("kanagawa").setup({ commentStyle = { italic = false }, keywordStyle = { italic = false }, overrides = function() return { ["@variable.builtin"] = { italic = false }, } end }) I opened this issue in the repo with a suggested enhancement to make this configuration more obvious.
answers question: http://stackoverflow.com/q/78137732
score: 5

http://stackoverflow.com/q/78136904
accepted answer: http://stackoverflow.com/a/78149168
upvote count: 2
has body: I want to basically hide my tabs on the top of my terminal. I know I can do it using :set showtabline = 0 but I have to keep doing this everytime I start up neovim. I thought that I could set it up in the options.lua file as such: vim.opt.showtabline = 0 But it doesn't work. I even tried using .vimrc (which doesn't work as well) and I also symlink it to .nvimrc which also doesn't work. How can I apply this permanently or at least on neovim startup? Note that I'm using LazyVim.
score: 2
tagged with: lua
downvote count: 0
type: AnsweredQuestion
answer count: 1
has title: How to set configurations for my neovim in my lazyvim folder?
tagged with: neovim
favorite count: 0
has answer: http://stackoverflow.com/a/78149168
type: Question

code-snippets
type: Tag
tag name: code-snippets
tags question: http://stackoverflow.com/q/78050459
tags question: http://stackoverflow.com/q/78298729
tags question: http://stackoverflow.com/q/78188829
tags question: http://stackoverflow.com/q/78341564

http://stackoverflow.com/comment/137502184
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/77994757
type: Comment
has text: Where are your LocalScripts located?

http://stackoverflow.com/comment/137540110
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/78015580
type: Comment
score: 1

http://stackoverflow.com/comment/137543303
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/77997811
has text: @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.
type: Comment

http://stackoverflow.com/comment/137519678
type: QuestionComment
comment on: http://stackoverflow.com/q/77997811
has text: @koyaanisqatsi - even `math.random(-4, -2)` works correctly for me.
score: 1
type: Comment

http://stackoverflow.com/q/78129002
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137741555
has body: 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. 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. 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): -- Point intercept(Point const &amp;shooter, double bullet_speed, Point const &amp;target, Vector const &amp;target_velocity) -- { -- double a = bullet_speed*bullet_speed - target_velocity.dot(target_velocity); -- double b = -2*target_velocity.dot(target-shooter); -- double c = -(target-shooter).dot(target-shooter); -- return target+largest_root_of_quadratic_equation(a,b,c)*target_velocity; -- } local targetMINUSInterceptor = TVF.VecSubtract(interceptorVec3Point, targetVec3Point) local targetVelocityDotProduct = TVF.VecDot(targetVelocityAsVec3, targetVelocityAsVec3) local a = interceptorSpeedAsNumber * interceptorSpeedAsNumber - targetVelocityDotProduct local b = -2 * TVF.VecDot(targetVelocityAsVec3, targetMINUSInterceptor) local c = -TVF.VecDot(targetMINUSInterceptor, targetMINUSInte…
tagged with: traffic-simulation
answer count: 0
has title: How to tell when calculating an Intercept Point between two moving objects, when it will never intercept?
score: 0
type: Question
has comment: http://stackoverflow.com/comment/137742972
tagged with: vector
tagged with: lua
has comment: http://stackoverflow.com/comment/137738649
tagged with: simulation
has comment: http://stackoverflow.com/comment/137740624
tagged with: linear-algebra

http://stackoverflow.com/comment/137711407
type: Comment
has text: Try to replace each `Sleep(100)` with `if not IsMouseButtonPressed(1) then return end; Sleep(100)`
comment on: http://stackoverflow.com/q/78113574
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137711378
type: Comment
comment on: http://stackoverflow.com/q/78113574
score: 0
type: QuestionComment
has text: Why `coroutine.resume(cor)` is here? BTW, coroutines are excluded from GHub implementtion.

http://stackoverflow.com/comment/138995375
score: 0
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/78102362
type: Comment

http://stackoverflow.com/comment/137470115
has text: you need to specify the "sqlite" library
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/77977460

http://stackoverflow.com/comment/137791905
has text: 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.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78131855
type: Comment

http://stackoverflow.com/comment/137664529
score: 0
type: QuestionComment
has text: OK the linked implementation handles the 128-bit (and apparently 130-bit) numbers itself with multiple chunks
comment on: http://stackoverflow.com/q/78087883
type: Comment

http://stackoverflow.com/q/78102362
has body: 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. local teamsFolder = game:GetService("Teams") game.Players.PlayerAdded:Connect(function(player) local team = Instance.new("Team") team.Name = player.Name team.Parent = teamsFolder team.AutoAssignable = false player.Team = team end) I also tried to replace 9 line for player.Team = teamsFolder[player.Name] but it also doesn't work.
type: AnsweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/138995375
score: 0
accepted answer: http://stackoverflow.com/a/78102825
type: Question
has answer: http://stackoverflow.com/a/78102825
tagged with: lua
has title: Why my Roblox script doesn't work correctly
tagged with: roblox
tagged with: roblox-studio

http://stackoverflow.com/comment/137664611
type: Comment
has text: @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.
comment on: http://stackoverflow.com/q/78087883
score: 0
type: QuestionComment

wpa-supplicant
tags question: http://stackoverflow.com/q/78062261
tag name: wpa-supplicant
type: Tag

http://stackoverflow.com/comment/137790617
comment on: http://stackoverflow.com/q/78143358
type: Comment
score: 0
type: QuestionComment
has text: Is the problem disappears when you remove (disable) the Lua script? Is the problem disappears when you comment the line `MoveMouseRelative(0,1)` ?

http://stackoverflow.com/comment/137628141
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/78068183
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137768826
comment on: http://stackoverflow.com/q/78143839
type: QuestionComment
score: 0
has text: Does this answer your question? [Weighted random numbers](https://stackoverflow.com/questions/1761626/weighted-random-numbers)
type: Comment

http://stackoverflow.com/a/78045893
accepted answer of: http://stackoverflow.com/q/78041511
answers question: http://stackoverflow.com/q/78041511
type: AcceptedAnswer
type: Answer
has body: If you just want to send some numbers or strings, you can join them with line feed, then use lua's n or l flag to read these data. p.communicate(input="5\n6.5\nhello\n7") local input_1 = io.read('n') --5 local input_2 = io.read('n') --6.5 io.read('l') --'n' doesn't feed the '\n' after 6.5 local input_3 = io.read('l') --hello local input_4 = io.read('n') --7 If you want to send complicated data, you can use python's struct + base64 modules for encoding and use lua's string.unpack function + base64 module 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: input_data = struct.pack('<ii', input_data_1, input_data_2) input_data = base64.standard_b64encode(input_data).decode() # .... result: str = p.communicate(input=input_data)[0] local base64 = require'base64' local input = io.read('a') input = base64.decode(input) local input_1, input_2 = string.unpack('<ii', input) Using json could be another option, but the same lua does not natively support it, you still need an external module.
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/q/78074908
tagged with: redis
type: UnansweredQuestion
favorite count: 0
tagged with: redis-cluster
upvote count: 1
has body: 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.
has title: Get Lua function definition stored in Redis
type: Question
score: 1
downvote count: 0
tagged with: lua
answer count: 0

http://stackoverflow.com/comment/137786130
type: QuestionComment
comment on: http://stackoverflow.com/q/78143358
score: 0
type: Comment
has text: @ESkri ONLY in that game, it works fine in other apps

http://stackoverflow.com/comment/137738194
has text: I do not see a problem here, this ought to work. Please provide more context, maybe this reveals the cause.
comment on: http://stackoverflow.com/q/78126689
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/137711555
type: Comment
has text: removed the coroutine, replaced all the lines, added repeat on the top and everything working perfectly now, super thanks :)
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78113574

http://stackoverflow.com/comment/137710291
type: Comment
comment on: http://stackoverflow.com/q/78112697
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/a/78154227
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78143839
has body: I have also thought about using a bell curve and cut it into symmetrical chunks Yes, the idea is correct. Just round the floating point value on the bell curve to the nearest integer rarity. The random generator formula is from here local function random_norm() return (-2 * math.log(math.random()))^.5 * math.cos(2 * math.pi * math.random()) end -- luck = 0.001 makes "r1" the most probable, luck = 0.01 makes "r2", etc. local luck = 8.4 -- the more bell_shape_width_factor the bigger the probability to get other rarities local bell_shape_width_factor = 0.4 -- number from 0 to inf local central_rarity = 4 + math.log(luck)/math.log(10) print("central_rarity = "..central_rarity) for j = 1, 20 do local rarity repeat rarity = math.max(1, math.floor(central_rarity + random_norm() * bell_shape_width_factor + 0.5)) until 1/rarity ~= 0 -- skip inf values print("r"..rarity) end Output: central_rarity = 4.9242792860619 r6 r5 r5 r5 r4 r5 r5 r5 r5 r6 r5 r5 r5 r5 r5 r5 r5 r5 r4 r5

haskell
tags question: http://stackoverflow.com/q/78039187
tag name: haskell
type: Tag

http://stackoverflow.com/a/78091366
has body: Did you try adding luasnip to the sources table while setting up nvim-cmp. Check here for configuration template.
score: 0
answers question: http://stackoverflow.com/q/78050459
type: Answer

http://stackoverflow.com/comment/137664488
has text: @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)`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78087883
type: Comment

http://stackoverflow.com/comment/137469213
type: Comment
score: 1
comment on: http://stackoverflow.com/a/77975671
has text: 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.
type: AnswerComment

http://stackoverflow.com/comment/138638845
type: AnswerComment
score: 0
has text: 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: rm -r ~/.local/share/lvim/mason/packages/haskell-language-server
comment on: http://stackoverflow.com/a/78600853
type: Comment

http://stackoverflow.com/q/78068038
tagged with: redis
answer count: 1
has title: Access data structure on different master node from within a Redis function written in Lua
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78068183
tagged with: redis-cluster
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/78068183
has body: I've a Redis cluster v7.x with 3 masters, each having 1 slave. A function myFunction written in Lua scripting is loaded in all the 3 masters. The function doesn't need any keys, but some args. Is it possible for the function to access a data structure, e.g. a SortedSet which is stored on another master node? 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. 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.
tagged with: lua

http://stackoverflow.com/a/78136254
has comment: http://stackoverflow.com/comment/137759469
score: 4
accepted answer of: http://stackoverflow.com/q/78135524
has body: As I like to quote, "Lua gives you the power, you build the mechanisms". It is no different for OOP in Lua. This is probably what's leaving you confused. I want to use real OOP, like for example Java or C# have. I think this is the first misconception we need to eliminate: Java / C# OOP isn't "real" OOP. It is a particular implementation / variant of OOP called "class-based OOP" 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. 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. Metatables Consider the following snippet: local my_math = {tau = 2 * math.pi} ... print(my_math.pi) -- oops, nil! Suppose we want to throw an error if we try to access an absent field. We can't do that, right? Because . 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 get(my_math, "pi") or my_math.get"pi" or similar would be pretty verbose. No, we want to keep the concise my_math.pi notation, but we want to change what it does. Enter metatables: They let you do just this - change the behavior of t.name (technically, more generally the behavior of t[k]; t.name is just syntactic sugar for t["name"]). When you do t[k], Lua actually does the following work behind the scenes: Look up the value corresponding to key k in t. If this is not nil, t[k] evaluates to this value. Otherwise, look up the metatable. If no metatable is set, t[k] evaluates to nil. If there is a metatable, and this metatable has an __index field which stores a function f, call t[k] evaluates to f(t, k). This lets you customize what happens when absent keys are accessed! That's exactly what we want. my_math.tau should do nothing special, it should just give us the value of 2 pi. B…
upvote count: 4
has comment: http://stackoverflow.com/comment/137756425
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78135524

http://stackoverflow.com/comment/137740624
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78129002
has text: 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.
type: Comment

http://stackoverflow.com/q/77991625
type: Question
downvote count: 0
tagged with: lua
has body: I'm using LazyVim for my setup and in my options.lua I have both vim.opt.virtualedit = "block" and vim.opt.scrolloff = 999, because that's the way I like it. But yesterday this strange behavior started happening where in the middle of editing a file, my virtualedit and scrolloff options get unset. 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 set virtualedit? and set scrolloff?, I get virtualedit= and scrolloff=0, respectively. What the heck? 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? I can't find reference to any similar issues online. Currently, my workaround is a keybinding that calls :set vim.opt... to fix it on the fly. But sometimes this still doesn't work (I'll call :set vim.opt.scrolloff=999 and scrolloff won't change). When that happens, I exit nvim and re-open, and everything is back to how I want it.
has answer: http://stackoverflow.com/a/78695122
tagged with: neovim
upvote count: 1
answer count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
has title: Neovim scrolloff and virtualedit options randomly changing

http://stackoverflow.com/comment/137773244
type: Comment
has text: @ESkri You can notice, it kinda stucks when I look right and left while I am pressing mouse1.
comment on: http://stackoverflow.com/q/78143358
type: QuestionComment
score: 0

http://stackoverflow.com/comment/137750248
has text: If that's not it - show what do you see when you run the code above...
comment on: http://stackoverflow.com/q/78132049
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78030599
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
has body: As you figured out already, this snippet for index, value in ipairs(test) do if value.deleted then table.remove(test, index) end end is doing the grave mistake of removing table elements - shifting subsequent elements down - while iterating a table. for index, value in ipairs(test) do end is roughly equivalent to do local index = 0 while true do index = index + 1 local value = test[index] if value == nil then break end end end So of course if does a table.remove(test, index), then in the next iteration test[index] will be the previous test[index+1] and you will skip an element. I would suggest "filtering" test, and building a new table containing only the elements you want to keep. This would look as follows: local test_filtered = {} for index, value in ipairs(test) do if not value.deleted then table.insert(test_filtered, value) end end for _, value in ipairs(test_filtered) do print(value.id) print(value.deleted) end This is asymptotically optimal runtime-wise (linear time). Very often it's cleaner to not mutate the original table; that can lead to surprises. In case you really want to modify test, you could iterate in reverse order, e.g. using for i = #test, 1, -1 do. Then table.remove will work fine. But be warned that this has a time complexity bound of O(n²). By keeping a second index you can also do in-place bulk removal of elements in O(n). Also: Why do you use a "list" here at all? Assuming that you don't care about order, a "hash table" (which lets you remove elements while iterating) would make more sense, given that you have IDs. Consider test = { [473385593] = {deleted = true}, [473385619] = {deleted = true}, [473432275] = {deleted = false}, [473786710] = {deleted = false}, } then you could just do for id, value in pairs(test) do if value.deleted then test[id] = nil end end
accepted answer of: http://stackoverflow.com/q/78030461
answers question: http://stackoverflow.com/q/78030461

http://stackoverflow.com/comment/137628327
comment on: http://stackoverflow.com/a/78068183
score: 1
type: Comment
type: AnswerComment
has text: 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

http://stackoverflow.com/a/78110829
score: 15
upvote count: 15
has body: This is probably a consequence of the changes announced here: https://github.com/nvimtools/none-ls.nvim/discussions/81. You can get the code actions/diagnostics for eslint_d from none-ls-extras (don't forget to add this dependency to your null-ls installation). Your config should be updated to something similar to this: local null_ls = require("null-ls") null_ls.setup { sources = { require("none-ls.diagnostics.eslint_d"), ... } }
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78108133
type: Answer
answers question: http://stackoverflow.com/q/78108133

http://stackoverflow.com/a/78062329
type: Answer
has body: Thanks, quite stupid of me. It was the only one. The reason for using this was for alignment. Going to open a bug ticket at Adobe, On MacOSX it works, but should not.
answers question: http://stackoverflow.com/q/78053349
score: 0

http://stackoverflow.com/comment/137664439
type: Comment
has text: Don't you need arithmetic modulo 2^128 for poly1305? You could represent numbers as several chunks of 32 bits
type: QuestionComment
comment on: http://stackoverflow.com/q/78087883
score: 0

http://stackoverflow.com/comment/137762480
type: QuestionComment
comment on: http://stackoverflow.com/q/78139158
type: Comment
score: 0
has text: "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.

var
type: Tag
tags question: http://stackoverflow.com/q/78095099
tag name: var

http://stackoverflow.com/comment/137710666
comment on: http://stackoverflow.com/a/78113125
score: 0
has text: I tried this. However, 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.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/137640817
has text: 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
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78075230
type: QuestionComment

http://stackoverflow.com/comment/137488583
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/77988153
has text: By default every TCP socket has a socket send buffer.
type: Comment

http://stackoverflow.com/comment/137670275
type: Comment
has text: In a hypothetical example line? either # or text.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78090720

http://stackoverflow.com/a/77965747
answers question: http://stackoverflow.com/q/77965624
type: Answer
has body: Surround the literal with parentheses: print(("%d"):format(("%d"):byte(1)))
upvote count: 4
score: 4
downvote count: 0

http://stackoverflow.com/comment/137741555
comment on: http://stackoverflow.com/q/78129002
has text: 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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137616934
type: Comment
comment on: http://stackoverflow.com/q/78056160
has text: I think I am thinking about it the wrong way - looks like the filter can 'divert' matched output - using "pandoc.pipe" mechanism. Or 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
type: QuestionComment
score: 0

http://stackoverflow.com/comment/137764086
type: Comment
has text: What line would you expect to move in the X axis?
comment on: http://stackoverflow.com/q/78143358
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137738649
type: Comment
has text: 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.)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78129002

memory
tag name: memory
type: Tag
tags question: http://stackoverflow.com/q/78139158
tags question: http://stackoverflow.com/q/78274204

http://stackoverflow.com/comment/137670724
type: QuestionComment
comment on: http://stackoverflow.com/q/78063469
has text: Where do you have an end comment tag?
type: Comment
score: 0

http://stackoverflow.com/comment/137691243
type: AnswerComment
score: 1
type: Comment
has text: Albert's solution that really works for me is posted here: https://github.com/jgm/pandoc/discussions/9514
comment on: http://stackoverflow.com/a/78092591

http://stackoverflow.com/a/78108609
answers question: http://stackoverflow.com/q/78062261
score: 0
has comment: http://stackoverflow.com/comment/137733364
type: Answer
has body: The best approach is to not restart wpa_supplicant all the time, but instead use wpa_cli to dynamically reconfigure it. wpa_cli connects to a socket that wpa_supplicant listens on - instead of using wpa_cli, you can also connect to this socket directly from your Lua code. That gives you a bit more flexibility. To be able to use either wpa_cli or the sockets, you need to enable this during the build. Use the Buildroot option BR2_PACKAGE_WPA_SUPPLICANT_CLI for this (it automatically enables BR2_PACKAGE_WPA_SUPPLICANT_CTRL_IFACE which is what you need to listen on the socket).

http://stackoverflow.com/a/78002136
has body: You're running the Lua based function with print(), which doesn't exist since Redis Lua implementation is sandboxed. You can simply fix this by replacing print with redis.log to log the message you're trying to call.
upvote count: 1
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/78001723
type: Answer
has comment: http://stackoverflow.com/comment/137513869
score: 1
accepted answer of: http://stackoverflow.com/q/78001723

http://stackoverflow.com/q/78050459
tagged with: code-snippets
score: 2
tagged with: neovim
downvote count: 0
type: UnansweredQuestion
has body: I'm working on setting up my Neovim configuration for development, specifically focusing on integrating nvim-cmp for autocompletion and LuaSnip for snippet support. However, I'm encountering an issue where the Tab key does expand snippets as expected. Environment: Neovim version: [Your Neovim version] Relevant plugins: nvim-cmp LuaSnip lsp-zero Mason for automatic LSP server installation Current Configuration: I've set up nvim-cmp and LuaSnip in my lsp.lua configuration file. Here's the relevant part of my setup: local lsp = require("lsp-zero") lsp.preset("recommended") lsp.ensure_installed({ 'gopls', }) local cmp = require('cmp') local cmp_select = {behavior = cmp.SelectBehavior.Select} local cmp_mappings = lsp.defaults.cmp_mappings({ ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), ['<C-y>'] = cmp.mapping.confirm({ select = true }), ['<Return>'] = cmp.mapping.confirm({ select = true }), ["<C-Space>"] = cmp.mapping.complete(), }) cmp_mappings['<Tab>'] = cmp.mapping.select_next_item(cmp_select) cmp_mappings['<S-Tab>'] = cmp.mapping.select_prev_item(cmp_select) lsp.setup_nvim_cmp({ mapping = cmp_mappings }) lsp.set_preferences({ suggest_lsp_servers = true, sign_icons = { error = 'E', warn = 'W', hint = 'H', info = 'I' } }) lsp.on_attach(function(client, bufnr) local opts = {buffer = bufnr, remap = false} vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts) vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts) vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts) vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() …
has title: Neovim nvim-cmp and LuaSnip: Tab Key Not Navigating Completion Menu or Expanding Snippets
answer count: 1
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/78091366
type: Question
tagged with: lua

http://stackoverflow.com/comment/137470888
type: Comment
comment on: http://stackoverflow.com/a/77977772
score: 0
has text: @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
type: AnswerComment

http://stackoverflow.com/comment/137503297
comment on: http://stackoverflow.com/q/77994757
type: Comment
score: 0
has text: Both are in screenguis, different ones because the sender bis in an admin only gui and the receiver is in a announcement gui
type: QuestionComment

http://stackoverflow.com/comment/137664873
has text: 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
score: 0
comment on: http://stackoverflow.com/q/78087883
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/137617991
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78056160
has text: that's quite a sophisticated example. I'll post something in an answer...

http://stackoverflow.com/comment/137771170
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78140323
type: Comment
has text: 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).

simulation
tags question: http://stackoverflow.com/q/78129002
tag name: simulation
type: Tag
tags question: http://stackoverflow.com/q/78359732

http://stackoverflow.com/a/78130284
has body: There's deceptively a lot going on here and this is really tougher than it should be... in your original map, :m '<-2<CR>gv=gv, 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 :, you will get '<,'> inserted automatically and you will lose the active visual selection. But '<,'> is a range that acts from the '< mark to the '> mark. (These are the "marks" it's referring to in the error message, which we’ll get to later). From :h '< and :h '>: '< < To the first line or character of the last selected Visual area in the current buffer. For block mode it may also be the last character in the first line (to be able to define the block). '> `> '> > To the last line or character of the last selected Visual area in the current buffer. For block mode it may also be the first character of the last line (to be able to define the block). Note that 'selection' applies, the position may be just after the Visual area. 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. gv=gv will activate the previous visual selection, format it, and then activate the selection again. Now that we've explained why the original works, we can move on to fixing your lua version. Part of the issue is that neither vim.cmd() nor the <Cmd> part of a keymap simulate the : keystroke in the same way that your regular vnoremap does, but rather they just execute the command. This is the same reason you don't have to manually enter the <CR>. As a result, we don’t get that range automatically added to our m command like we did before, meaning it will …
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/78104676
downvote count: 0
answers question: http://stackoverflow.com/q/78104676
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/137671924
type: Comment
has text: 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.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78090720

http://stackoverflow.com/comment/137737474
type: Comment
comment on: http://stackoverflow.com/q/78102682
type: QuestionComment
score: 0
has text: @Nifim Right, I've done that now and also changed the question title.

http://stackoverflow.com/comment/137618452
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78056160
has text: I actally got it working in lua :)

http://stackoverflow.com/comment/137677469
type: Comment
comment on: http://stackoverflow.com/q/78063469
type: QuestionComment
has text: 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.
score: 0

http://stackoverflow.com/a/78053214
score: 0
type: Answer
has body: The system can't find the path "/storage/emulated/0/iGO_Pal/save/wiki_data.lua" check the path or give storage permission to "curl". PS: "%D0%91%D0%B0%D1%80%D0%B0% D1%85%D1%82%D0%B8" - has an unnecessary space
answers question: http://stackoverflow.com/q/78052804

http://stackoverflow.com/comment/137468890
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/77975671
type: AnswerComment
score: 0

http://stackoverflow.com/comment/137628521
type: Comment
comment on: http://stackoverflow.com/a/78068183
type: AnswerComment
score: 0
has text: It worked with sorted set being passed as a key. Thanks!

haskell-language-server
type: Tag
tag name: haskell-language-server
tags question: http://stackoverflow.com/q/78039187

bit-manipulation
tag name: bit-manipulation
tags question: http://stackoverflow.com/q/78087883
type: Tag

http://stackoverflow.com/comment/137677818
has text: 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.
comment on: http://stackoverflow.com/q/78077926
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/137641679
has text: So I have created the string in single quotes, and then wrapped in double quotes (cmdlineQuote(). For being save in MacOSX I do the reverse ? the string in double quotes and then cmdlineQuote() single quote
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78070873

http://stackoverflow.com/comment/137666019
has text: So I can only assume that the bit representation of a double is leading to this incorrect result
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78087883

http://stackoverflow.com/q/78140309
type: Question
has body: 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. 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.
score: 0
tagged with: lua
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78191301
tagged with: linden-scripting-language
answer count: 1
has title: Making an Agent touch an Object in Second Life

buildroot
tags question: http://stackoverflow.com/q/78062261
tag name: buildroot
type: Tag

http://stackoverflow.com/comment/137710243
type: Comment
comment on: http://stackoverflow.com/q/78112697
type: QuestionComment
score: 0
has text: @Dai I try to proceed to the next line, but I don't know what it means. :(

http://stackoverflow.com/comment/137756316
type: Comment
comment on: http://stackoverflow.com/q/78139158
has text: Why do you think it stil exists?
score: 3
type: QuestionComment

http://stackoverflow.com/comment/137692170
type: Comment
comment on: http://stackoverflow.com/q/78102682
score: 2
has text: 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).
type: QuestionComment

davinci-resolve
tag name: davinci-resolve
type: Tag
tags question: http://stackoverflow.com/q/77997811

http://stackoverflow.com/a/77975688
has body: You've run into a common issue with client-server replication. 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 does not replicate up to the server or to any other client. So the issue with your code is that the server has created the IntValue, genPetX, 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. So create a RemoteEvent in ReplicatedStorage specifically for updating the genPetX value, name it something like setX, and follow these steps... So in your main Script in ServerScriptService : local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") -- create the IntValues inside the Player when they join the game Players.PlayerAdded:Connect(function(player) local genX = Instance.new("IntValue", player) --actual player multiply by pets genX.Value = 10 genX.Name = "genPetX" -- create any other values here... end) -- listen for when a client signals that they have clicked on a pet ReplicatedStorage.click.OnServerEvent:Connect(function(player) local cpc = player.ClicksPerClick.Value local gpx = player.genPetX.Value player.leaderstats.Clicks.Value += cpc * gpx end) -- listen for when a client tells you to update the `genPetX` value, the client will tell you the amount ReplicatedStorage.setX.OnServerEvent:Connect(function(player, amount) assert(type(amount) == "number") player.genPetX.Value += amount end) Then, in your Label's LocalScript : local localplayer = game.Players.LocalPlayer local genPetX = localplayer.genPetX local label = localplayer.PlayerGui.ScreenGui.xPet label.Text = tostring(genPetX.Value) -- keep the label constantly updated with chang…
answers question: http://stackoverflow.com/q/77963271
score: 0
type: Answer

http://stackoverflow.com/a/78136288
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/78132049
answers question: http://stackoverflow.com/q/78132049
has body: 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 wxEVT_PAINT and draw a centered rectangle in your handler. 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. Not really related to your question, but: There is no need to call SetAutoLayout(true), this is the default. It's confusing to use both wxGROW and wxEXPAND in the same code, they're synonyms and mean exactly the same thing.

eslint
tags question: http://stackoverflow.com/q/78108133
type: Tag
tag name: eslint
tags question: http://stackoverflow.com/q/78150730

http://stackoverflow.com/comment/137764126
has text: @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.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78143358
score: 0

http://stackoverflow.com/comment/137664557
has text: @harold what does that imply ?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78087883

obfuscation
tag name: obfuscation
tags question: http://stackoverflow.com/q/78112697
type: Tag

http://stackoverflow.com/comment/137473087
type: Comment
comment on: http://stackoverflow.com/a/77977772
score: 0
has text: 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, ?, ?, ?);`.
type: AnswerComment

wxwidgets
tags question: http://stackoverflow.com/q/78132049
type: Tag
tag name: wxwidgets
tags question: http://stackoverflow.com/q/78154763

http://stackoverflow.com/a/78109682
has body: The array part of a table has a length defined by the first non-nil entry in the array. If t[1] is nil (and it is), then the length of the array is 0. It doesn't matter if t[3] is non-nil; that's considered just a key that happens to be an integer. If you don't give unpack a size, it works based on the size of the array part of a table. But you can give unpack a size (more specifically, a start/end range), so you should do that. prev_qualifier, this_qualifier, bare_placetype = unpack(t, 1, 3)
answers question: http://stackoverflow.com/q/78109630
score: 0
type: Answer
downvote count: 1
upvote count: 1

datagram
tag name: datagram
tags question: http://stackoverflow.com/q/77986782
type: Tag

http://stackoverflow.com/comment/137673706
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78092591
has text: @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.
type: AnswerComment

http://stackoverflow.com/comment/137665664
score: 0
type: QuestionComment
has text: 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?
comment on: http://stackoverflow.com/q/78087883
type: Comment

http://stackoverflow.com/a/78102825
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/78102362
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/78102362
has body: Each new Team needs a unique TeamColor: local teamsFolder,tab=game:GetService("Teams"),{} game.Players.PlayerAdded:Connect(function(player) local team,teamcolor=Instance.new("Team"),nil team.Name,team.AutoAssignable=player.Name,false repeat teamcolor=BrickColor.random() until not table.find(tab,teamcolor) table.insert(tab,teamcolor) team.TeamColor,team.Parent=teamcolor,teamsFolder player.Team=team end) game.Players.PlayerRemoving:Connect(function(player) table.remove(tab,table.find(tab,player.TeamColor)) teamsFolder[player.Name]:Remove() end)

http://stackoverflow.com/comment/137668228
has text: 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)
type: Comment
comment on: http://stackoverflow.com/q/78087883
score: 0
type: QuestionComment

wxlua
tag name: wxlua
tags question: http://stackoverflow.com/q/78132049
type: Tag

luadoc
type: Tag
tags question: http://stackoverflow.com/q/78129944
tag name: luadoc

http://stackoverflow.com/comment/137673467
has text: 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
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78092591

http://stackoverflow.com/comment/137466391
score: 1
type: Comment
has text: `Pawn:new` is implemented with mistakes. Post its code please.
comment on: http://stackoverflow.com/q/77974071
type: QuestionComment

local
tag name: local
type: Tag
tags question: http://stackoverflow.com/q/78139158

meta-method
tag name: meta-method
type: Tag
tags question: http://stackoverflow.com/q/77974971
tags question: http://stackoverflow.com/q/78767348

http://stackoverflow.com/comment/137664639
comment on: http://stackoverflow.com/q/78087883
type: Comment
score: 0
has text: 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.
type: QuestionComment

types
tags question: http://stackoverflow.com/q/78111131
type: Tag
tag name: types

abstract-syntax-tree
tags question: http://stackoverflow.com/q/78056160
tag name: abstract-syntax-tree
type: Tag

linden-scripting-language
tags question: http://stackoverflow.com/q/78140309
tag name: linden-scripting-language
type: Tag

http://stackoverflow.com/comment/138006949
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78274946
type: AnswerComment
has text: 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.

http://stackoverflow.com/q/78243678
score: 3
type: AnsweredQuestion
answer count: 1
has comment: http://stackoverflow.com/comment/137942464
tagged with: unsigned-integer
tagged with: lua-5.4
has answer: http://stackoverflow.com/a/78244054
type: Question
accepted answer: http://stackoverflow.com/a/78244054
tagged with: lua
has body: I'm reading "Programming in Lua, Forth Edition", 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: > x = 13835058055282163712 -- 3ul << 62ul > x --> -4611686018427387904 But if I do that in Lua 5.4, Windows x64, or Lua 5.3, WSL x64, they both behave like this: > x = 13835058055282163712 > x 1.3835058055282e+19 > math.type(x) float So, I have 2 questions: Why does "the book" about learning Lua 5.3, shows examples not matching actual Lua implementations? Is that due to some later update to the language? Is there a work-around? How to I write large "unsigned integers" in decimal, without them being turned into floats?
upvote count: 3
downvote count: 0
has title: 64 unsigned integers in Lua 5.3/5.4 do not behave like in "Programming in Lua"
favorite count: 0

http://stackoverflow.com/a/78214956
type: Answer
answers question: http://stackoverflow.com/q/78213846
score: 0
has comment: http://stackoverflow.com/comment/137890792
has comment: http://stackoverflow.com/comment/137891002
has body: Make your own match function, but: Take the string and replace all odd letters as å to a. Than match this new string, not the old one. Replace Accented Characters in string to standard with LUA

http://stackoverflow.com/comment/138041191
score: 0
type: Comment
type: QuestionComment
has text: @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.
comment on: http://stackoverflow.com/q/78292293

http://stackoverflow.com/comment/137846516
score: 0
type: AnswerComment
has text: 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
type: Comment
comment on: http://stackoverflow.com/a/78173900

http://stackoverflow.com/comment/137891220
comment on: http://stackoverflow.com/a/78214900
has text: 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 `ß-ÿ`
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/78257530
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78254595
score: 1
has body: You can use Transform data feature to Filter by name transformation to keep only the price field.
downvote count: 0
answers question: http://stackoverflow.com/q/78254595
type: AcceptedAnswer

http://stackoverflow.com/comment/137900197
has text: Tables with keys do not have an order, you would need an array.
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/78219171

http://stackoverflow.com/q/78173715
tagged with: lua
type: Question
upvote count: 1
type: UnansweredQuestion
tagged with: neovim
downvote count: 0
score: 1
has body: i use vim-auto-save for vim and autosave.nvim for neovim, i set both to save only in InsertLeave but in insert mode, when i press Enter within a pair of braces {}, (), [], to insert a newline, the plugin saves the file automatically, and i prevent this using: autocmd TextChanged,TextChangedI <buffer> silent noautocmd in my .vimrc and tried to apply the same to init.lua using vim.cmd: vim.cmd("autocmd TextChanged,TextChangedI <buffer> silent noautocmd") but this doesn't work
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/78173900
has title: prevent nvim unwanted TextChanged events in lua

http://stackoverflow.com/q/78301093
has answer: http://stackoverflow.com/a/78302551
tagged with: lua
score: 2
downvote count: 0
has title: Is there a way to split a string and preserve spaces in lua?
type: AnsweredQuestion
tagged with: neovim
answer count: 1
has body: I have a table with strings like " item", " item". 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.
accepted answer: http://stackoverflow.com/a/78302551
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/138044949

http://stackoverflow.com/q/78160089
tagged with: lua-c++-connection
has answer: http://stackoverflow.com/a/78160572
upvote count: 2
type: AnsweredQuestion
favorite count: 0
has title: Lua table created in C returns strange values for integers
type: Question
has comment: http://stackoverflow.com/comment/137793859
answer count: 1
has body: I want to create a nested table, that shall look like this: { SA_1: {1,2,3,4}, SA_2: {11,22,33,44} } The code I have (I changed the SA_2 to strings for testing purposes): int myRegisteredCfunc: { lua_createtable(L, 0, 2); // Create the first inner table lua_createtable(L, 0, 4); for (int i = 1; i < 5; ++i) { lua_pushinteger(L, i); // Push the corresponding value lua_rawseti(L, -2, i); // Set the value at the index } // Set the first inner table as a field of the outer table lua_setfield(L, -2, "SA_1"); // Create the second inner table char test_str[20]; lua_createtable(L, 0, 4); for (int i = 1; i < 5; ++i) { sprintf(test_str, "str %d",i); lua_pushstring(L, test_str); // Push the corresponding value lua_rawseti(L, -2, i); // Set the value at the index } // Set the second inner table as a field of the outer table lua_setfield(L, -2, "SA2_2"); return 1 } However, the output I get is: SA_1 (table): 4: 3 1: 4 2: 3 3: 3 SA_2 (table): 4: str 4 1: str 1 2: str 2 3: str 3 The values for SA_1 are not set correctly. I do get 3 times number 3, instead of 1-4. The strange part is, the strings are actually printed correctly. This is my print function: local table = LIB.myRegisteredCfunc() local function print_table(tbl, indent) indent = indent or 0 local spaces = string.rep(" ", indent) for k, v in pairs(tbl) do if type(v) == "table" then print(spaces .. k .. " (table):") print_table(v, indent + 1) else print(spaces .. k .. ": " .. tostring(v)) end end end print_table(table)
downvote count: 0
accepted answer: http://stackoverflow.com/a/78160572
score: 2
tagged with: lua
linked to: http://stackoverflow.com/q/73741252
tagged with: lua-table
has comment: http://stackoverflow.com/comment/137793755

http://stackoverflow.com/q/78213846
linked to: http://stackoverflow.com/q/50459102
type: UnansweredQuestion
has title: Matching multi-language (latin extended) characters in lua
answer count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/137889140
tagged with: pattern-matching
type: Question
has comment: http://stackoverflow.com/comment/137897880
score: 3
has comment: http://stackoverflow.com/comment/137897449
has body: I'm unable to find a way to match all extended alphabet characters without doing so explicitly. For example, matching the tag språk. tag = "språk" tag:match(%w+) This doesn't work because å is not contained within %w. This can be matched with tag:match([[[%wå]+]]), but then you have to explicitly add all special. One can also extend the range. This works tag:match([[[a-å]+]]), but I'm not 100% clear on why, or at least not where that range actually covers in the character table. So what is the correct way to match a range that includes all ascii plus all latin extended? The best solution I've come up with so far is: tag = "språk" tag:match([[[a-zA-ZÀ-ÿ]+]]) 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.
has answer: http://stackoverflow.com/a/78214900
tagged with: lua
has answer: http://stackoverflow.com/a/78214956
tagged with: character-encoding
upvote count: 3
downvote count: 0

http://stackoverflow.com/q/78214820
tagged with: geometry
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/78216720
answer count: 1
type: Question
downvote count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/78216720
tagged with: trigonometry
has title: Get third control point quadratic Bezier curve for parabola with given fucus and directrix, Lua
upvote count: 1
has body: 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) The curve is limited by points A (ax, ay) and B (bx, by). I need to find the third control point C (cx, cy) as here: https://en.m.wikipedia.org/wiki/File:Quadratic_Bezier_parabola_equivalence.svg or https://en.wikipedia.org/wiki/File:Relationship_between_parabola_and_quadratic_Bezier.svg function getBezierControlPoint_focus_directrix(fx, fy, ax, ay, bx, by) -- (x-h)^2=4*p*(y-k) if (ay == by) then -- exception: horizontal AB local k = (fy + dirY) / 2 local h = fx local cx = h local cy = ay + 2*(k-ay) return cx, cy -- it works perfect else -- [Axis direction](https://en.wikipedia.org/wiki/Parabola#Axis_direction) local h = fx local k = (fy + dirY) / 2 local cx = (ax+bx)/2 local f = (k-dirY)/2 -- vertex -- h = -b/(2*a) -- k = (4*a*c-b*b)/(4*a) local a = -1/(dirY-ay) local b = -2 * a * h local c = h * h * a + k print ('h', h, -b/(2*a)) -- ok, same print ('k', k, (4*a*c-b*b)/(4*a)) -- ok, same -- derivative value of parabola in point A (ax): local day = a*2*ax + b local cy = ay + day * (bx-ax)/2 return cx, cy -- not right, here is problem end end usage: three control points to draw parabola: controlPoints = {ax, ay, cx, cy, bx, by} Parabola as beach line, drawn with bezier-curve Update: https://www.desmos.com/calculator/joeugogi8b Ready function: function getBezierControlPoint (fx, fy, ax, bx) local function f(x) return (x*x-2*fx*x+fx*fx+fy*fy-dirY*dirY) / (2*(fy-dirY)) end local function df(x) return (x-fx) / (fy-dirY) end if (fy == dirY) then return end -- not parabola local ay, by = f(ax), f(bx) local ad, dx = df(ax), (bx-ax)/2 local cx, cy = ax+dx, ay+ad*dx return cx, cy end
tagged with: math
score: 1
favorite count: 0

http://stackoverflow.com/comment/137951596
type: QuestionComment
has text: Makes sense but now I get the same error for on_minute
comment on: http://stackoverflow.com/q/78245755
type: Comment
score: 0

http://stackoverflow.com/q/78194647
has comment: http://stackoverflow.com/comment/137888769
favorite count: 0
has comment: http://stackoverflow.com/comment/137861054
tagged with: indexing
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/78327654
linked to: http://stackoverflow.com/q/74434028
type: Question
has comment: http://stackoverflow.com/comment/137858816
tagged with: null
tagged with: roblox
downvote count: 0
has body: local hitTarg = hb(Vector3.new(4,6,4), character.PrimaryPart.CFrame * Cframe.new(0,0,-3) {character}, character) The error is "attempt to index nil with "PrimaryPart"" I can't find anything that can help me fix this And thank you in advance
tagged with: lua
type: UnansweredQuestion
has title: How to fix the "attempt to index nil with 'PrimaryPart'
score: 1

http://stackoverflow.com/q/78262424
type: UnansweredQuestion
score: 0
answer count: 0
tagged with: istio
has body: I am trying to send response to an express endpoint. It works when response doesn't have any header as content-encoding:gzip. It 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 Below is my Lua filter apiVersion: networking.istio.io/v1alpha3 kind: EnvoyFilter metadata: name: cle-lua-filter-traceception namespace: content-layout-enricher spec: workloadSelector: labels: app: content-layout-enricher-teflon configPatches: - applyTo: HTTP_FILTER match: context: SIDECAR_OUTBOUND listener: filterChain: filter: name: envoy.filters.network.http_connection_manager subFilter: name: envoy.filters.http.router patch: operation: INSERT_BEFORE value: name: envoy.lua typed_config: '@type': type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua inlineCode: | function envoy_on_request(request_handle) local headers = request_handle:headers() local optimusHeader = headers:get("x-o-optimus") if optimusHeader == "x-o-tracelogs" then local traceparent = headers:get("traceparent") local wmsvc = headers:get("wm_svc.name") local requestBody = "" for chunk in request_handle:bodyChunks() do if (chunk:length() > 0) then requestBody = requestBody .. chunk:getBytes(0, chunk:length()) end end local finalBodyString = requestBody .. "|~|" .. traceparent .. "|~|" .. "content-layout-enricher" .. "|~|" .. "request" .. "|~|" .. 200 .. "|~|" .. wmsvc request_handle:streamInfo():dynamicMetadata():set("envoy.filters.http.lua", "x-condition", "tracelogs") request_handle:streamInfo():dynamicMetadata():set("envoy.filters.http.lua", "traceception", traceparent) request_handle:streamInfo():dynamicMetadata():set("envoy.filters.http.lua", "x-svcName", "content-layout-enricher") request_handle:streamInfo():dynamicMetadata():set("envoy.filters.http.lua", "upstream-service-name", wmsvc) local headers, body, err = request_handle:httpCall( "traceception_cluster", { [":method"] = "POST", [":path"] = "/logs", [":aut…
type: Question
tagged with: lua
has title: Not able to parse gzip response type(content-encoding:gzip) in Lua envoy filter
tagged with: servicemesh
tagged with: envoyproxy

http://stackoverflow.com/q/78176234
tagged with: lua
possible better answer: http://stackoverflow.com/a/78176292
has body: The commented code with the if statement does work correctly. However, the ternary does not? Why is this or how can I implement this in one simple line? local function dontwork() local args = "" local cmd_tb = {} cmd_tb.args = "" -- dont work args = (#cmd_tb.args == 0 and false or cmd_tb.args) -- dont work -- args = (cmd_tb.args == "" and false or cmd_tb.args) -- works correctly - empty -- if #cmd_tb.args == 0 then -- args = false -- else -- args = cmd_tb.args -- end if args then print("yes:",args) else print("empty") end end -- outputs 'yes' dontwork()
answer count: 2
has answer: http://stackoverflow.com/a/78176292
upvote count: 1
has title: How to write an if statement in ternary form?
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/78176289
accepted answer: http://stackoverflow.com/a/78176289
type: AnsweredQuestion
downvote count: 0
type: Question

thread-safety
type: Tag
tag name: thread-safety
tags question: http://stackoverflow.com/q/78209045

http://stackoverflow.com/a/78244054
has body: 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. Later, in Lua 5.3.3 this behavior has been corrected to a more user-friendly. As 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.
has comment: http://stackoverflow.com/comment/137943228
has comment: http://stackoverflow.com/comment/137943452
answers question: http://stackoverflow.com/q/78243678
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/78243678
type: AcceptedAnswer
type: Answer
upvote count: 3

http://stackoverflow.com/comment/137823541
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78175954
score: 0
has text: @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.

http://stackoverflow.com/q/78202387
has body: 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. In more general terms I want to know how to configure (enable and disable) different options for the LSP and a list of options. 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 ) 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 .
type: Question
has comment: http://stackoverflow.com/comment/137887766
tagged with: lua
tagged with: language-server-protocol
score: 2
has comment: http://stackoverflow.com/comment/137879754
upvote count: 2
has title: How to disable autocomplete and error pop-ups in an LSP, but keep the other LSP features in Neovim
tagged with: neovim
type: UnansweredQuestion
favorite count: 0
downvote count: 0
answer count: 0

http://stackoverflow.com/q/78204048
tagged with: lua
type: Question
tagged with: roblox
tagged with: roblox-studio
accepted answer: http://stackoverflow.com/a/78208134
has title: Variable not updating in Roblox Studio / Lua
has answer: http://stackoverflow.com/a/78208134
answer count: 1
has body: 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 - local tool = script.Parent local anim = tool:WaitForChild("1") local player = game:GetService("Players").LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local humanoid = char:WaitForChild("Humanoid") local loadanim = humanoid:LoadAnimation(anim) local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")) local Controls = PlayerModule:GetControls() local clicks = 0 local c = true local confirm = false local confirm2 = false local confirm3 = false local confirm4 = false local GUI = player.PlayerGui.ScreenGui local gems= GUI.TextLabel local amount = 0 local times = false local how = 0 tool.Activated:Connect(function () amount = amount + 1 gems.Text = tostring(amount) loadanim:Play() script.Disabled = true Controls:Disable() wait(1.5) Controls:Enable() wait(.2) script.Disabled = false clicks = 1 confirm = true end) 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. 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?!
score: 0
type: AnsweredQuestion

http://stackoverflow.com/q/78202258
tagged with: roblox
tagged with: roblox-studio
type: Question
has answer: http://stackoverflow.com/a/78294469
has body: 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. Script: local Player = game.Players.LocalPlayer local Character = Player.Character local Humanoid = Character.Humanoid while wait() do script.Parent.Size = UDim2.new(0, (Humanoid.Health / Humanoid.MaxHealth * 225), 1, 0) end Like i said, i tried a lot of things. I tried rewriting the script completely, Change random values, etc. 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.
has title: Health Bar GUI In Roblox Studio Device Problem
has answer: http://stackoverflow.com/a/78202921
tagged with: user-interface
type: UnansweredQuestion
tagged with: luau
score: 0
tagged with: lua
answer count: 2

http://stackoverflow.com/q/78175954
has answer: http://stackoverflow.com/a/78188699
has comment: http://stackoverflow.com/comment/137821621
has title: Is it possible to use a variable as a field name in a lua table?
has comment: http://stackoverflow.com/comment/137823541
has comment: http://stackoverflow.com/comment/137824410
has body: 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: local PocketDetails = { PocketNumber = nil, X = nil, Y = nil, Z = nil, ClearX = nil, ClearY = nil, ClearZ = nil, ToolNumber = nil, } 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: function PocketPositions.UpdateField(pocketNumber, field, newVal ) -- if there are no pockets add it if next(PocketDetails) == nil then table.insert(PocketDetails, {PocketNumber = pocketNumber, [field] = newVal}) else local foundPocket = false -- look for pocket and update it local i = 1 while PocketDetails[i] ~= nil and foundPocket == false do if PocketDetails[i].PocketNumber == pocketNumber then PocketDetails[i].[field]= newVal end i = i + 1 end -- check to see if the pocket was in the array if foundPocket ~= true then -- pocket was not in the array add it table.insert(PocketDetails, {PocketNumber = pocketNumber, [field] = newVal}) end end end 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: PocketPositions.UpdateField(4, "X", 1.234) PocketPositions.UpdateField(4, "Z", 5.678) PocketPositions.UpdateField(2, "ClearX", 1.234) PocketPositions.UpdateField(4, "X", 3.456) Also if there is a better way to do the above I would like to see that 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. I've tried replacing the [field] value with one of the field names in my function, and the function…
linked to: http://stackoverflow.com/q/11359737
answer count: 1
has comment: http://stackoverflow.com/comment/137823523
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/137821253
has comment: http://stackoverflow.com/comment/137821256
tagged with: lua
tagged with: lua-table
type: Question
has comment: http://stackoverflow.com/comment/137821604

http://stackoverflow.com/comment/137900790
type: Comment
score: 1
comment on: http://stackoverflow.com/a/78216720
has text: ah, good typo find. Fixed in the post.
type: AnswerComment

http://stackoverflow.com/q/78225022
type: Question
has answer: http://stackoverflow.com/a/78225561
possible better answer: http://stackoverflow.com/a/78225181
has body: 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. Basically, I am looking for a lua equivalent for the encodeURI() javascript function. Is there a method in Lua, similar to encodeURI() in JS? I have looked at ngx.escape_uri, but this function only escapes a URI component. I want the uri /test/[hello] to become /test/%5Bhello%5D after encoding the URI. If I do encodeURI(&quot;/test/[hello]/&quot;); in JS, I get the desired output which is /test/%5Bhello%5D. But, in Lua, if I do ngx.escape_uri(&quot;/test/[hello]/&quot;), I get the output as '%2Ftest%2F%5Bhello%5D'.
tagged with: lua
tagged with: openresty
linked to: http://stackoverflow.com/q/46155208
has title: Is there a lua equivalent of the javascript encodeURI() function?
has answer: http://stackoverflow.com/a/78225181
score: 0
tagged with: nginx
type: AnsweredQuestion
answer count: 2
accepted answer: http://stackoverflow.com/a/78225561

http://stackoverflow.com/comment/138036354
has text: 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?
type: Comment
comment on: http://stackoverflow.com/q/78292293
score: 0
type: QuestionComment

http://stackoverflow.com/a/78258776
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/137978789
has body: In Lua, the colon : is typically used for method calls, not for specifying object properties directly. Instead, you should use the equality operator = to specify the property and its value in a Lua table. So, in Lua, your query object should be written like this: { allowRebirthing = true } Plus, removed the square brackets around the field names. MongoDB queries do not need square brackets around field names. ({ allowRebirthing = true }) ({ allowRebirthing = false })
upvote count: 1
answers question: http://stackoverflow.com/q/78258650
has comment: http://stackoverflow.com/comment/137978448
downvote count: 0
has comment: http://stackoverflow.com/comment/137978271

http://stackoverflow.com/comment/137902179
type: Comment
score: 0
type: AnswerComment
has text: 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. Thanks for your answer and help, I will reply if it worked or not, or when I will need extra assistance.
comment on: http://stackoverflow.com/a/78188819

http://stackoverflow.com/q/78171948
downvote count: 0
type: Question
has body: I have the following, although it does not seem any error on me, nor to AI I get the following error: int main(void) { int res; lua_State *L = luaL_newstate(); luaL_openlibs(L); const char *luaCode = " function select(xx) \ if (xx ~= nil and type(xx) == 'table') then \ local y = 0 \ for i = 1, #xx do \ y = y + xx[i] \ end \ return y \ end \ end "; res = luaL_loadstring(L, luaCode); if (res != LUA_OK) { printf("Error loading select function: %s\n", lua_tostring(L, -1)); lua_close(L); exit(1); } lua_getglobal(L, "select"); if (!lua_isfunction(L, -1)) { printf("Error: select is not a function.\n"); lua_close(L); exit(1); } lua_newtable(L); // Create a new Lua table for (int i = 1; i <= 3; ++i) { lua_pushinteger(L, i); lua_pushinteger(L, i); lua_settable(L, -3); } res = lua_pcall(L, 1, 1, 0); // Pass the table to the select function if (res != LUA_OK) { printf("Error running code: %s\n", lua_tostring(L, -1)); lua_close(L); exit(1); } if (lua_isinteger(L, -1)) printf("%d\n", (int)lua_tointeger(L, -1)); else if (lua_isnumber(L, -1)) printf("%f\n", lua_tonumber(L, -1)); lua_close(L); exit(0); } I get Error running code: bad argument #1 to 'select' (number expected, got table) Should i add anything in lua code to execute? Is it just sthing else i have to do on Stack?
tagged with: lua
has comment: http://stackoverflow.com/comment/137814247
tagged with: c-api
upvote count: 2
has title: parse table from c to lua
score: 2
answer count: 1
has answer: http://stackoverflow.com/a/78172169
type: UnansweredQuestion
favorite count: 0

resume
tag name: resume
tags question: http://stackoverflow.com/q/78209045
type: Tag

http://stackoverflow.com/q/78280643
has body: 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 local circleScale, sizeStroke = 50, 3 local iconScale = 25 local circleLeft, circleTop = circleScale + 30, y - circleScale - 20 addEventHandler('onClientResourceStart', resourceRoot, function() createCircle('bgHealth', circleScale, circleScale) createCircle('bgArmor', circleScale, circleScale) createCircleStroke('health', circleScale, circleScale, sizeStroke) createCircleStroke('armor', circleScale, circleScale, sizeStroke) hiddenComponents(false) end) addEventHandler('onClientResourceStop', resourceRoot, function() hiddenComponents(true) end) addEventHandler('onClientRender', root, function() drawItem('bgHealth', circleLeft, circleTop, tocolor(28, 28, 28, 170)) drawItem('bgArmor', circleLeft + circleScale + 10, circleTop, tocolor(28, 28, 28, 170)) drawItem('health', circleLeft, circleTop, tocolor(255, 255, 255)) dxDrawImage(circleLeft + ((circleScale/2) - (iconScale/2)), circleTop + ((circleScale/2) - (iconScale/2)), iconScale, iconScale, 'assets/health.png') drawItem('armor', circleLeft + circleScale + 10, circleTop, tocolor(255, 255, 255)) dxDrawImage((circleLeft + circleScale + 10) + ((circleScale/2) - (iconScale/2)), circleTop + ((circleScale/2) - (iconScale/2)), iconScale, iconScale, 'assets/armor.png') setSVGOffset('health', getElementHealth(localPlayer)) setSVGOffset('armor', getPedArmor(localPlayer)) end) 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.
tagged with: grand-theft-auto
tagged with: mta
answer count: 0
type: Question
tagged with: lua
score: 0
has title: I want to change the hud to the top right corner and have no problem with other resolutions
type: UnansweredQuestion

http://stackoverflow.com/q/78292293
linked to: http://stackoverflow.com/q/1426954
has comment: http://stackoverflow.com/comment/138027933
has comment: http://stackoverflow.com/comment/138036354
favorite count: 0
type: Question
score: 2
downvote count: 0
answer count: 0
tagged with: lua
tagged with: split
has comment: http://stackoverflow.com/comment/138041191
type: UnansweredQuestion
tagged with: string
has title: Lua string.gmatch find empty fields between separators
upvote count: 2
has body: 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 ','. In the optimal case, my data looks like this, after the first separation has been run through. {'xxxx,xxxx,xxxx,xxxx,xxxx'} However, the form that is providing the data, has some fields as optional, which leaves the data I receive like this: {'xxxx,,xxxx,,xxxx'} -- there were two optional fields which leaves me with two separators right next to each other. 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. This problem shouldn't be something rare, yet I seem to have been unable to find anything that helps me. local tbl = {} if sep1 == nil then sep1 = "%s" end for str in string.gmatch(inputstr, "([^"..sep1.."]+)") do table.insert(tbl, str) end if sep2 then for i, v in ipairs(tbl) do local tbl2 = {} local matches = 0; -- my attempt to check if it's a double ',', this fails however for str in string.gmatch(v, "([^"..sep2.."]*)") do if str == '' then matches = matches + 1 if str == '' and matches == 1 then str = '-' matches = 0; end end if (str ~= '' and str ~= nil) then table.insert(tbl2, str) end end tbl[i] = tbl2 end end return tbl end

http://stackoverflow.com/a/78281481
has body: Note that this should be executed in a localscript and can only be seen by the client itself. local Backpack = game:GetService("ReplicatedStorage"):Waitforchild("Backpack") local Player = game:GetService("Players").LocalPlayer Player.CharacterAdded:Connect(function(Character) local clone = Backpack:Clone() clone.Parent = Character:WaitForChild("Torso") end
type: Answer
answers question: http://stackoverflow.com/q/78250537
score: 0

http://stackoverflow.com/q/78249339
has title: Calling an event with a delay in Roblox Studio. How to do?
has comment: http://stackoverflow.com/comment/137951592
has comment: http://stackoverflow.com/comment/137951624
has answer: http://stackoverflow.com/a/78250502
answer count: 1
tagged with: game-development
favorite count: 0
tagged with: roblox
type: Question
downvote count: 0
score: 1
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137951651
has body: I have a script so that when I touch a cube it takes away its HP local HP = cube.Healthbar local function Healtbar() do HP.Value = HP.Value - 5 end cube.Touched:Connect(Healthbar) 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. Help please, I'm just learning and I definitely can't do it myself.... please
tagged with: roblox-studio
upvote count: 1

http://stackoverflow.com/comment/137811023
has text: Ys i fixed it , thnx
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78164919
type: AnswerComment

http://stackoverflow.com/comment/137890802
has text: I did not understand what you want to achieve.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78210282
score: 0

http://stackoverflow.com/a/78382872
has body: Just as Parker Tailor said above. The Neovim lua keymap, for binding keymaps in your config, you need to use the vim.keymap.set() function or the vim.api.{func}({...}) utility. You will get the most of what you need to know in the help docs by running :h vim.keymap.set() and :h vim.api commands. Look at what the help docs say about vim.api, - vim.api.{func}({...}) Invokes Nvim |API| function {func} with arguments {...}. Example: call the "nvim_get_current_line()" API function: print(tostring(vim.api.nvim_get_current_line())) Few Examples: -- Basic keymap vim.keymap.set("n", "<leader>n", vim.cmd.enew, {desc="new file"}) -- calling the "nvim_set_keymap()" api function -- to map Ctrl+C to - copy to clipboard option vim.api.nvim_set_keymap("v", "<C-c>", ":w !xclip -i -sel c<CR><CR>", { noremap = true }) Just a Suggestion :- If you use which-key plugin in your config, add desc = "description of the keymap" in the {opts} table. So, the lua representation of the keybinding you want will be - vim.keymap.set('i', '<c-f>', "<Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"'<CR><CR>:w<CR", { desc="create inkscape figure", silent = true, noremap = true })
type: Answer
answers question: http://stackoverflow.com/q/78305561
score: 0

http://stackoverflow.com/a/78253172
type: AcceptedAnswer
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/78251628
answers question: http://stackoverflow.com/q/78251628
has body: The point of the <const> local variable attribute is to allow Lua to check, at "load" time (when you call dofile / load / require 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 "load time" checking than just syntactic checks. This works for local 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 "chunk" of code (effectively a function body) to check whether it abides by the static (load time) rules of <const>. "Globals" / "environmental variables" (as I like to call them) are effectively just syntactic sugar for accessing fields in the _ENV (usually _G) table. As such, they are much more dynamic than local variables. You could do _G[some .. complex .. expression] = 42, 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 <name> 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.) 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: local constants = {pi = math.pi} setmetatable(_G, {__index = constants, __newindex = function(_, key) error("attempt to change constant global variable " .. key) end}) print(pi) -- runs fine pi = 3 -- errors However,…
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/78319706
has body: inside setup base.Model shouldn't be a string. base.Model = workspace.village:WaitForChild("Base") If you index a string (local gui inside updateHealth) it will return a nil.
score: 0
answers question: http://stackoverflow.com/q/78215215
type: Answer

http://stackoverflow.com/comment/138069264
comment on: http://stackoverflow.com/a/78300938
score: 0
has text: 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
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/137861054
type: Comment
has text: Can you show us how you set the variable character as that is where the error seems to lie
type: QuestionComment
comment on: http://stackoverflow.com/q/78194647
score: 0

http://stackoverflow.com/q/78268821
type: Question
tagged with: luau
tagged with: lua
has body: So the game after the intro it switches the camera to 1st person by enabling the 1st person script: Part of the intro script that turns on the 1st person: v.MouseButton1Click:Connect(function() script.Light:Play() imgout:Play() bout:Play() g.Visible = false gOL.Visible = true wait(1) grin:Play() --Function wait(2) local evt = script.Parent.Parent.Parent.FireMenu script.Parent.Parent.Parent.FireMenu.Value = false b.MainMenuHandler:Destroy() cuc.CameraType = Enum.CameraType.Custom game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson b.Parent.Parent.Parent.Parent["Camera Bobble"].Enabled = true game.Players.LocalPlayer.Character.PrimaryPart.CFrame = workspace.SpawnRoomPlay.CFrame game.Players.LocalPlayer.Character.PrimaryPart.Anchored = false logo.Visible = false wait(2) grout:Play() grout.Completed:Once(function() b.Parent:Destroy() end) end) This is the "Camera Bobble"/1st Person Script: -- << Variables >> -- local Player = game:GetService("Players").LocalPlayer local Mouse = Player:GetMouse() local Camera = game:GetService("Workspace").CurrentCamera local UserInputService = game:GetService("UserInputService") local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid") local bobbing = nil local func1 = 0 local func2 = 0 local func3 = 0 local func4 = 0 local val = 0 local val2 = 0 local int = 10 local int2 = 10 local vect3 = Vector3.new() -- << Functions >> -- UserInputService.MouseIconEnabled = true function lerp(a, b, c) return a + (b - a) * c end Humanoid.CameraOffset = Vector3.new(0,-0.1,-0.725) Camera.FieldOfView = 90 bobbing = game:GetService("RunService").RenderStepped:Connect(function(deltaTime) deltaTime = deltaTime * 60 if Humanoid.Health <= 0 then bobbing:DisConnect() return end local rootMagnitude = Humanoid.RootPart and Vector3.new(Humanoid.RootPart.Velocity.X, 0, Humanoid.RootPart.Velocity.Z).Magnitude or 0 local calcRootMagnitude = math.min(rootMagnitude, 50) if deltaTime > 3 then func1 = 0 func2 = 0 else func…
tagged with: roblox
tagged with: roblox-studio
has title: Player is not visible after switching from 1st person to 3rd person
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78295407
score: 0

http://stackoverflow.com/comment/137909500
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78188819
has text: 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.

rules
tags question: http://stackoverflow.com/q/78284139
tag name: rules
type: Tag
tags question: http://stackoverflow.com/q/78292585

http://stackoverflow.com/comment/137900961
comment on: http://stackoverflow.com/q/78220636
has text: `WHERE` is lost in `FROM fivmin_tbl WHERE time >= %d AND time < %d`
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78208134
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78204048
score: 0
has body: local scriptDisabled tool.Activated:Connect(function () if scriptDisabled then return end amount = amount + 1 gems.Text = tostring(amount) loadanim:Play() scriptDisabled = true Controls:Disable() wait(1.5) Controls:Enable() wait(.2) scriptDisabled = false clicks = 1 confirm = true end)
answers question: http://stackoverflow.com/q/78204048

http://stackoverflow.com/comment/137914605
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78214965
has text: 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.

http://stackoverflow.com/comment/137927985
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/78233831
type: Comment
score: 0

http://stackoverflow.com/comment/137965358
type: QuestionComment
comment on: http://stackoverflow.com/q/78257369
has text: 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.
type: Comment
score: 3

http://stackoverflow.com/q/78167836
tagged with: wait
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78172741
tagged with: roblox
type: Question
has body: 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. I figured out to use os.clock() to see what is going on, and found out that wait() and task.wait() become very inaccurate at very low wait times (e.g. 1/60 seconds). I tried to use the same os.clock() to accurately measure time. It worked on paper fine, but on practice it made my PC lag and constantly cause Script exhausted execution time error. I was using this function: local function AccurateWait(time) local start = os.clock() while os.clock() - start < time do -- Nothing end end 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. local leadFrame = script.Parent.blackBg.I_leadFrame local leadFrameWidth = leadFrame.Size.X.Offset local leadFrameUpdateTick = 1 local pixelSize = 2 -- def: local pixels = {} local step = 3 -- DO NOT CHANGE THIS VALUE, def: 4 local colGreen = Color3.fromRGB(25, 255, 25) local heartBPM = 60 / 60 * 1000 -- Will need it later, for now let it remain as 60 local linePosX = 0 local linePosY = 0 local linePosY_Scale = 0.5 local lineAccuracy = 16 -- def: 16 local lineReachedFrameWidth = false local lineLoops = true local lineClearanceOffset = 20 local lineClearing = false local section = 0 local sectionInMS = 0 local sectionMaxWidth = 0 local wholeBeatLength = 0 local function DrawLine() if linePosX >= leadFrameWidth - pixelSize then if lineLoops then linePosX = 0 end lineReachedFrameWidth = true return end if linePosX >= leadFrameWidth - pixelSize - lineClearanceOffset or lineClearing then lineClearing = true pixels[1]:Destroy() table.remove(pixels, 1) end if linePosY ~= linePosY then linePosY = 0 end local pixel = Instance.new("Frame", leadFrame) pixel.Size = UDim2.new(0, pixel…
tagged with: lua
has answer: http://stackoverflow.com/a/78188819
tagged with: roblox-studio
score: 0
has title: RBX: How to accurately yield/pause script up to miliseconds?
answer count: 2

http://stackoverflow.com/a/78278111
has body: Global variables in recent versions of Lua are actually storing in a table called _ENV. (which is an upvalue in all contexts) Note: the references are ONLY considered local when it is after the complete declaration of local .... This means that a statement like local test = test gets compiled to local test = _ENV.test. With that in mind, the files end up actually being compiled like below. -- module.lua _ENV.test = 30 local test = 20 -- after this point, any references to `test` mean the local variable test = 40 print("module.lua: " .. test) -- main.lua require("module") print("main.lua: " .. _ENV.test)
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78210778
score: 0
accepted answer of: http://stackoverflow.com/q/78210778

pattern-matching
tag name: pattern-matching
type: Tag
tags question: http://stackoverflow.com/q/78213846
tags question: http://stackoverflow.com/q/78638506

http://stackoverflow.com/comment/137951651
comment on: http://stackoverflow.com/q/78249339
score: 0
type: QuestionComment
has text: Can you use os.clock()? Can you store this value+cooldownTime in cube?
type: Comment

http://stackoverflow.com/q/78189404
score: -1
duplicate of: http://stackoverflow.com/q/588004
tagged with: calculation
has body: 12.7 - 20 + 7.3 = -8.8817841970013e-016 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. When I formatted the result to a float: io.write(string.format("%f", 12.7 - 20 + 7.3)) -- -0.000000 But I got nil if I tried to convert it to an integer: io.write(math.tointeger(12.7 - 20 + 7.3) -- nil Is there any explaination why the result turned like this? And how to achieve the result as zero? I've tried seperate the calculation as two different variables. local x = 12.7 - 20 local y = 7.3 io.write(x + y) And turned out, it doesn't happen in other float calculations. io.write(3.7 - 13 + 9.3) -- 0.0 io.write(14.4 - 31 + 16.6) -- 0.0 And also it doesn't happen with -7.3 + 7.3. The result is 0.0. When I think the problem just occured with 12.7 - 20 + 7.3, I got this result: local x = 14.7 - 20 local y = 5.3 io.write(x + y) -- -8.8817841970013e-016 Any calculation with 7.3 and below doesn't return 0.0: io.write(12.7 - 20 + 7.3) io.write(13.7 - 20 + 6.3) io.write(14.7 - 20 + 5.3) io.write(15.7 - 20 + 4.3) But, when it is 8.3, it returns 0.0: io.write(11.7 - 20 + 8.3) -- 0.0
tagged with: floating-accuracy
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/588004
tagged with: lua
has answer: http://stackoverflow.com/a/78189469
has title: Float calculation problem. 12.7 - 20 + 7.3 not equal zero
upvote count: 0
answer count: 1
type: UnansweredQuestion
favorite count: 0

http://stackoverflow.com/q/78251628
has title: global const variables in lua 5.4
type: Question
has comment: http://stackoverflow.com/comment/137956286
downvote count: 0
tagged with: lua-5.4
tagged with: lua
has comment: http://stackoverflow.com/comment/137956279
score: 2
tagged with: fivem
has answer: http://stackoverflow.com/a/78253172
accepted answer: http://stackoverflow.com/a/78253172
has body: i know you're able to do constant variables in lua now with &lt;const&gt;, but they seem to only work with local variables: local myNumber &lt;const&gt; = 10 -- This works perfectly fine myGlobalNumber &lt;const&gt; = 10 -- This causes an error Is it possible to have constant global variables as well? myGlobalNumber &lt;const&gt; = 10
answer count: 1
favorite count: 0
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/138018496
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78285075
type: QuestionComment
has text: 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)

http://stackoverflow.com/comment/137823223
has text: 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? :-)
type: Comment
comment on: http://stackoverflow.com/a/78176289
score: 0
type: AnswerComment

http://stackoverflow.com/a/78214926
type: AcceptedAnswer
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78213071
has comment: http://stackoverflow.com/comment/137891097
score: 4
upvote count: 4
accepted answer of: http://stackoverflow.com/q/78213071
has body: 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 4.2e+42). 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. 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). Simple example: 0xFFFFFFFF*0xFFFFFFFF = -8589934591. 0xFFFFFFFF is much smaller than 64-bit, but square it and you get a number which doesn't fit. Lua could theoretically silently "upgrade" 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). 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. This is among the 5.2 / 5.3 incompatibilities: If you try to "just" 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 .0). This would work in your program as well. If you really want to accurately compute big fibonacci numbers, you w…

http://stackoverflow.com/q/78294940
tagged with: lua
tagged with: roblox
has body: Idk why the orestring don't change when I write in script print(Orestring.Value) it normally works, it says that what should be in orestring but the orestring don't change local proximityprompt = game.Workspace.Tycoons.Tycoon.MainItems.Cardboard_Box.Box.ProximityPrompt local StorageGui = script.Parent local x = script.Parent.Storage.Frame.X local Orebuttons = script.Parent.Storage.Frame.Ores:GetChildren() local OreString = script.Parent.Parent.Sell.Frame.Ore proximityprompt.Triggered:Connect(function() StorageGui.Visible = true end) x.MouseButton1Click:Connect(function() StorageGui.Visible = false end) for _, button: GuiButton in pairs(Orebuttons) do if button:IsA("GuiButton") then button.MouseButton1Click:Connect(function() OreString.Value = button.Name end) end end
has title: String not changing
answer count: 1
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/138033391
has answer: http://stackoverflow.com/a/78320286
type: Question
has comment: http://stackoverflow.com/comment/138134270

http://stackoverflow.com/q/78209189
has body: I'm trying to reduce the number of objects that need to be rendered in order to fill only 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. 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. 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). I've also considered iterating over the matrix and "growing" 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. I hypothesize that picking a coordinate at random and then "growing" 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. I've been working on this problem in Lua, but feel free to respond with solutions in any language. Thank you, -SN 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.
upvote count: 2
tagged with: rectangles
type: Question
tagged with: matrix
tagged with: grid
has answer: http://stackoverflow.com/a/78221333
tagged with: lua
tagged with: performance
has comment: http://stackoverflow.com/comment/137909136
has comment: http://stackoverflow.com/comment/137889615
downvote count: 0
has title: Looking for an approach to finding the minimum number of rectangles necessary in order to fill the occupied area of a 2D matrix?
score: 2
has comment: http://stackoverflow.com/comment/137882707
answer count: 1
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/137890741

http://stackoverflow.com/q/78292585
tagged with: ids
has title: Lua Scritp to detect Nmap scan
score: 0
type: Question
has body: 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? 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.
tagged with: rules
answer count: 0
tagged with: lua
tagged with: port-scanning
type: UnansweredQuestion
tagged with: suricata

http://stackoverflow.com/q/78213071
has title: Problems with large numbers in Lua
linked to: http://stackoverflow.com/q/45270543
score: 0
has comment: http://stackoverflow.com/comment/137887173
tagged with: lua
has comment: http://stackoverflow.com/comment/137888162
has comment: http://stackoverflow.com/comment/137887210
type: AnsweredQuestion
answer count: 1
accepted answer: http://stackoverflow.com/a/78214926
has comment: http://stackoverflow.com/comment/137890186
type: Question
has answer: http://stackoverflow.com/a/78214926
has body: I am new to the Lua programming language, so my first program is a factorial function which I have implemented as follows function fact(n) if n &lt;= 1 then return 1 else return n * fact(n-1) end end the function works as intended for number less than 20, but once I go bigger the function starts to return negative numbers and 0 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 video 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? I'm using Lua 5.3 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 EDIT In the video, the fact(100) produces a number with e expression but on my system it just gives 0

http://stackoverflow.com/comment/137951624
type: Comment
comment on: http://stackoverflow.com/q/78249339
score: 0
type: QuestionComment
has text: Yeah, its just that

floating-accuracy
tag name: floating-accuracy
type: Tag
tags question: http://stackoverflow.com/q/78189404

http://stackoverflow.com/comment/137933543
score: 0
has text: Just make script to replace each digit to # OR to replace each digit to any digit.
type: AnswerComment
comment on: http://stackoverflow.com/a/78228232
type: Comment

http://stackoverflow.com/q/78300144
tagged with: trigonometry
has answer: http://stackoverflow.com/a/78300938
tagged with: lua
tagged with: geometry
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138066150
answer count: 1
has title: Get the circle, that is defined by two points and tangent line, Lua
score: 0
tagged with: math
type: Question
has comment: http://stackoverflow.com/comment/138064857
accepted answer: http://stackoverflow.com/a/78300938
has body: I've made a code to get the circle (or two circles) for given two points and tangential line. I am making the algorithm to make a circle with given two points and tangential linde for this circle. Task: For 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. This: PPL: Apollonius' Problem with Two Points and a Line Solution: Find the intersection point P for AB and T1T2. Create circle with center in point between And B with radius CB. Find tangent line from P to circle C, the tangent point is D. Get radius PD. The radius belongs to circle P. Find two points E1 and E2 by crossing line T and circle P. Get circles G1 and G2 by given three points (A, B, G) as circumcircle. Both G circles are solution of the task. Desmos with one simple solution: ox2zww716t Image: Help functions: function tangentCircle (cx, cy, cr, px, py) -- circle, point local dx, dy = px-cx, py-cy local dist = math.sqrt(dx*dx+dy*dy) if dist &lt;= cr then return end local a, b = math.atan2 (dy, dx), math.acos (cr/dist) local x1 = cx + cr * math.cos (a-b) local y1 = cy + cr * math.sin (a-b) local x2 = cx + cr * math.cos (a+b) local y2 = cy + cr * math.sin (a+b) return x1, y1, x2, y2 end function linesIntersect(x1, y1, x2, y2, x3, y3, x4, y4) local dx1, dy1 = x2 - x1, y2 - y1 local dx2, dy2 = x4 - x3, y4 - y3 local det = dx2 * dy1 - dx1 * dy2 if det == 0 then return end local c1 = x1 * y2 - y1 * x2 local c2 = x3 * y4 - y3 * x4 local x = (c1 * dx2 - c2 * dx1) / det local y = (c1 * dy2 - c2 * dy1) / det return x, y end function circleWithTwoPoints (x1, y1, x2, y2) local cx = (x1 + x2) / 2 local cy = (y1 + y2) / 2 local cr = math.sqrt((cx - x1)^2 + (cy - y1)^2) return cx, cy, cr end function intersectCircleCenterLine(cx, cy, cr, tx1, ty1, tx2, ty2) local angle = math.atan2 (ty2-ty1, tx2-tx1) local ex1, ey1 = cx + cr * math.cos (angle), cy + cr * math.sin (angle) local ex2, ey2 = cx + cr * math.cos (angle+math.pi), cy + cr * mat…
has comment: http://stackoverflow.com/comment/138066040

http://stackoverflow.com/comment/137902084
comment on: http://stackoverflow.com/q/78221219
type: Comment
has text: 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**)
score: 3
type: QuestionComment

http://stackoverflow.com/q/78243644
has body: I want to write a patterns that takes a string like this /a/b/c and extracts a, b, and c. a, b, and c are optional, so /// is a valid input. Currently I have this: &quot;^%/(.-)%/(.-)%/(.-)$&quot;. This works, except if my input is /&lt;/&gt;/b/c, I get matches: &lt;, &gt;, b/c. Obviously the second / should be escaped like this: /&lt;\\/&gt;/b/c, however this gives me: &lt;\, &gt;, b/c. Is there a way to write this pattern such that /&lt;\\/&gt;/b/c would give me: &lt;\/&gt;, b, c? I know I could change the first .- to a .+ 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).
tagged with: lua-patterns
possible better answer: http://stackoverflow.com/a/78243719
favorite count: 0
type: AnsweredQuestion
answer count: 2
has title: How to write a lua pattern that is aware of escaped characters?
accepted answer: http://stackoverflow.com/a/78244356
upvote count: 3
has answer: http://stackoverflow.com/a/78243719
type: Question
downvote count: 0
score: 3
has answer: http://stackoverflow.com/a/78244356
tagged with: lua

http://stackoverflow.com/comment/138057837
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78294469
score: 0
has text: i literally used scale instead of offset

http://stackoverflow.com/comment/137784620
type: QuestionComment
comment on: http://stackoverflow.com/q/78154763
has text: There will be a drawing on the panel and I need to get the color of the specified pixel. @Igor
type: Comment
score: 0

http://stackoverflow.com/a/78825652
answers question: http://stackoverflow.com/q/78196346
has body: I'm not sure but try adding the opts directly, something like below, according to your own provided code. return { { "mfussenegger/nvim-jdtls", opts = function(opts) local root_dir = {{'.git', 'mvnw', 'gradlew'}} table.insert(opts.root_dir, root_dir) return opts end, }, }
score: 0
type: Answer

http://stackoverflow.com/q/78213080
downvote count: 0
score: 1
has title: Lua change string using a loop
has body: Hi there guys how can I make a string change its value randomly or based on a list of names? The script I have only changes from one string to another one. Here's my code: local string_to_find = 'o(*_*)o' local string_to_write = '^1o(*_*)o' ms = createMemScan() ms.firstScan(soExactValue, vtString, 0, string_to_find, "" , 0, 0xffffffffffffffff, "", fsmNotAligned, "1", false, false, false, false) ms.waitTillDone() f=createFoundList(ms); f.initialize(); resultToWrite = stringToByteTable(string_to_write .. string.char(0)) for i = 0, f.Count - 1 do writeString(f.Address[i], string_to_write) writeBytes(("0x" .. f.Address[i]) + 4, 0) end f.destroy() ms.destroy() Thanks in advance! I was trying to change a string.
answer count: 1
type: UnansweredQuestion
tagged with: cheat-engine
favorite count: 0
has answer: http://stackoverflow.com/a/78228232
tagged with: lua
type: Question
upvote count: 1

http://stackoverflow.com/q/78285075
has body: I'm making a roblox time trials obby, but I can't make a timer in the format of 0:00s, any help ? 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.
has comment: http://stackoverflow.com/comment/138018496
tagged with: roblox
downvote count: 1
type: Question
tagged with: lua
has title: Making A Roblox Time Trial Obby and can't seem to make a timer in my format
upvote count: 0
tagged with: roblox-studio
has comment: http://stackoverflow.com/comment/138015984
score: -1
answer count: 1
type: UnansweredQuestion
favorite count: 0
tagged with: luau
has comment: http://stackoverflow.com/comment/138017153
has answer: http://stackoverflow.com/a/78290787

http://stackoverflow.com/comment/137882845
score: 0
type: Comment
has text: you have broken the nesting of structures: `if ...end` and `until .. repeat`
type: QuestionComment
comment on: http://stackoverflow.com/q/78210282

http://stackoverflow.com/a/78158406
answers question: http://stackoverflow.com/q/78151700
has body: 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: local parts = {} for i = 1, 10 do local part = display.newImage("part" .. tostring(i) .. ".png", 0, 0) part:scale(0.5, 0.5) part.isVisible = false table.insert(parts, part) end After this, you'll have a table full of parts, and can access them like so: parts[part_num] Hope this helps!
score: 0
type: Answer

http://stackoverflow.com/comment/137940909
type: Comment
has text: Please, format your question properly.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78243000

http://stackoverflow.com/a/78302551
has body: I something like this what you're looking for? local original = " test" local trimmed = original:match( "^%s*(.*)" ) local spaces = #original - #trimmed print("The original word is [" .. original .. "] and the trimmed word is [" .. trimmed .. "] and there are " .. spaces .. " spaces.") Output: The original word is [ test] and the trimmed word is [test] and there are 4 spaces.
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78301093
upvote count: 2
answers question: http://stackoverflow.com/q/78301093
score: 2

http://stackoverflow.com/a/78307245
has body: If I'm correct this is a LocalScript. The problem is the LocalPlayer has no network ownership over the leaderstats value Money so when the LocalPlayer tries to edit it will not replicate to the server. You should make the buy system on the server. I recommend using a RemoteEvent that fires the server and then the server will handle the purchase and clones the tool to the player's backpack.
type: Answer
has comment: http://stackoverflow.com/comment/138079718
answers question: http://stackoverflow.com/q/78305470
has comment: http://stackoverflow.com/comment/138080082
score: 0

http://stackoverflow.com/comment/137790593
has text: @СиестаСоб - 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?
type: QuestionComment
comment on: http://stackoverflow.com/q/78149365
type: Comment
score: 0

http://stackoverflow.com/a/78225561
downvote count: 0
has comment: http://stackoverflow.com/comment/137916537
upvote count: 4
accepted answer of: http://stackoverflow.com/q/78225022
has body: ngx.escape_uri has an option to escape a full URI: syntax: newstr = ngx.escape_uri(str, type?) Since v0.10.16, this function accepts an optional type argument. It accepts the following values (defaults to 2): 0: escapes str as a full URI. [...] 2: escape str as a URI component. [...] Nonetheless, ngx.escape_uri(str, 0) is still not the same as encodeURI. Fortunately, it's easy to write your own function that produce exactly the same output as encodeURI: local function _encode_uri_char(char) return string.format('%%%0X', string.byte(char)) end local function encode_uri(uri) return (string.gsub(uri, &quot;[^%a%d%-_%.!~%*'%(%);/%?:@&amp;=%+%$,#]&quot;, _encode_uri_char)) end -- prints /test/%5Bhello%5D/ ngx.say(encode_uri('/test/[hello]/')) The encode_uri function escapes all characters except: A–Z a–z 0–9 - _ . ! ~ * ' ( ) ; / ? : @ &amp; = + $ , # as it described here.
score: 4
answers question: http://stackoverflow.com/q/78225022
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/137939865
type: Comment
comment on: http://stackoverflow.com/q/78240791
type: QuestionComment
has text: By adding a very small number to such comparisions, and replacing equals by a range check. As explained in the linked question btw.
score: 2

http://stackoverflow.com/comment/138021638
has text: Hi @Sodz1aX, what question are you asking? I don't think other users will understand what you're trying to do without more details.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78289464
type: Comment

http://stackoverflow.com/q/78262662
has comment: http://stackoverflow.com/comment/137984486
answer count: 0
has title: Lua get array size in object
tagged with: lua
type: UnansweredQuestion
favorite count: 0
score: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/137984581
tagged with: object
has comment: http://stackoverflow.com/comment/137984648
downvote count: 1
upvote count: 1
tagged with: for-loop
has body: I am attempting to make a loop that goes though each item in an array. 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. function singStuff(membersIndex, noteData, noteType, char) if #char.noteGroup == 0 then return end --this = 1 debugPrint(char.noteGroup) --debugPrint(char.noteGroup[2]) --This doesn't work for e,curNote in pairs(char.noteGroup) do --Loops once cus it counds how the number of noteGroups, not how many are in it --debugPrint(curNote[4]) -- #curNote = 4 (Correct) if noteType == curNote[e] then -- Removing these do not effect the loop -- curNote[e] works correctly char.doIdle = false playAnim(char.name, anims[noteData + 1], true) runTimer(("sing_cooldown_" .. char.name), 0.4, 1) elseif noteType == curNote[e]..char.altSuffix then char.doIdle = false playAnim(char.name, anims[noteData + 1]..char.altSuffix, true) runTimer(("sing_cooldown_" .. char.name), 0.4, 1) end end end My guess is that # function is counting how many "noteGroup" arrays there are in the "char" object, rather than how many items are in the array. I attempted "char.#noteGroup" but that doesn't work. The code in the loop works correctly, with setting "curNote[e]" to "curNote[2]" getting the correct result. Same with the other array values. Removing the code doesn't do anything, it still only loops once.
type: Question

http://stackoverflow.com/a/78290787
has body: You can use a function like the one below to get a string in the format 0:00s. --!strict function formatTime(seconds: number): string local minutes = math.floor(seconds / 60) local remainingSeconds = seconds % 60 return string.format("%d:%02ds", minutes, remainingSeconds) end print(formatTime(300)) -- 5:00s The function takes a number which is the amount of seconds and then returns a string in the format 0:00s. First, we use math.floor to find the number of minutes. Then, we use % to divide the number of seconds by 60 and get the reminder of seconds after dividing them. Finally, we use string.format to put the minutes and remaining seconds together in a string, making sure that remainingSeconds has 2 digits.
answers question: http://stackoverflow.com/q/78285075
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/138072313

http://stackoverflow.com/comment/138015984
score: 0
type: QuestionComment
has text: We'd love to help, care to share the code that you tried?
comment on: http://stackoverflow.com/q/78285075
type: Comment

http://stackoverflow.com/q/78289464
favorite count: 0
has title: Players.ilippo.PlayerGui.ScreenGui.Storage.Script:15: attempt to index nil with 'Connect'
score: -1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/78290961
tagged with: roblox
upvote count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/138021638
has body: local proximityprompt = game.Workspace.Tycoons.Tycoon.MainItems.Cardboard_Box.Box.ProximityPrompt local StorageGui = script.Parent local x = script.Parent.Storage.Frame.X local Orebuttons = script.Parent.Storage.Frame.Ores:GetChildren() local OreString = script.Parent.Parent.Sell.Frame.Ore proximityprompt.Triggered:Connect(function() StorageGui.Visible = true end) x.MouseButton1Click:Connect(function() StorageGui.Visible = false end) Orebuttons.MouseButton1Click:Connect(function() print("Click") OreString.Value = Orebuttons.Name end) I don't know what should I do I 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
answer count: 1
type: UnansweredQuestion

jcl
type: Tag
tags question: http://stackoverflow.com/q/78233831
tag name: jcl

http://stackoverflow.com/q/78149365
has comment: http://stackoverflow.com/comment/137790593
has comment: http://stackoverflow.com/comment/137783595
tagged with: logitech-gaming-software
tagged with: mouse
has comment: http://stackoverflow.com/comment/137797432
type: UnansweredQuestion
answer count: 0
score: 0
has body: How to make the code correctly, so that the recoil is canceled out, and the button is held down together with "q"? EnablePrimaryMouseButtonEvents(true); function OnEvent(event, arg) if IsKeyLockOn("Numlock") then if IsMouseButtonPressed(1) then if IsKeyLockOn ("capslock") then PressAndReleaseKey("Q") Sleep(10000) PressAndReleaseKey("Q") end repeat MoveMouseRelative(0,4) Sleep(50) until not IsMouseButtonPressed(1) end if IsMouseButtonPressed(3)then repeat if IsMouseButtonPressed(1) then if IsKeyLockOn ("capslock") then PressAndReleaseKey("Q") Sleep(10000) PressAndReleaseKey("Q") end repeat MoveMouseRelative(0,4) Sleep(1) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end end I'm a newbie, I made the code myself. As a result, first the button "Q" works by holding it down for 10 seconds and then releasing it, but I need it all together if IsMouseButtonPressed(1) then if IsKeyLockOn ("capslock") then PressAndReleaseKey("Q") Sleep(10000) PressAndReleaseKey("Q") end repeat MoveMouseRelative(0,4) Sleep(50) until not IsMouseButtonPressed(1) end
type: Question
has comment: http://stackoverflow.com/comment/137782204
has title: How to make code work together ? lua script
tagged with: lua
has comment: http://stackoverflow.com/comment/137789807

http://stackoverflow.com/q/78282235
type: UnansweredQuestion
score: 1
upvote count: 1
answer count: 1
has body: so the output says that Workspace.Knife.Script:58: attempt to index nil with 'Character' here is the code shown local player = game.Players.LocalPlayer local Character = player.Character local hum = player.Character:FindFirstChild("Humanoid") local gui = Instance.new("BillboardGui") gui.Parent = hum.Parent.Head gui.Adornee = hum.Parent.Head gui.Size = UDim2.new(0, 200, 0, 50) gui.StudsOffset = Vector3.new(0, 2, 0) local text = Instance.new("TextLabel") text.Parent = gui text.Size = UDim2.new(1, 0, 1, 0) text.BackgroundTransparency = 1 text.TextColor3 = Color3.fromRGB(223, 204, 0) text.TextScaled = true text.Text = "1.75x" wait(1) gui:Destroy() hit.Parent.Humanoid:TakeDamage(8*1.75) hitboxActivated = false how do i this it?
favorite count: 0
has title: This "CRIT" billboard GUI isn't working, how to fix it?
tagged with: roblox
has answer: http://stackoverflow.com/a/78295175
type: Question
downvote count: 0
tagged with: lua

http://stackoverflow.com/comment/139081118
has text: I did that already but it won't open at all.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78176709
type: QuestionComment

http://stackoverflow.com/a/78156112
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/78154763
has body: Regarding the official wxWidgets's doc, GetPixel doesn't return the colour : only a boolean that indicates if all was correct. You have to pass a wxColour var as 3rd parameter: local colour = wx.wxColour(0, 0, 0) pdc:GetPixel(point.x, point.y, colour)
type: AcceptedAnswer
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78154763
has comment: http://stackoverflow.com/comment/137786749

http://stackoverflow.com/q/78302174
tagged with: can-bus
has body: 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: scripts/CAN test.lua:58:21: accessing undefined field ldexp of global math How do I fix the problem and could anyone suggest me with an alternative?
type: Question
has answer: http://stackoverflow.com/a/78303031
tagged with: lua
accepted answer: http://stackoverflow.com/a/78303031
has title: How do I use ldexp in lua 5.4 as math.ldexp(...) is deprecated
has comment: http://stackoverflow.com/comment/138046411
tagged with: math
favorite count: 0
score: -1
downvote count: 1
type: AnsweredQuestion
answer count: 1
upvote count: 0
tagged with: lua-5.4

http://stackoverflow.com/comment/137821676
comment on: http://stackoverflow.com/a/78172741
score: 0
type: AnswerComment
has text: 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).
type: Comment

http://stackoverflow.com/q/78247619
score: 0
has title: lghub lua script presskey
tagged with: logitech
has comment: http://stackoverflow.com/comment/137952023
type: Question
has body: I dont really know how to code lua, i made a script, when "Numlock" is on the script clicks "a" for a random time duration, then releases "a" and it presses "s" for random time. repeats the script until numlock is turned off. it doesnt work tho.. function OnEvent(event, arg) OutputLogMessage("wawa") if event == sKeyLockOn("Numlock") then repeat PressKey("a") Sleep(math.random(8700, 8900)) ReleaseKey("a") Sleep(2) PressKey("s") Sleep(math.random(8700, 8900)) ReleaseKey("s") Sleep(2) until not IsKeyLockOn("Numlock") end end this code doesnt work for some reason, i tried using mouse button instead of numlock but no luck
answer count: 0
tagged with: lua
tagged with: logitech-gaming-software
type: UnansweredQuestion

http://stackoverflow.com/q/78245755
has comment: http://stackoverflow.com/comment/137957704
tagged with: lua
has comment: http://stackoverflow.com/comment/137951675
has comment: http://stackoverflow.com/comment/137951596
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137947508
has comment: http://stackoverflow.com/comment/137952049
tagged with: watchmaker
has title: Lua syntax error expected '(' near update_rotation
answer count: 0
has body: The syntax error does not appear until I type the = for the variable assignment on the next line. App is Watchmaker. Complete code -- Calculate rotation angle based on current time function update_rotation() local current_hour = os.date("%H") local rotation_angle = (current_hour / 24) * 360 return rotation_angle end -- Update rotation every minute function on_minute() local rotation = update_rotation() your_control.rotation = rotation end I am expecting this code to rotate a watch hand around the face once in each 24 hours.
score: 0
type: Question

http://stackoverflow.com/comment/137951675
type: QuestionComment
has text: 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?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78245755

http://stackoverflow.com/comment/137943218
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78227135
type: Comment
has text: Yes, any given license plate in the Netherlands uses 2 dashes.

http://stackoverflow.com/comment/137966322
has text: I have no idea on how to do it. Sorry just started learning. Can you show me using my code? thanks in advance
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78228232
type: Comment

http://stackoverflow.com/comment/137821604
comment on: http://stackoverflow.com/q/78175954
type: QuestionComment
type: Comment
score: 1
has text: `local PocketDetails = { PocketNumber = nil, X = nil, Y = nil, Z = nil, ClearX = nil, ClearY = nil, ClearZ = nil, ToolNumber = nil, }` is the same as `local PocketDetails = {}`.

http://stackoverflow.com/a/78222090
answers question: http://stackoverflow.com/q/78176709
has comment: http://stackoverflow.com/comment/139081117
score: 0
has body: You are need to run the luarock for it: https://luarocks.org/
type: Answer

null
type: Tag
tag name: null
tags question: http://stackoverflow.com/q/78194647

http://stackoverflow.com/q/78283791
answer count: 1
tagged with: packet
has title: Writing a protocol dissector with Lua does not autocomplete the Proto class
type: Question
accepted answer: http://stackoverflow.com/a/78289010
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78289010
tagged with: wireshark
tagged with: wireshark-dissector
score: 0
has body: 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. 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). 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 Proto class) I've read somewhere that you need to run the script sith tshark -X 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 data attribute of a TCP packet and parses it accordingly (kind of like how struct or construct work in Python) The documentation I am following: https://mika-s.github.io/wireshark/lua/dissector/2017/11/04/creating-a-wireshark-dissector-in-lua-1.html The problem is that when I initiate the "Proto" class it does not detect it and retrieves an exception of some "Global 'Proto' is undefined" 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. Searching on google I expected much greater explanations Running it by myself I expected it to work but it threw an exception Following a guide I added in the main question I expected it to run properly but it did not...
tagged with: lua

http://stackoverflow.com/comment/137823364
type: Comment
has text: 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.
score: 2
comment on: http://stackoverflow.com/q/78176709
type: QuestionComment

http://stackoverflow.com/q/78219522
answer count: 2
tagged with: iterator
type: Question
tagged with: binary-tree
upvote count: 1
tagged with: lua
downvote count: 0
has answer: http://stackoverflow.com/a/78220087
has title: in Lua, how to write an iterator for a binary tree?
score: 1
has answer: http://stackoverflow.com/a/78219787
type: UnansweredQuestion
has body: In Lua, how to write an iterator for a binary tree. e.g. so I could do something like: for node in tree:visit() do ... end I've been trying but best I can do is to walks the tree, carrying around some function fun as a payload. e.g. function klass(s, t) t={ako=s}; t.__index=t; return t end NODE=klass"NODE" function NODE.new(x,l,r) return setmetatable( {x=x, left=l, right=r},NODE) end function NODE:visit(fun, lvl) lvl=lvl or 0 fun(lvl,self) for _,kid in pairs{self.left, self.right} do if kid then kid:visit(fun, lvl+1) end end end --- eg ----------------------------- function eg(x,stop, node) node = NODE.new(x) if x < stop/2 then node.left = eg(2*x,stop) node.right = eg(2*x+1,stop) end return node end tree=eg(1,32) tree:visit( function(lvl,node) print(('|.. '):rep(lvl)..node.x) end ) This produces the output I want: 1 |.. 2 |.. |.. 4 |.. |.. |.. 8 |.. |.. |.. |.. 16 |.. |.. |.. |.. 17 |.. |.. |.. 9 |.. |.. |.. |.. 18 |.. |.. |.. |.. 19 |.. |.. 5 |.. |.. |.. 10 |.. |.. |.. |.. 20 |.. |.. |.. |.. 21 |.. |.. |.. 11 |.. |.. |.. |.. 22 |.. |.. |.. |.. 23 |.. 3 |.. |.. 6 |.. |.. |.. 12 |.. |.. |.. |.. 24 |.. |.. |.. |.. 25 |.. |.. |.. 13 |.. |.. |.. |.. 26 |.. |.. |.. |.. 27 |.. |.. 7 |.. |.. |.. 14 |.. |.. |.. |.. 28 |.. |.. |.. |.. 29 |.. |.. |.. 15 |.. |.. |.. |.. 30 |.. |.. |.. |.. 31 But how do I write this such that I can work it into a for loop? There are two solutions I'd like to avoid: I don't want to use pairs 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) I want the answer to be (much) less complex than https://github.com/guicaulada/lua-bintrees/blob/main/bintrees/iterator.lua
favorite count: 0

http://stackoverflow.com/comment/137942464
type: QuestionComment
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78243678
has text: 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.

http://stackoverflow.com/q/78217605
tagged with: roblox
tagged with: roblox-studio
has answer: http://stackoverflow.com/a/78281771
answer count: 1
tagged with: game-development
type: UnansweredQuestion
upvote count: 1
favorite count: 0
has body: I am developing a game in Roblox Studio and while scripting I found a problem I can't seem to fix. 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. Demonstration: https://youtu.be/Zh1jjabVJbo I tried changing the Fall animation to an idle animation - didn't work. I tried turning it off while on the flight mode - didn't work I tried multiple solutions already. local UIS = game:GetService("UserInputService") local last = tick() local isFlying = false local flyUpSpeed = 16 local flyDownSpeed = 16 local char = script.Parent local root = char:WaitForChild("HumanoidRootPart") function flight(isFlying) if isFlying then local bv = Instance.new("BodyVelocity") bv.MaxForce = Vector3.new(0, 1, 0) * 30000 bv.Velocity = Vector3.new(0, 0, 0) bv.Name = "FlightVelocity" bv.Parent = root else local bv = root:FindFirstChild("FlightVelocity") if bv then bv:Destroy() end end end UIS.InputBegan:Connect(function(input, gameprocessed) if gameprocessed then return end if input.KeyCode == Enum.KeyCode.Space then if (tick() - last) < 0.5 then isFlying = not isFlying flight(isFlying) elseif isFlying then local bv = root:FindFirstChild("FlightVelocity") if bv then bv.Velocity = Vector3.new(0, 1, 0) * flyUpSpeed end end last = tick() end if input.KeyCode == Enum.KeyCode.LeftControl then if isFlying then local bv = root:FindFirstChild("FlightVelocity") if bv then bv.Velocity = Vector3.new(0, -1, 0) * flyDownSpeed end end end local bv = root:FindFir…
downvote count: 0
score: 1
has title: Turn off Default R15 Fall Animation in flight mode in RobloxStudio with the programming language Lua
tagged with: lua
type: Question

http://stackoverflow.com/comment/137956509
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/78251874
score: 0
type: QuestionComment

http://stackoverflow.com/q/78254595
score: 1
tagged with: lua
has title: Plot with Grafana (timeseries panel) only one "field" of a Redis Stream
answer count: 1
has answer: http://stackoverflow.com/a/78257530
accepted answer: http://stackoverflow.com/a/78257530
type: AnsweredQuestion
tagged with: redis
has body: I've some data in Redis streams which look like XRANGE trades-BINANCE-BTC-USDT 1711915630000 1711915637000 1) 1) "1711915630040-0" 2) 1) "exchange" 2) "BINANCE" 3) "symbol" 4) "BTC-USDT" 5) "side" 6) "sell" 7) "amount" 8) "0.0003" 9) "price" 10) "71029.95" 11) "id" 12) "2946737379" I'd like to plot with Grafana only price in timeseries plot. I did the following Query: Type: Redis Command: XRANGE Key: $trades (variable which contains trades-BINANCE-BNB-USDT) But I'm getting plot of amount, price, id, timestamp, received_timestamp as y-axis and time as x-axis. Unfortunately I don't know how to only plot price vs time Any idea? Do I need custom request with Lua for that purpose?
tagged with: grafana
type: Question
upvote count: 1
favorite count: 0
downvote count: 0

http://stackoverflow.com/comment/138033391
has text: Is this a LocalScript or a Script? Where is this code located in the game?
type: QuestionComment
comment on: http://stackoverflow.com/q/78294940
score: 1
type: Comment

http://stackoverflow.com/q/78294508
type: Question
downvote count: 0
upvote count: 1
answer count: 0
tagged with: lua
has title: Neovim treesitter setup issue in init.lua
tagged with: treesitter
type: UnansweredQuestion
score: 1
favorite count: 0
has body: This is my setup file: vim.cmd("set expandtab") vim.cmd("set tabstop=2") vim.cmd("set softtabstop=2") vim.cmd("set shiftwidth=2") vim.g.mapleader = " " local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) local plugins = { { "catppuccin/nvim", name = "catppuccin", priority = 1000 }, { 'nvim-telescope/telescope.nvim', tag = '0.1.6', dependencies = { 'nvim-lua/plenary.nvim' } }, { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup { ensure_installed = "all", highlight = { enable = true, }, indent = { enable = true, } } end }, } local opts = {} require("lazy").setup(plugins, opts) local builtin = require("telescope.builtin") vim.keymap.set('n', '<C-p>', builtin.find_files, {}) vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) require("catppuccin").setup() vim.cmd.colorscheme "catppuccin" When I replace nvim-treesitter part inside the plugins variable, it works. Here's what I replace it with: {"nvim-treesitter/nvim-treesitter", build = ":TSUpdate"} Here's what I see when I try to run nvim .\init.lua I'm using Windows, NeoVim version 0.9.5, LuaJIT 2.1
tagged with: neovim

http://stackoverflow.com/comment/137881682
type: QuestionComment
has text: Maybe this is because the `groundFixture` doesn't have any userdata.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78208249

build-system
tag name: build-system
type: Tag
tags question: http://stackoverflow.com/q/78289911

http://stackoverflow.com/comment/137908276
comment on: http://stackoverflow.com/q/78210778
has text: 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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/78177017
accepted answer: http://stackoverflow.com/a/78290699
upvote count: 1
tagged with: fonts
answer count: 1
tagged with: neovim
favorite count: 0
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/137824393
downvote count: 0
tagged with: lua
tagged with: lazy-evaluation
has title: How can I fix missing icons on Neovim Lualine plugin?
score: 1
has body: 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. I'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 "X" symbol to indicate uninstalled), while the others render fine. Edit, for posterity: 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.
has answer: http://stackoverflow.com/a/78290699

http://stackoverflow.com/comment/137901325
score: 0
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/78214965
type: Comment

http://stackoverflow.com/q/78188829
has title: Snippet of current time in nvim
tagged with: neovim
upvote count: 1
answer count: 1
favorite count: 0
has body: I'm trying to create a snippet for vimwiki. The snippet must change __ to current time. local line_begin = require("luasnip.extras.expand_conditions").line_begin return { s( {trig='__', desc="Insert current time", snippetType = "autosnippet"}, {t("_"), t(vim.fn.system( tr -d '\n')), t({'_', ''})}, {condition = line_begin} ), } Looks like it must work, but it past only fix time - the time of start of first vimwiki buffer. How to improve the snippet? I tried to find in documentation how to do this, but have not find any solution.
has answer: http://stackoverflow.com/a/78198541
type: Question
downvote count: 0
tagged with: code-snippets
tagged with: lua
type: UnansweredQuestion
score: 1

http://stackoverflow.com/comment/138457270
comment on: http://stackoverflow.com/q/78210282
type: QuestionComment
score: 0
has text: Wrap after-loop-z-press-release into `if not IsMouseButtonPressed(3) then ... end`
type: Comment

http://stackoverflow.com/q/78154763
has comment: http://stackoverflow.com/comment/137785780
tagged with: lua
has body: I am using ZeroBrane Studio (2.01; MobDebug 0.805) on Windows 10. How to get the color of a panel point? Select a point with the left mouse button. My MWE: package.cpath = package.cpath..";./?.dll;./?.so;../lib/?.so;../lib/vc_dll/?.dll;../lib/bcc_dll/?.dll;../lib/mingw_dll/?.dll;" require("wx") frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "How tom use GetPixel?", wx.wxDefaultPosition, wx.wxSize(450, 450), wx.wxDEFAULT_FRAME_STYLE) panel = wx.wxPanel(frame, wx.wxID_ANY) function OnLeftUp(event) local point = { x = event:GetX(), y = event:GetY() } local pdc = wx.wxClientDC(panel) -- local colour = pdc:GetPixel(point.x, point.y) -- This line results in an error pdc:DrawText("Left mouse button UP at x = " .. tostring(point.x) .. " y = " .. tostring(point.y), point.x, point.y) -- pdc:DrawText("Left mouse button UP at x = " .. tostring(point.x) .. " y = " .. tostring(point.y) .. " Red = " .. tostring(colour:GetRed()), point.x, point.y) -- This line results in an error pdc:delete() end panel:Connect(wx.wxEVT_LEFT_UP, OnLeftUp) local sizer = wx.wxBoxSizer(wx.wxVERTICAL) sizer:Add(panel, 1, wx.wxEXPAND) frame:SetSizer(sizer) frame:SetAutoLayout(true) wx.wxGetApp():MainLoop() I tried to use GetPixel but it gives an error:
has comment: http://stackoverflow.com/comment/137784541
has answer: http://stackoverflow.com/a/78156112
accepted answer: http://stackoverflow.com/a/78156112
answer count: 1
score: 0
tagged with: wxwidgets
type: AnsweredQuestion
has title: How to get point color (RGB) in panel Lua (wxLua)?
has comment: http://stackoverflow.com/comment/137784620
type: Question

http://stackoverflow.com/comment/137780595
score: 1
comment on: http://stackoverflow.com/a/78151815
has text: I think OP probably wants something like `local parts = {} ... part[i] = `; From their example
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/137782204
has text: 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?
score: 0
comment on: http://stackoverflow.com/q/78149365
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/137956279
comment on: http://stackoverflow.com/q/78251628
has text: Constant may be only local variables. No globals. No table fields. Actually, it's a quite useless Lua feature.
type: QuestionComment
score: 1
type: Comment

http://stackoverflow.com/a/78293999
type: Answer
score: 0
answers question: http://stackoverflow.com/q/78275372
has body: It seems like you are waiting for Modules twice in the DataManager script according to the error. Infinite yield possible on 'ServerScriptService.Modules:WaitForChild("Modules") The error states you are using ServerScriptService.Modules:WaitForChild("Modules") when you want to use ServerScriptService:WaitForChild("Modules"). Try using the below code in the script, DataManager. I corrected it so it properly waits for Modules now. local ServerScriptService = game:GetService("ServerScriptService") require(ServerScriptService:WaitForChild("Modules"):WaitForChild("DataManager"))

http://stackoverflow.com/a/78303031
score: 3
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78302174
answers question: http://stackoverflow.com/q/78302174
type: AcceptedAnswer
type: Answer
has body: Quote from the official manual you can replace math.ldexp(x,exp) with x * 2.0^exp

http://stackoverflow.com/comment/138051482
has text: 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)
type: QuestionComment
comment on: http://stackoverflow.com/q/78305561
type: Comment
score: 1

http://stackoverflow.com/q/78208249
has body: 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. Here is my create square code: Test = Class{} function Test:init(type, x, y, userData, world) self.world = world self.x = x self.y = y self.type = type self.boxBody1 = love.physics.newBody(self.world, self.x , self.y ,'dynamic') if self.type == 'square' then self.boxShape = love.physics.newRectangleShape(10, 10) end self.boxFixture1 = love.physics.newFixture(self.boxBody1, self.boxShape) self.boxFixture1:setRestitution(0.5) self.boxFixture1:setUserData(userData) end function Test:update(dt) end function Test:render() love.graphics.polygon('fill', self.boxBody1:getWorldPoints(self.boxShape:getPoints())) end and here is my destroy code Test2 = Class{} function Test2:init() self.world = love.physics.newWorld(0, 300) self.destroyedBodies = {} self.square = {} function beginContact(a, b, coll) local types = {} types[a:getUserData()] = true types[b:getUserData()] = true -- if we collided between both the player and an obstacle... if types['square1'] and types['square2'] then -- grab the boxBody1 that belongs to the player local square1 = a:getUserData() == 'square1' and a or b local square2 = a:getUserData() == 'square2' and a or b table.insert(self.destroyedBodies, square1:getBody()) table.insert(self.destroyedBodies, square2:getBody()) end end self.world:setCallbacks(beginContact) table.insert(self.square, Test('square', VIRTUAL_WIDTH/2, VIRTUAL_HEIGHT/2, 'square1', self.world)) table.insert(self.square, Test('square', VIRTUAL_WIDTH/2, VIRTUAL_HEIGHT/3, 'square2', self.world))…
answer count: 0
tagged with: lua
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/137881682
has title: setuserdata and getuserdata in lua
tagged with: love2d
downvote count: 0
score: 1
type: UnansweredQuestion
favorite count: 0

http://stackoverflow.com/comment/137891241
comment on: http://stackoverflow.com/q/78215348
has text: Apply a proper indentation to your code, and the mistake will become obvious
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/78221180
downvote count: 0
has title: Lua | String Pattern Replacement
score: 2
tagged with: lua
type: UnansweredQuestion
tagged with: string
favorite count: 0
upvote count: 2
tagged with: replace
tagged with: arrays
has answer: http://stackoverflow.com/a/78221257
has body: local str = { ["red"] = "ff0000", ["blue"] = "4C9FFF", ["purple"] = "C33AFF", ["green"] = "53FF4A", ["gray"] = "E2E2E2", ["black"] = "000000", ["white"] = "ffffff", ["pink"] = "FB8DFF", ["orange"] = "FF8E1C", ["yellow"] = "FAFF52", --TODO Add Colors } function str:generate_string(text) assert(text and type(text) == "string") local function replaceColor(match) local colorName = match:sub(2) local colorValue = self[colorName] if colorValue then return "#" .. colorValue else return match end end local pattern = "(&%w+)" local result = text:gsub(pattern, replaceColor) return result end local text = "&whiteHello&white World" print(str:generate_string(text)) 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 '&' sign, with their hexadecimal code. This code works fine as long as there is a space after the last letter. For example: "Hello&green World" Result: "Hello#53FF4A World" However, if there is no space after the pattern, like: "Hello &greenWorld" Then the code behaves incorrectly: Hello &greenWorld Is there a way to fix this issue? Also, if there's a more efficient way to implement this code, I'd appreciate your input. I expect the code to produce such a result: For example: "Hello &greenWorld" Result: "Hello #53FF4AWorld"
has answer: http://stackoverflow.com/a/78224407
answer count: 3
type: Question
has answer: http://stackoverflow.com/a/78221248

unsigned-integer
type: Tag
tags question: http://stackoverflow.com/q/78243678
tag name: unsigned-integer

http://stackoverflow.com/a/78258623
answers question: http://stackoverflow.com/q/78257369
has body: If you use Windows: os.execute("cls") On Unix: os.execute("clear") but I do recommend you read it: post
score: 0
downvote count: 1
upvote count: 1
type: Answer

http://stackoverflow.com/a/78189469
downvote count: 1
answers question: http://stackoverflow.com/q/78189404
type: Answer
upvote count: 0
has body: 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. 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. 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.
score: -1

http://stackoverflow.com/comment/137890819
type: Comment
has text: Thanks. I suppose this ends up being functionally the same as `À-ÿ` or `Ā-Í` respectively?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78214900

http://stackoverflow.com/comment/137890186
has text: 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
comment on: http://stackoverflow.com/q/78213071
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137952049
has text: The mistake is somewhere outside this code fragment
type: Comment
comment on: http://stackoverflow.com/q/78245755
score: 0
type: QuestionComment

http://stackoverflow.com/a/78294140
type: Answer
has body: You aren't referencing Humanoid properly when you are trying to get the WalkSpeed. You are using plr:FindFirstChild("Humanoid") when you should be using plr.Character:FindFirstChild("Humanoid") or the humanoid variable you already have. Currently, you are trying to find Humanoid in Player but it will cause attempt to index nil with 'WalkSpeed' since Humanoid isn't in Player but Player.Character so it fails to find WalkSpeed and Humanoid. Below I corrected the script to use the humanoid variable when trying to get the Player's WalkSpeed. local plrs = game:GetService("Players") plrs.PlayerAdded:Connect(function(plr) task.wait(3) local humanoid = if plr.Character then plr.Character:FindFirstChild("Humanoid") else nil if humanoid then print("Found Humanoid") humanoid.WalkSpeed = plr.leaderstats.Speed.value end end)`
answers question: http://stackoverflow.com/q/78293775
score: 0

http://stackoverflow.com/q/78305561
has answer: http://stackoverflow.com/a/78308665
linked to: http://stackoverflow.com/q/73270146
has comment: http://stackoverflow.com/comment/138051482
tagged with: lua
score: 1
has comment: http://stackoverflow.com/comment/138050872
type: UnansweredQuestion
answer count: 2
tagged with: neovim
has body: 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. 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 how would I convert this into a neovim lua keymap. I have looked online and have struggled to find a solution and I'm really new to using vim / neovim
has title: how would I convert a vim mapping to a neovim mapping?
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/78382872
tagged with: vim
downvote count: 1
upvote count: 2

http://stackoverflow.com/q/78263055
has body: Using an LSP in Neovim, you can go to an object's definition by placing the cursor over the symbol in question and hitting <C-]> or <gc>. I'd like to be able to use this behaviour in Lua, i.e. to be able to run something like :lua 'jump_to_definition("foobar")' and have the definition for foobar open as if I had entered <C-]> with my cursor over the foobar symbol. Browsing the Neovim documentation, I see that <C-]> is powered by vim.lsp.buf.definition(options). The documentation about what exactly options 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. vim.lsp.tagfunc(pattern, flags) 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 <C-]>. You can test this using, e.g. :lua print(vim.inspect(vim.lsp.tagfunc("foobar", "cir", 0))). 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.
type: Question
downvote count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/137984617
tagged with: lua
tagged with: neovim
has comment: http://stackoverflow.com/comment/137982567
upvote count: 1
type: UnansweredQuestion
has title: How can I 'go to definition' programmatically using Lua?
score: 1
favorite count: 0

http://stackoverflow.com/q/78239786
has title: Lua: is there a need to use hash of string as a key in lua tables
answer count: 3
downvote count: 0
score: 2
tagged with: lua
possible better answer: http://stackoverflow.com/a/78240279
tagged with: lua-table
has body: 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. -- dict here is just an example, it's going to be loadaed from a text file dict = {["foo"] = true, ["bar"] = true, ...} function dict.contains(self, word) do return self[word] end Is this option good enough? Or maybe this one would be better: -- hash(string) is an exisiting external function dict = {hash("foo") = true, hash("bar") = true, ... up to 20k} function dict.contains(self, word) do return self[hash(word)] end 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?
has answer: http://stackoverflow.com/a/78240279
has answer: http://stackoverflow.com/a/78240789
upvote count: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/78240232
favorite count: 0
tagged with: hash
type: Question
has answer: http://stackoverflow.com/a/78240232

http://stackoverflow.com/comment/137882707
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78209189
has text: 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.

http://stackoverflow.com/q/78216065
has title: Match start of line or an arbitrary number of spaces
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/78228118
score: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137895245
tagged with: lua
downvote count: 1
type: Question
upvote count: 1
tagged with: lua-patterns
has answer: http://stackoverflow.com/a/78228118
has body: I would like to convert Hello a/b hi into Hello \frac{a}{b} hi a/b hi into \frac{a}{b} hi Hello a/b into Hello \frac{a}{b} where a and b is any non space character, using Lua patterns. I came up with a pattern for each of those 3 cases: line, _ = string.gsub(line, "%s+(%S+)/(%S+)%s+", "\\frac{%1}{%2}") line, _ = string.gsub(line, "^(%S+)/(%S+)%s+", "\\frac{%1}{%2}") line, _ = string.gsub(line, "%s+(%S+)/(%S+)$", "\\frac{%1}{%2}") Is it possible to condense them into a single regular expression? Because [^%s] would resolve to the complement of the %s character class, that is, all non-space characters (equivalent to %S), rather than space or start of line.
has comment: http://stackoverflow.com/comment/137892371

http://stackoverflow.com/comment/138044949
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78301093
type: QuestionComment
has text: `(your_string):match '^ +':len ()`

http://stackoverflow.com/comment/137986390
has text: 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?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78209978

http://stackoverflow.com/a/78229582
downvote count: 0
type: Answer
has body: local formats = { '99-XX-XX', '99-XXX-9', '9-XXX-99', 'XX-999-X', 'X-999-XX' } -- Convert formats to pattern =&gt; replacement pairs: local regexes = {} for _, mask in ipairs (formats) do -- Pattern operates over plate stripped of dashes: local pattern = mask:gsub ('[^X9]', ''):gsub ('[X9]', '(%0)'):gsub ('9', '%%d'):gsub ('X', '%%a') local capture = 0 local replacement = mask:gsub ('.', function (char) if char == 'X' or char == '9' then capture = capture + 1 return '%' .. tostring (capture) else return char end end) regexes [pattern] = replacement end local function format (plate) local stripped = plate:gsub ('[^%a%d]', '') for pattern, replacement in pairs (regexes) do if stripped:match (pattern) then local formatted = stripped:gsub (pattern, replacement) return formatted end end return plate end local cases = { '12-ab-cd', '12abcd', '12a-bc-d', 'not a plate' } for _, case in ipairs (cases) do print (case, format (case)) end
score: 1
answers question: http://stackoverflow.com/q/78227135
upvote count: 1

http://stackoverflow.com/comment/137978271
comment on: http://stackoverflow.com/a/78258776
type: Comment
has text: 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.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137912966
comment on: http://stackoverflow.com/a/78221248
has text: 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.
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/137937345
comment on: http://stackoverflow.com/q/78240791
type: Comment
score: 1
has text: 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.
type: QuestionComment

http://stackoverflow.com/comment/137909136
has text: Overlapping rectangles would be slightly undesirable, but it would still be a valid and workable solution.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78209189
type: Comment

http://stackoverflow.com/comment/137786749
type: Comment
comment on: http://stackoverflow.com/a/78156112
score: 0
type: AnswerComment
has text: Thank you very much, @Xaviou! Can you recommend a good resource with examples wxLua and documentation?

http://stackoverflow.com/comment/137821256
comment on: http://stackoverflow.com/q/78175954
type: Comment
has text: Does this answer your question? [LUA Variables as Table Keys](https://stackoverflow.com/questions/11359737/lua-variables-as-table-keys)
score: 1
type: QuestionComment

http://stackoverflow.com/comment/137984486
type: Comment
comment on: http://stackoverflow.com/q/78262662
type: QuestionComment
score: 0
has text: if #char.noteGroup == 0, try next(char.noteGroup) instead, # only works for indexed 1, 2, 3, etc. tables. next will get the first member

http://stackoverflow.com/comment/137789807
has text: Why do you check the state of CapsLock and NumLock?
score: 0
comment on: http://stackoverflow.com/q/78149365
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/138037637
comment on: http://stackoverflow.com/q/78289911
type: Comment
has text: Which shell do you use? Does `mkdir nonExistingDir/tmp` works is that shell? Does `mkdir -p nonExistingDir/tmp` (`-p` added) works is that shell?
type: QuestionComment
score: 0

http://stackoverflow.com/a/78278955
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78278826
answers question: http://stackoverflow.com/q/78278826
score: 0
has comment: http://stackoverflow.com/comment/138018094
has body: 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). 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.) 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. -- Set the filename of your code here local filename = "my_script.lua" -- Paste your lookup table here local var = { [1] = "dothis", [2] = "clevermaths", [3] = "longstring" } -- read the file local file = io.open(filename, "r") local text = file:read("a") file:close() -- replace each of the table entries for i, repl in pairs(var) do local key = "var%[" .. i .. "%]" text = text:gsub(key, repl) end -- save the changes file = io.open(filename, "w") file:write(text) file:close() After executing this script, your file should have been updated with all the replacements you had in your lookup table. 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. *) or at least, a JavaScript build system, like grunt or npm — the code itself can be any executable.

http://stackoverflow.com/q/78185511
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/78185603
accepted answer: http://stackoverflow.com/a/78185603
tagged with: lua
tagged with: lua-table
favorite count: 0
score: -1
type: AnsweredQuestion
has body: I want to make a Table in lua with io.read, This is my code: local members = {} io.write("How many members you wanna add? ") local memberNum = io.read("n") print("Add new member: ") for i = 1, memberNum do local newMember = io.read("*l") if i == 1 then members[1] = newMember else table.insert(members, i, newMember) end end for i = 1, #members do print(i, ": ", members[i]) end I expect to result be: members = { "Amir", "Hamid", "Bahar", "Emad", "Maryam"} but program only accept 4 input from me and insert first input as a nil value and give me this result: members = {"", "Amir", "Hamid", "Bahar", "Emad"} What is the problem? Help me pls
has title: How to make table from io.read in lua
downvote count: 1
answer count: 1

http://stackoverflow.com/comment/137887210
score: 0
comment on: http://stackoverflow.com/q/78213071
type: Comment
has text: @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.
type: QuestionComment

http://stackoverflow.com/q/78246221
tagged with: logitech
score: 0
answer count: 0
has body: I dont really know how to code Lua, I made a script, when "Numlock" is on the script clicks "a" for a random time duration, then releases "a" and it presses "s" for random time. repeats the script until numlock is turned off. it doesn't work tho.. function OnEvent(event, arg) OutputLogMessage("wawa") if event == sKeyLockOn("Numlock") then repeat PressKey("a") Sleep(math.random(8700, 8900)) ReleaseKey("a") Sleep(2) PressKey("s") Sleep(math.random(8700, 8900)) ReleaseKey("s") Sleep(2) until not IsKeyLockOn("Numlock") end end this code doesn't work for some reason, I tried using mouse button instead of numlock but no luck
tagged with: lua
has comment: http://stackoverflow.com/comment/137953472
type: Question
has title: LGHUB Lua script
tagged with: logitech-gaming-software
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/78247619

http://stackoverflow.com/q/78250537
tagged with: lua
has answer: http://stackoverflow.com/a/78250564
tagged with: roblox
tagged with: roblox-studio
has title: Backpack for roblox simulator game
has comment: http://stackoverflow.com/comment/137953676
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
answer count: 2
has answer: http://stackoverflow.com/a/78281481
has body: I need a part to be incerted to the character's body everytime they respawn Here's the script I made: local Backpack = game:GetService("ReplicatedStorage"):Waitforchild("Backpack") local Player = game:GetService("Players").localplayer Player.Character.Respawned:Connect(function(Character) local clone = Backpack:clone(Character.Torso) end
type: Question
upvote count: 1

http://stackoverflow.com/comment/137917254
type: AnswerComment
comment on: http://stackoverflow.com/a/78227484
type: Comment
score: 0
has text: I added `MyFormat(s)` function. Use `Plate = MyFormat(Plate)`

http://stackoverflow.com/q/78293775
has title: Apply leaderstat value on humanoid
has answer: http://stackoverflow.com/a/78294140
answer count: 2
has answer: http://stackoverflow.com/a/78300159
type: UnansweredQuestion
score: 0
tagged with: lua
type: Question
has body: I'm making a button increase leaderstat value of "Speed", then, apply that leaderstat value on to the WalkSpeed value of the players humanoid. (make them the same) 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. Code for joining game, In ServerScriptService: local plrs = game:GetService("Players") plrs.PlayerAdded:Connect(function(plr) task.wait(3) local humanoid = if plr.Character then plr.Character:FindFirstChild("Humanoid") else nil if humanoid then print("Found Humanoid") plr:FindFirstChild("Humanoid").WalkSpeed = plr.leaderstats.Speed.value end end) Here is the error: ServerScriptService.Script:10: attempt to index nil with 'WalkSpeed' 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.
tagged with: roblox

http://stackoverflow.com/q/78215348
tagged with: lua
tagged with: scripting
has title: How to make toggle key to switch between two seperate functions lua script(logitech)
downvote count: 1
upvote count: 1
answer count: 1
type: UnansweredQuestion
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/137891246
has answer: http://stackoverflow.com/a/78215421
tagged with: logitech
has comment: http://stackoverflow.com/comment/137891241
type: Question
has body: 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 else 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. EnablePrimaryMouseButtonEvents(true); function OnEvent(event,arg) if EnableRCS ~= false then if RequireToggle ~= false then if IsKeyLockOn(ToggleKey)then if IsMouseButtonPressed(3)then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(-1,RecoilControlStrength) Sleep(DelayRate) MoveMouseRelative(0,RecoilControlStrength) Sleep(DelayRate) MoveMouseRelative(-2,RecoilControlStrength) Sleep(DelayRate) MoveMouseRelative(0,RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end else if IsMouseButtonPressed(3)then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0,RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end else end end The top part of the code (before else 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.

http://stackoverflow.com/a/78214900
score: 1
has body: 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). ------------------------ just generate set Latin-1 Supplement local set = "" for x = 0x80, 0xBF do set = set .. string.char("0xC3", string.format("0x%x",x) ) end print(set) -------------------------- --- get it from print above local ex = ÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ -- By analogy you can get Extended Latin A: -- local ext_latin_A = ĀāĂăĄąĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıĲĳĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňŉŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſÍ tag = "språk" print("-----") print( tag:match("[%w".. ex .."]+") )
has comment: http://stackoverflow.com/comment/137891220
has comment: http://stackoverflow.com/comment/137890819
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78213846
upvote count: 1

http://stackoverflow.com/comment/137891097
comment on: http://stackoverflow.com/a/78214926
type: Comment
has text: Thanks for the explanation, I haven't had an idea about the differences between the 2 versions, much appreciative
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137984581
comment on: http://stackoverflow.com/q/78262662
type: Comment
score: 1
type: QuestionComment
has text: 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)

http://stackoverflow.com/a/78333552
has body: In your screenshot, there is a minus symbol before your if statement checking the character count. -if localPlayer:getData('charlimit') &lt;= 1 then exports.notification:create('Karakter sinıriniz dolmuş!', 'error') return end Just remove the minus symbol before the if statement and it should fix the if statement not working. if localPlayer:getData('charlimit') &lt;= 1 then exports.notification:create('Karakter sinıriniz dolmuş!', 'error') return end 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.
type: Answer
answers question: http://stackoverflow.com/q/78295406
score: 0

http://stackoverflow.com/comment/137823523
comment on: http://stackoverflow.com/q/78175954
type: Comment
score: 0
has text: @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.
type: QuestionComment

premake
type: Tag
tags question: http://stackoverflow.com/q/78289911
tag name: premake
tags question: http://stackoverflow.com/q/78535770
tags question: http://stackoverflow.com/q/78537917
tags question: http://stackoverflow.com/q/78734889
tags question: http://stackoverflow.com/q/78766168
tags question: http://stackoverflow.com/q/79180391
tags question: http://stackoverflow.com/q/79106182
tags question: http://stackoverflow.com/q/79535091

http://stackoverflow.com/comment/137956286
score: 1
comment on: http://stackoverflow.com/q/78251628
type: QuestionComment
has text: You can simulate const globals with _G metatable.
type: Comment

calculation
type: Tag
tag name: calculation
tags question: http://stackoverflow.com/q/78189404

http://stackoverflow.com/a/78221248
has body: Please try simpler solution as ["&green"] = "#53FF4A".
type: Answer
has comment: http://stackoverflow.com/comment/137912966
has comment: http://stackoverflow.com/comment/137904690
answers question: http://stackoverflow.com/q/78221180
upvote count: 1
downvote count: 2
score: -1

http://stackoverflow.com/q/78220636
has title: SQLite3 Min and Max values with thier respective timestamp
tagged with: lua
type: Question
has body: 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) 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 I tried the following based on the code I got from the net. local query = string.format(SELECT MIN(A0) AS min_valueA0, MAX(A0) AS max_valueA0, MIN(A1) AS min_valueA1, MAX(A1) AS max_valueA1, MIN(A2) AS min_valueA2, MAX(A2) AS max_valueA2, MIN(A3) AS min_valueA3, MAX(A3) AS max_valueA3, MIN(time) AS min_time, MAX(time) AS max_time FROM fivmin_tbl time &gt;= %d AND time &lt; %d, StartDate, FinishtDate) The Max and Min values need to be between StartDate and FinishtDate local stmt = db:prepare(query) local result = stmt:step() stmt statement above cause an error How do I change the code to make it work?
tagged with: sqlite
has comment: http://stackoverflow.com/comment/137902879
has comment: http://stackoverflow.com/comment/137900961
type: UnansweredQuestion
score: 0
answer count: 0

http://stackoverflow.com/q/78240791
downvote count: 0
has comment: http://stackoverflow.com/comment/137939865
linked to: http://stackoverflow.com/q/588004
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137937345
score: 1
has comment: http://stackoverflow.com/comment/137941315
duplicate of: http://stackoverflow.com/q/588004
has comment: http://stackoverflow.com/comment/137939538
upvote count: 1
favorite count: 0
type: Question
has body: How can I make the examples return the result "true". What are my mistakes? MWE: local arr = {{a = 1, b = 3, op = ">=", c = 7}, {a = 1, b = 3, op = "<=", c = 6}} local str1, str2, x1, x2, i x1 = 0 x2 = 2 + 1/3 -- 2.(3) i = 1 str1 = arr[i].a .. "*" .. tostring(x1) .. "+" .. arr[i].b .. "*" .. tostring(x2) .. arr[i].op .. arr[i].c str2 = arr[i].a .. "*" .. tostring(x1) .. "+" .. arr[i].b .. "*" .. tostring(x2) f = loadstring("return " .. str1) f1 = loadstring("return " .. str2) print(str1, f(), str2 .. " = " .. f1()) -- It doesn't work that way print(0 + 3 * (2 + 1/3), 7, 0 + 3 * (2 + 1/3) >= 7) -- And here it seems similar, but everything works x1 = 1.2 x2 = 1.6 i = 2 str1 = arr[i].a .. "*" .. tostring(x1) .. "+" .. arr[i].b .. "*" .. tostring(x2) .. arr[i].op .. arr[i].c str2 = arr[i].a .. "*" .. tostring(x1) .. "+" .. arr[i].b .. "*" .. tostring(x2) f = loadstring("return " .. str1) f1 = loadstring("return " .. str2) print(str1, f(), str2 .. " = " .. f1()) -- It’s completely unclear here! It turns out 6 is not equal to 6 I get this result: I used the manual number comparison function. Its code is presented below. This solution seemed to allow me to do what I needed. local function compare(a, b, epsilon, comparison) if comparison == "==" then return math.abs(a - b) < epsilon elseif comparison == "<" then return a < b - epsilon elseif comparison == "<=" then return a <= b + epsilon elseif comparison == ">" then return a > b + epsilon elseif comparison == ">=" then return a >= b - epsilon else error("Invalid comparison operator: " .. comparison) end end
has title: Incorrect number comparison result (Lua)
answer count: 0
has comment: http://stackoverflow.com/comment/137939490

http://stackoverflow.com/comment/137968641
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78257369
type: QuestionComment
has text: On Linux terminal, try `io.write("\27c")`

http://stackoverflow.com/comment/138080082
type: Comment
has text: @Gamer2VR you should read into this. [Remote Events and Callbacks](https://create.roblox.com/docs/scripting/events/remote)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78307245

http://stackoverflow.com/a/78209978
answers question: http://stackoverflow.com/q/78209045
has comment: http://stackoverflow.com/comment/137986390
has body: lua_setglobal will pop the c function from the stack, causing lua_pcallk to call an invalid location, you need to duplicate the c function before setting global. lua_pushcfunction(L1, foreach); lua_pushvalue(L1, -1); lua_setglobal(L1, "foreach"); res = lua_pcallk(L1, 0, 0, 0, 0, resume_func_continuation);
type: Answer
has comment: http://stackoverflow.com/comment/137986387
score: 0

http://stackoverflow.com/comment/137891246
has text: `if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then ... end`
comment on: http://stackoverflow.com/q/78215348
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/78219171
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/137900197
favorite count: 0
accepted answer: http://stackoverflow.com/a/78220745
has comment: http://stackoverflow.com/comment/137899433
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137898025
has answer: http://stackoverflow.com/a/78220745
has body: 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 for example local mytable = { ["name10"] = 6, ["name9"] = 10, ["name8"] = 8, ["name7"] = 4, ["name6"] = 1, ["name5"] = 7, ["name4"] = 2, ["name3"] = 3, ["name2"] = 5, ["name1"] = 9 } it needs to return this local sorted_table = { ["name9"] = 10, ["name1"] = 9, ["name8"] = 8, ["name5"] = 7, ["name10"] = 6, ["name2"] = 5, ["name7"] = 4, ["name3"] = 3, ["name4"] = 2, ["name6"] = 1 } i was looking for a solution to this problem, but everywhere it gave out exactly the key and the value separately, not the table
type: Question
downvote count: 0
score: 1
tagged with: lua
has title: lua sort table by values
tagged with: roblox-studio

http://stackoverflow.com/q/78209045
answer count: 1
type: UnansweredQuestion
has title: lua_continuation, lua_thread functions
tagged with: thread-safety
tagged with: resume
score: 0
type: Question
has body: Trying to make the following code in lua 5.4 static int foreach(lua_State *L){ luaL_checktype(L, 1, LUA_TTABLE); luaL_checktype(L, 2, LUA_TFUNCTION); lua_getglobal(L, "print"); if (!lua_rawequal(L, -1, 2)) { lua_pop(L, 1); return luaL_error(L, "Second argument must be the 'print' function"); } lua_pop(L, 1); lua_yield(L, 0); lua_pushnil(L); while (lua_next(L, 1) != 0) { lua_pushvalue(L, 2); // push print lua_pushvalue(L, -3); // push key lua_pushvalue(L, -3); // push value lua_call(L, 2, 0); lua_pop(L, 1); } return 0; } static int resume_func_continuation(lua_State * L, int status, lua_KContext ctx) { int res; (void) ctx; if (status != LUA_YIELD) { luaL_error(L, "Thread was not yielding. %s", lua_tostring(L, -1)); exit(1); } lua_getglobal(L, "foreach"); char *lua_Code = "foreach({x = 10, y = 20}; print)"; res = luaL_dostring(L, lua_Code); if (res != LUA_OK) { luaL_error(L, "Error running lua_Code. %s\n", lua_tostring(L, -1)); } lua_close(L); exit(0); } int main(void) { int res; lua_State *L = luaL_newstate(); if (L == NULL) luaL_error(L, "Error creating new state. %s\n", lua_tostring(L, -1)); luaL_openlibs(L); lua_State *L1 = lua_newthread(L); if (L1 == NULL) { luaL_error(L, "Error, cannot create new thread. %s", lua_tostring(L, -1)); exit(1); } lua_pushcfunction(L1, foreach); lua_setglobal(L1, "foreach"); res = lua_pcallk(L1, 0, 0, 0, 0, resume_func_continuation); if (res != LUA_OK) { luaL_error(L, "Error calling foreach function. %s", lua_tostring(L, -1)); exit(1); } //lua_closethread(L1, L); return 0; } 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...
has answer: http://stackoverflow.com/a/78209978
tagged with: lua-5.4
tagged with: lua

http://stackoverflow.com/q/78290698
accepted answer: http://stackoverflow.com/a/78303552
type: Question
downvote count: 0
tagged with: plugins
tagged with: nvim.cmp
tagged with: lua
has title: Nvim-cmp throwing error when expanding snippets
has answer: http://stackoverflow.com/a/78303552
tagged with: neovim
upvote count: 1
has body: 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. The snippets and suggestions appear correctly but when any of them are selected, I receive this error: I'm having trouble debugging the specific issue causing this and why it is only an issue with the Lua language. Here is my nvim-cmp.lua config file (using lazy as my plugin loader): return { "hrsh7th/nvim-cmp", event = "InsertEnter", dependencies = { "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", "onsails/lspkind.nvim", "L3MON4D3/LuaSnip", "saadparwaiz1/cmp_luasnip", "rafamadriz/friendly-snippets", "hrsh7th/cmp-nvim-lsp", }, config = function() local cmp = require("cmp") local luasnip = require("luasnip") local lspkind = require("lspkind") require("luasnip.loaders.from_vscode").lazy_load() vim.opt.completeopt = "menu,menuone,preview,noselect" cmp.setup({ snippet = { expand = function(args) luasnip.lspexpand(args.body) end, }, mapping = cmp.mapping.preset.insert({ ["<C-k>"] = cmp.mapping.select_prev_item(), ["<C-j>"] = cmp.mapping.select_next_item(), ["<C-b>"] = cmp.mapping.scroll_docs(-4), ["<C-f>"] = cmp.mapping.scroll_docs(4), ["<C-Space>"] = cmp.mapping.complete(), ["<C-e>"] = cmp.mapping.abort(), ["<CR>"] = cmp.mapping.confirm({ select = false }), }), sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" }, }), formatting = { format = lspkind.cmp_format({ maxwidth = 50, ellipsis_char = "...", }), }, }) end, } Please let me know any further context I can add.
score: 1
favorite count: 0
type: AnsweredQuestion
answer count: 1

http://stackoverflow.com/a/78160572
has comment: http://stackoverflow.com/comment/137794469
has comment: http://stackoverflow.com/comment/137794661
type: AcceptedAnswer
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/137794189
accepted answer of: http://stackoverflow.com/q/78160089
score: 1
has body: 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: lua_createtable(L, 4, 0); When you use pairs to iterate over a table, its order is always unspecified.
has comment: http://stackoverflow.com/comment/137794494
answers question: http://stackoverflow.com/q/78160089
downvote count: 0

http://stackoverflow.com/comment/137914027
has text: 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 Plate = string.upper(GetRanPlateNum(2) .. GetRandLetter(4)) GetRanPlate and GetRandLetter are also seperate functions.
comment on: http://stackoverflow.com/a/78227484
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/78279899
upvote count: 0
type: Answer
has body: -- game.ServerScriptService.Modules.PlayerData require(script.Parent.DataManager)
has comment: http://stackoverflow.com/comment/138006427
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/78275372

http://stackoverflow.com/comment/137888380
type: QuestionComment
has text: Sorry @shingo , It was copied from my own files which had another names. I edited and corrected the question
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78210778

http://stackoverflow.com/comment/138064857
type: QuestionComment
has text: 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.
score: 0
comment on: http://stackoverflow.com/q/78300144
type: Comment

http://stackoverflow.com/a/78383663
accepted answer of: http://stackoverflow.com/q/78262990
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78262990
has body: It was relative easy: two parabolas with given focus crossing as line. The result line is perpendicular bisector between two points: function focusFocusLineYCrossing (p1x, p1y, p2x, p2y, y) local cx = (p1x+p2x)/2 local cy = (p1y+p2y)/2 local m = (p2y-p1y)/(p2x-p1x) -- slope local x = cx - m*(y-p1y) -- perpendicular to slope return x end

http://stackoverflow.com/comment/137901313
type: QuestionComment
comment on: http://stackoverflow.com/q/78214965
score: 1
type: Comment
has text: @vitiral Roblox's implementation of Lua ("Luau") does support the `-=` and similar operators.

http://stackoverflow.com/q/78227135
has answer: http://stackoverflow.com/a/78229582
has answer: http://stackoverflow.com/a/78227484
answer count: 3
upvote count: 2
type: Question
has body: 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 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. So the formatting would have to be done on how it detects the combination. Current combinations are 9 = number obviously, X = letter 99-XX-XX 99-XXX-9 9-XXX-99 XX-999-X X-999-XX How would I go around detecting it in LUA, and have it properly dash based on what it detects? Is it even doable? I have no idea on how to approach this as I'm still a novice in LUA. Any help would be appreciated
score: 2
tagged with: lua
downvote count: 0
has title: Lua string formatting on the basis of number and letter combinations
has comment: http://stackoverflow.com/comment/137913500
has comment: http://stackoverflow.com/comment/137943218
has answer: http://stackoverflow.com/a/78227704
type: UnansweredQuestion
favorite count: 0

http://stackoverflow.com/comment/138079718
comment on: http://stackoverflow.com/a/78307245
score: 0
type: AnswerComment
has text: And how I can configure a RemoteEvent to do that?
type: Comment

http://stackoverflow.com/q/78243000
score: 0
tagged with: neovim-plugin
tagged with: neovim
answer count: 1
accepted answer: http://stackoverflow.com/a/78247404
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78247404
has body: 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. I installed packer as my plugin manager here's the code i put in the init.lua file . -- Replace with your actual Neovim configuration file path vim.cmd(packadd packer.nvim) -- Replace with your actual Neovim configuration file path local packer = require('packer') packer.init({ use{ "kylenchui/nvim-surround", tag = "*", config = function() require("nvim-surround").setup({}) end } }) -- Disable compatibility with vi which can cause unexpected issues. vim.opt.compatible = false -- Enable type file detection. NeoVim will be able to try to detect the type of file in use. vim.cmd('filetype on') -- Enable plugins and load plugin for the detected file type. vim.cmd('filetype plugin on') -- Load an indent file for the detected file type. vim.cmd('filetype indent on') -- Enable syntax highlighting. vim.cmd('syntax enable') -- Set relative line numbers. vim.opt.relativenumber = true -- Set shift width to 4 spaces. vim.opt.shiftwidth = 4 -- Set tab width to 4 columns. vim.opt.tabstop = 4 -- Use space characters instead of tabs. vim.opt.expandtab = true -- Do not save backup files. vim.opt.backup = false -- Do not let cursor scroll below or above N number of lines when scrolling. vim.opt.scrolloff = 10 -- Do not wrap lines. Allow long lines to extend as far as the line goes. vim.opt.wrap = false -- While searching through a file, incrementally highlight matching characters as you type. vim.opt.incsearch = true -- Ignore capital letters during search. vim.opt.ignorecase = true -- Override the ignorecase option if searching for capital letters. -- This will allow you to search specifically for capital letters. vim.opt.smartcase = true -- Show partial command you type in the last line of the screen. vim.opt.showcmd = true -- Show the mode you are in on the last line. vim.opt.showmode = true -- Show matchi…
has comment: http://stackoverflow.com/comment/137940909
type: Question
has title: having trouble installing neovim plugin
tagged with: lua

http://stackoverflow.com/comment/137951592
type: Comment
score: 0
type: QuestionComment
has text: Are you need just cooldown / countdown for damage?
comment on: http://stackoverflow.com/q/78249339

rectangles
tag name: rectangles
tags question: http://stackoverflow.com/q/78209189
type: Tag

http://stackoverflow.com/comment/137926735
type: AnswerComment
comment on: http://stackoverflow.com/a/78228232
has text: 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.
score: 1
type: Comment

http://stackoverflow.com/q/78151700
has answer: http://stackoverflow.com/a/78158406
type: UnansweredQuestion
has title: Is there a way to execute command from array with "for do"?
answer count: 2
has body: New to lua. On example i have multiple local part1 = display.newImage("part1.png", 0, 0) part1:scale ( 0.5, 0.5) part1.isVisible = false ... local part10 = display.newImage("part10.png", 0, 0) part10:scale ( 0.5, 0.5) part10.isVisible = false How can i optimize it using array and for do? Like execute multiple commands from one for-loop whem command only has different numbers? Im sure that this wont work but there should be a way to do what i want? for i = 1, 10 do part[i]:scale ( 0.5, 0.5) part[i].isVisible = false
score: 0
tagged with: arrays
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/78151815
tagged with: lua

http://stackoverflow.com/q/78164268
tagged with: c-api
accepted answer: http://stackoverflow.com/a/78164919
score: 1
type: AnsweredQuestion
tagged with: continuations
answer count: 1
has answer: http://stackoverflow.com/a/78164919
upvote count: 1
favorite count: 0
type: Question
downvote count: 0
has body: 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. I have the following code: // Attempt to yield C-Function, into protected mode. - Continuation Function - static int finishpcall (lua_State *L, int status, intptr_t ctx) { (void)ctx; // unused parameter status = (status != LUA_OK && status != LUA_YIELD); lua_pushboolean(L, (status == 0)); // status lua_insert(L, 1); // status is first result printf("%s, %d\n", "From lua", lua_gettop(L)); // it is lua's stack frame = 1 lua_getglobal(L, "co"); lua_resume(lua_tothread(L, 2), NULL, 0, 0); lua_resume(lua_tothread(L, lua_gettop(L)), NULL, 0, 0); return lua_gettop(L); // return status + all results } static int luaB_pcall (lua_State *L) { int status; luaL_checkany(L, 1); status = lua_pcallk(L, lua_gettop(L) - 1, LUA_MULTRET, 0, 0, finishpcall); return finishpcall(L, status, 0); } int main(void) { lua_State *L = luaL_newstate(); luaL_openlibs(L); // Register luaB_pcall as a Lua function lua_register(L, "pcall", luaB_pcall); const char *str = "function test() \ local co = coroutine.create(function() print('me') \ coroutine.yield() \ print('me me') \ end) \ return co \ end \ pcall(test)"; int res = luaL_dostring(L, str); if (res != LUA_OK) { printf("Error running Lua code: %s\n", lua_tostring(L, -1)); lua_close(L); return 1; } printf("%s, %d\n", "From C-Function", lua_gettop(L)); //it is C's stack frame = 0 lua_close(L); return 0; } Can anyone suggest me why i get segmentaition fault on lua_resume in finishpcall() , although firstly i get From lua, 2 me as results.
has title: lua_resume has segmentation faults
tagged with: lua-5.4
tagged with: lua

http://stackoverflow.com/q/78251874
has comment: http://stackoverflow.com/comment/137956509
type: Question
tagged with: roblox
has title: How to make a ServerScript wait for a LocalScript to fire a RemoteEvent
tagged with: lua
tagged with: roblox-studio
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78255190
has body: 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. 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. I currently only have One GUI button setup (Frontline Policing). The LocalScript can be found below; LocalScript local div = game.ReplicatedStorage.Events.divisionEvent local button = script.Parent local gui = script.Parent.Parent.Parent.Parent button.MouseButton1Down:Connect(function() div:FireServer("Frontline") gui.Enabled = false end) TLDR - I am wondering if it's possible to get a ServerScript to wait for a LocalScript to fire a RemoveEvent with needed information. I've done loads of Research through around 50-60 Roblox Developer Forum posts, and none of them are either; The Same Issue as mine. The Proper Resolution. Not even associated with my issue.
tagged with: luau
answer count: 1

http://stackoverflow.com/comment/137862692
comment on: http://stackoverflow.com/a/78198541
score: 0
type: AnswerComment
has text: Unfortunately it doesn't work. It puts only fix time - the time of open buffer file.
type: Comment

http://stackoverflow.com/comment/137823251
score: 0
comment on: http://stackoverflow.com/a/78176292
has text: Nitpick: `condition and false` may evaluate to `nil` instead of `false` if `condition` is `nil`.
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/137794189
comment on: http://stackoverflow.com/a/78160572
type: Comment
has text: Thanks, the order is now displayed correctly, however, the values for the table SA_1 are still incorrect. SA_1 (table): 1: 0 2: 3 3: 3 4: 3
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137821621
type: Comment
has text: 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]`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78175954

http://stackoverflow.com/a/78295175
has body: From the error message, it says Workspace.Knife.Script which indicates you are using a Script and not a LocalScript (unless you changed the name of LocalScript to Script). In your code, you use local player = game.Players.LocalPlayer but you can't get LocalPlayer if you are not in a LocalScript because Script runs on the server and has no LocalPlayer. Consider changing the class of your script from Script to LocalScript so you can use LocalPlayer.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78282235

http://stackoverflow.com/a/78300159
answers question: http://stackoverflow.com/q/78293775
type: Answer
has body: you should consider using the CharacterAdded event inside the player object. also value should be Value when indexing the IntValue. local Players = game:GetService("Players") Players.PlayedAdded:Connect(function(Player) Player.CharacterAdded:Connect(function(Character) -- fires when player spawned local Humanoid = Character:WaitForChild("Humanoid") -- wait for it to be added to the character if not Player.leaderstats or not Player.leaderstats.Speed then return end -- leaderstats or Speed value not found? Humanoid.WalkSpeed = Player.leaderstats.Speed.Value end) end)
score: 0

http://stackoverflow.com/comment/138018094
type: AnswerComment
comment on: http://stackoverflow.com/a/78278955
type: Comment
has text: Thank you very much for your time and clear explanation. I believe this is the best way to go
score: 0

http://stackoverflow.com/a/78198541
type: Answer
has comment: http://stackoverflow.com/comment/137862692
has body: Vim has a internal strftime function to return a date/time formatted in a way you specify with a format string (see :help strftime). In your code, replace vim.fn.system( tr -d '\n')) by vim.fn.strftime("%H:%M").
answers question: http://stackoverflow.com/q/78188829
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/78300938
has comment: http://stackoverflow.com/comment/138069264
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/138069360
accepted answer of: http://stackoverflow.com/q/78300144
upvote count: 1
has body: I've implemented solution in Python. 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 (0,y). Now I apply transformations to line points, then transform line equation into normal equation form (px+qy+r=0). Then solve quadratic equation: squared radius should be equal to squared distance to the line (simple formula for chosen line equation form). 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. Then transform coordinates back. Example is given for my picture and for your data. import math def circle2ptstangenettoline(ax, ay, bx, by, tx1, ty1, tx2, ty2): dist = math.hypot(ax-bx, ay-by) h = dist/2 ang = math.atan2(by-ay, bx-ax) ux1 = tx1 - ax uy1 = ty1 - ay ux2 = tx2 - ax uy2 = ty2 - ay vx1 = ux1 * math.cos(-ang) - uy1 * math.sin(-ang) - h vy1 = ux1 * math.sin(-ang) + uy1 * math.cos(-ang) vx2 = ux2 * math.cos(-ang) - uy2 * math.sin(-ang) - h vy2 = ux2 * math.sin(-ang) + uy2 * math.cos(-ang) vd = math.hypot(vx2-vx1, vy2-vy1) p = (vy2-vy1) / vd q = (vx1-vx2) / vd r = (vx2*vy1-vx1*vy2) / vd a = q*q-1 b = 2*q*r c = r*r - h*h if a==0: if b==0: return None else: y = -c/b cr = math.hypot(y, h) cx = h * math.cos(ang) - y * math.sin(ang) + ax cy = h * math.sin(ang) + y * math.cos(ang) + ay return (cx, cy, cr) Dis = b*b-4*a*c if Dis &lt; 0: return None if Dis == 0: y = -0.5*b/a cr = math.hypot(y, h) cx = h * math.cos(ang) - y * math.sin(ang) + ax cy = h * math.sin(ang) + y * math.cos(ang) + ay return (cx, cy, cr) y1 = 0.5*(-b - math.sqrt(Dis))/a cr1 = math.hypot(y1, h) cx1 = h * math.cos(ang) - y1 * math.sin(ang) + ax cy1 = h * math.sin(ang) + y1 * math.cos(ang) + ay y2 = 0.5*(-b + math.sqrt(Dis))/a cr2 = math.hypot(y2, h) cx2 = h * math.co…
downvote count: 0
answers question: http://stackoverflow.com/q/78300144
score: 1

http://stackoverflow.com/a/78294469
type: Answer
answers question: http://stackoverflow.com/q/78202258
has comment: http://stackoverflow.com/comment/138057837
score: 0
has body: I believe I have an answer for that, and it's easy and simple, no code needed. The problem is that the UI you made has to have a size that is proportional to the screen size, right? My 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: X Size {0,10} Y Size {0,10}. The reason why this won't scale proportional to the screen's size is because I set the size values in pixels, but I have to set it in percentage of the screen's size, so, instead of doing this: X Size {0,10} Y Size {0,10}, I do this: X Size {0.1,0} Y Size {0.1,0}. By 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 NOT 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. Here are some images to help you: https://i.sstatic.net/uPTl7.png In this picture, you can see that the scale property is equivalent to the first value in the X size property. 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. https://i.sstatic.net/JafoO.png
has comment: http://stackoverflow.com/comment/138142421

packet
type: Tag
tag name: packet
tags question: http://stackoverflow.com/q/78283791

http://stackoverflow.com/a/78281771
upvote count: 1
downvote count: 0
type: Answer
has body: you should look at the humanoid's PlatformStand property char.Humanoid.PlatformStand = true; make sture to disable it when you disable the fly again!
answers question: http://stackoverflow.com/q/78217605
score: 1

http://stackoverflow.com/a/78243719
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/78243644
has body: To the best of my knowledge, it's not possible. Normally, in POSIX ERE a working regex would be: ^/(?:[^\\/]|\\.)*/(?:[^\\/]|\\.)*/(?:[^\\/]|\\.)*$ ...where (?:[^\\/]|\\.) means "either not \ (escaping) and not / (delimiter), or an escaped character". However, Lua patterns don't have |. Quantifiers are also not applicable for groups. That said, there is no way to differentiate normal and escaped characters. The solution is to write your own parser from scratch.
downvote count: 0
score: 2

http://stackoverflow.com/comment/137897880
score: 1
type: Comment
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/78213846

http://stackoverflow.com/a/78216720
upvote count: 1
type: Answer
downvote count: 0
has body: If you're working with a focus x=a,y=b and directrix y=c, then we're already axis-aligned, so that saves a bunch of work. A focus/directrix definition of the parabola is based on distance equivalences, so let's see which distances we can find for the "tip" x,y of the parabola: dist((x,y), (a,b)) = sqrt((x-a)² + (y-b)²), and dist((x,y), (x,c)) = abs(y - c) Easy enough, we can solve the equality sqrt((x-a)² + (y-b)²) = abs(y - c) (either by hand or by using something like wolfram alpha) and get: x² - 2ax + a² + b² -c² f(x) = ----------------------- 2(b-c) which in lua is: function f(x, a, b, c) local n = x*x - 2*a*x + a*a + b*b - c*c local d = 2*(b-c) return n / d end (and we're ignoring what happens when b==c, because we'll never call this function if that is the case, because if the focus lies on the directrix, that's not a parabola) Which means we now have a trivial-to-implement function for getting y=f(x) given any values a, b, and c, as long as b and c are not the same value. We then want to find the equivalent Bezier expression for the segment with end points A=(xa,f(xa)) and B=(xb,f(xb)), which means we're "done" 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. Also note that we do not get a choice in what ay and by are: you only get to pick ax and bx, because f(x) defines what the corresponding ay and by must be. Now, we (implicitly) know what the tangent lines are, because we know the derivative of f(x) (again, either because we worked that out by hand, or we just told a computer to do it for us): x-a f'(x) = --- b-c which in lua is: function df(x, a, b, c) return (x-a) / (b-c) end And so finding that control point is a matter of calculating a standard line/line intersection, because you know A and the tangent at A, and we know B and the tangent at B. Lots of posts on Stackoverflow and pages on the web that explain how to calculate a line/line …
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78214820
has comment: http://stackoverflow.com/comment/137900790
score: 1
has comment: http://stackoverflow.com/comment/137896838
answers question: http://stackoverflow.com/q/78214820
has comment: http://stackoverflow.com/comment/137900761

http://stackoverflow.com/comment/137888453
has text: 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
comment on: http://stackoverflow.com/q/78210282
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/78227484
has comment: http://stackoverflow.com/comment/137917254
has comment: http://stackoverflow.com/comment/137914027
downvote count: 0
has body: We can apply templates to each element in the loop. The gsub function can also capture values in the template itself. This will help us. Read more here.. local function MyFormat(s) local x = s:gsub("(%d%d)(%a%a)(%a%a)","%1-%2-%3") :gsub("(%d%d)(%a%a%a)(%d)","%1-%2-%3") :gsub("(%d)(%a%a%a)(%d%d)","%1-%2-%3") :gsub("(%a%a)(%d%d%d)(%a)","%1-%2-%3") :gsub("(%a)(%d%d%d)(%a%a)","%1-%2-%3") return x end local t = { "99XXXX", "99XXX9" , "9XXX99" , "XX999X", "X999XX"} for k, v in pairs(t) do print(v,MyFormat(v)) end results: 99XXXX 99-XX-XX 99XXX9 99-XXX-9 9XXX99 9-XXX-99 XX999X XX-999-X X999XX X-999-XX Templates will be applied to each line 5 times. If no template is found, then gsub will not change anything in the line, so the first matching template will change the line as needed
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/78227135
score: 2

http://stackoverflow.com/comment/138017153
comment on: http://stackoverflow.com/q/78285075
type: Comment
score: 0
type: QuestionComment
has text: 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

http://stackoverflow.com/comment/137943452
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/78244054
score: 1
type: Comment

http://stackoverflow.com/a/78274946
type: Answer
score: 2
answers question: http://stackoverflow.com/q/78274204
downvote count: 0
has body: Because Assignment, parameter passing, and function returns always manipulate references to such values; these operations do not imply any kind of copy. https://www.lua.org/manual/5.3/manual.html#2.1
has comment: http://stackoverflow.com/comment/138006949
upvote count: 2
has comment: http://stackoverflow.com/comment/138005902

http://stackoverflow.com/comment/137821253
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78175954
has text: Wrap the key name in square brackets: `local foo = 'bar'; print(({ ['baz' .. foo] = 'qux' })['bazbar']) -- qux`.
type: Comment

http://stackoverflow.com/q/78176709
upvote count: 1
has title: How to install Cat UI for LOVE in Lua
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/139081118
downvote count: 1
answer count: 1
score: 0
type: Question
has comment: http://stackoverflow.com/comment/137823364
tagged with: lua
has body: I am trying to make an application with Lua, LOVE and CatUI which I found CatUI before on here. I couldn't found any websites or even their own GitHub page for an installation guide to CatUI. 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. Nothing seems to be working.
has answer: http://stackoverflow.com/a/78222090

http://stackoverflow.com/comment/138006427
type: Comment
has text: you should add context to explain your answer.
type: AnswerComment
comment on: http://stackoverflow.com/a/78279899
score: 2

http://stackoverflow.com/q/78273784
has title: how can i get rid of the bug when if you press shift quickly after stamina runs out you keep running?
tagged with: roblox-studio
tagged with: debugging
type: UnansweredQuestion
score: 0
type: Question
answer count: 0
has body: 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 if you notice any other bugs please tell me its probably because of gradual sped change i added, but i need it handler script: local player = game:GetService("Players").LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local StaminaGui = script.Parent local Holder = StaminaGui:WaitForChild("Holder") local Bar = Holder:WaitForChild("Bar") local AmtDisplay = Holder:WaitForChild("AmtDisplay") local UIS = game:GetService("UserInputService") local Stamina = script.Stamina local isRunning = false local gotTired = false local maxWalkSpeed = 35 -- Max speed when sprinting local normalWalkSpeed = 20 -- Default speed local transitioningSpeed = false -- Function to smoothly change the walk speed local function changeWalkSpeed(targetSpeed, duration) if transitioningSpeed then return end transitioningSpeed = true local startTime = tick() local initialSpeed = humanoid.WalkSpeed while humanoid.WalkSpeed ~= targetSpeed do local elapsedTime = tick() - startTime local t = math.clamp(elapsedTime / duration, 0, 1) humanoid.WalkSpeed = initialSpeed + (targetSpeed - initialSpeed) * t wait() end transitioningSpeed = false end UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then if humanoid.MoveDirection.magnitude > 0 then -- Check if the player is already moving if Stamina.Value >= 1 then if gotTired == false then isRunning = true script.InSprint.Enabled = true script.OutSprint.Enabled = false changeWalkSpeed(maxWalkSpeed, 1.5) -- Smoothly transition to sprint speed over 1.5 seconds end end end end end) UIS.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then isRunning = false script.InSprint.Enabled = false script.OutSprint.Enabled = true changeWalkSpeed(normalWalkSpeed, 1.5) -- Smoothly transition back to default speed over 1.…
tagged with: lua

http://stackoverflow.com/comment/137794661
type: Comment
score: 0
type: AnswerComment
has text: I updated Lua from 5.4.2 to 5.4.4 and now it works ...
comment on: http://stackoverflow.com/a/78160572

http://stackoverflow.com/a/78244356
answers question: http://stackoverflow.com/q/78243644
has body: It is impossible to achieve using a single Lua pattern, but you can chain a few of them: local s = "/<\\/>//b\\\\/c" -- 4 payloads here (the second one is empty) for x in s :gsub("/", "/\1") -- make every payload non-empty by prepending string.char(1) :gsub("\\(.)", "\2%1") -- replace magic backslashes with string.char(2) :gsub("%f[/\2]/", "\0") -- replace non-escaped slashes with string.char(0) :gsub("[\1\2]", "") -- remove temporary symbols string.char(1) and string.char(2) :gmatch"%z(%Z*)" -- split by string.char(0) do print(x) end Output: </> b\ c Or, if you want a single statement instead of a loop: local s = "/<\\/>/b/c" -- 3 payloads here local a, b, c = s :gsub("/", "/\1") -- make every payload non-empty by prepending string.char(1) :gsub("\\(.)", "\2%1") -- replace magic backslashes with string.char(2) :gsub("%f[/\2]/", "\0") -- replace non-escaped slashes with string.char(0) :gsub("[\1\2]", "") -- remove temporary symbols string.char(1) and string.char(2) :match"%z(%Z*)%z(%Z*)%z(%Z*)" -- split by string.char(0)
has comment: http://stackoverflow.com/comment/137945292
score: 3
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78243644
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/78281614
downvote count: 0
score: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78221219
has body: lua arrays start their index at index 1 not 0 like other programming languages https://www.lua.org/pil/11.1.html print(foo.bar[1])
answers question: http://stackoverflow.com/q/78221219
upvote count: 1

http://stackoverflow.com/q/78274204
tagged with: lua
tagged with: memory
tagged with: lua-table
has body: In Lua 5.3, I have a table t1 in which there is only a table, the latter table consisting only of a key [key] pointing to the value 1. t1 = {{key = 1}} My goal is to copy and insert the inner table to an empty second table t2, 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 {key = 1} 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? Thanks in advance. local t1 = {{key = 1}} local t2 = {} table.insert(t2,t1[1]) t2[1].key = t2[1].key + 1 print(t1[1].key, t2[1].key) Result: 2 2 Expected: 1 2
has answer: http://stackoverflow.com/a/78274946
linked to: http://stackoverflow.com/q/640642
duplicate of: http://stackoverflow.com/q/640642
answer count: 1
type: UnansweredQuestion
score: 0
has title: Avoid for table of table to mantain same memory allocation when inserted to another table
type: Question

http://stackoverflow.com/a/78220087
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/78219522
has body: 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 coroutine.yield as fun and "wrapping" the iteration in a coroutine via coroutine.wrap: for lvl, node in coroutine.wrap(function() tree:visit(coroutine.yield) end) do print(('|.. '):rep(lvl)..node.x) end Of course you could also write a "method" for this: function NODE:nodes() local function visit(node) coroutine.yield(node) if node.left then visit(node.left) end if node.right then visit(node.right) end end return coroutine.wrap(function() visit(self) end) end -- Usage: for node in tree:nodes() do print(node.x) end 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 "trampolines" or even more coroutines), and coroutines add some overhead both time- and space-wise. Most of the time this isn't critical though, and I find that coroutines yield very elegant solutions for obtaining an "iterative" iterator from a "recursive" one. In this example, the difference isn't very large, because you never need to go "back" to a node (you're doing a "preorder" traversal: You visit the root first, then visit the children). As an exercise, try to implement an inorder traversal. In the "recursive" / coroutine-based version, this should be trivial. In the iterative version, it's not quite as easy.

http://stackoverflow.com/comment/137891138
type: AnswerComment
type: Comment
has text: 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
score: 0
comment on: http://stackoverflow.com/a/78215421

http://stackoverflow.com/q/78221219
has comment: http://stackoverflow.com/comment/137902045
downvote count: 0
answer count: 1
has body: I have a table defined like so: local foo = { bar = { { ['baz'] = "A sample string", ['qux'] = 128 }, }, } Obviously, the is a small part of a much larger algorithm. I'm having trouble referencing the first entry in table bar. print("foo.bar", "type", type(foo.bar), "value", foo.bar) print("foo.bar.first", "type", type(foo.bar[0]), "value", foo.bar[0]) If I try a simple print, like shown above, the second print outputs nil for type and value. foo.bar type table value table: 000001DF39D19D20 foo.bar.first type nil value nil FYI, if I put it in a loop using the pairs() or ipairs() functions, I can get at the baz and qux 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?
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/78281614
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137902084
type: Question
has title: How to reference first entry in keyless table in Lua?
upvote count: 1
tagged with: lua
tagged with: lua-table
accepted answer: http://stackoverflow.com/a/78281614

http://stackoverflow.com/comment/137821687
type: Comment
comment on: http://stackoverflow.com/a/78176289
type: AnswerComment
score: 0
has text: 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.

http://stackoverflow.com/q/78293342
has body: 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. 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: function ess(x) if not ITEMSCRAPESTATS then ITEMSCRAPESTATS = {} end ES:SetHyperlink("item:"..x..":0:0:0:0:0:0:0") for i=1, ES:NumLines() do local text = _G["ESTooltipTextLeft"..i]:GetText() if _G["ESTooltipTextLeft2"]:GetText() then ITEMSCRAPESTATS[x] = ITEMSCRAPESTATS[x] or {} table.insert(ITEMSCRAPESTATS[x], _G["ESTooltipTextLeft"..i]:GetText()) else ITEMSCRAPESTATS[x] = ITEMSCRAPESTATS[x] or {} table.insert(ITEMSCRAPESTATS[x], "No Stats for Item Number") end end if _G["ESTooltipTextLeft2"]:GetText() then print("Scraping Stats for Item Number: "..x) else print("No Stats for Item Number: "..x) end end This is what ends up in the table: ITEMSCRAPESTATS = { [60002] = { "Goldroar Signet", -- [1] "Binds when picked up", -- [2] "Unique-Equipped", -- [3] "Finger", -- [4] "+1 Strength", -- [5] "Item Level 15", -- [6] " ", -- [7] }, [60004] = { "Divining Rod", -- [1] "Binds when picked up", -- [2] "Ranged", -- [3] "9 - 17 Fire Damage", -- [4] "(8.7 damage per second)", -- [5] "Requires Level 6", -- [6] "Item Level 12", -- [7] " ", -- [8] }, [60001] = { "Goldroar Band", -- [1] "Binds when picked up", -- [2] "Unique-Equipped", -- [3] "Finger", -- [4] "+1 Intellect", -- [5] "Item Level 15", -- [6] " ", -- [7] }, [60003] = { "Waterlogged Dirge", -- [1] "Binds when picked up", -- [2] "Two-Hand", -- [3] "17 - 26 Damage", -- [4] "(7.2 damage per second)", -- [5] "+1 Strength", -- [6] "+1 Stamina", -- [7] "Requires Level 6", -- [8] "Item Level 10", -- [9] " ", -- [10] }, [60000] = { "Resilient Poncho", -- [1] "Binds when picked up", -- [2] "Back", -- [3] "20 Armor", -- [4] "+1 Spirit", -- [5] "Requires Level 6", -- [6] "Item Level 26", -- [7] " ", -- [8] }, } I would like it to sort like this: ITEMSCRAPESTATS …
answer count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78294178
score: 0
tagged with: world-of-warcraft
type: Question
has title: Need help sorting a Lua table
has answer: http://stackoverflow.com/a/78299952
tagged with: lua

http://stackoverflow.com/q/78196346
has title: lazyvim: change default settings
score: 1
tagged with: neovim
upvote count: 1
answer count: 1
type: UnansweredQuestion
favorite count: 0
has body: I'm using lazyvim and I'm trying to change some default settings: According to documentation here seems that I'm able to change default root_dir detection. It's not clear to how to chage that. I mean, By default, it's picking default root_dir detection from lspconfig. Default lspconfig jdtls configuration is here and you can find jdtls.lua lspconfig file here. You can also to see how to lsp_config populate it on default_config.root_dir here. I need to change to: {'.git', 'mvnw', 'gradlew'} Also, I've tried to change nvim-jdtls plugin settings using this code snipped on _/lua/plugins/jdtls-change-root.lua: return { { "mfussenegger/nvim-jdtls", ---@type lspconfig.options.jdtls ---@diagnostic disable-next-line: missing-fields opts = { jdtls = function(opts) local root_dir = {{'.git', 'mvnw', 'gradlew'}} table.insert(opts.root_dir, root_dir) return opts end, }, }, } But something is wrong in that code. Any ideas?
downvote count: 0
type: Question
tagged with: lua
has answer: http://stackoverflow.com/a/78825652

http://stackoverflow.com/a/78290961
type: Answer
has body: It seems like you are getting the children from Orebuttons 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. You need to loop through each button in Orebuttons and then connect to that. for _, button: GuiButton in pairs(Orebuttons) do if button:IsA("GuiButton") then button.MouseButton1Click:Connect(function() print("Click") OreString.Value = button.Name end) end end This code goes through the Orebuttons array and then if the child is a GuiButton then connect MouseButton1Click to that button.
answers question: http://stackoverflow.com/q/78289464
score: 0

http://stackoverflow.com/q/78257369
tagged with: lua
type: Question
has body: I'm working on a project where you can be transported to an instructions page. I am using a site called tutorialspoint and I am on Windows 10. I need to be able the clear the terminal for a project, Is there a way to? I tried a few commands like os.execute("clear") but it didn't work.
has answer: http://stackoverflow.com/a/78258623
has comment: http://stackoverflow.com/comment/137968641
has comment: http://stackoverflow.com/comment/137965358
has title: Clear Lua Output
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137970958
score: 0

http://stackoverflow.com/q/78233831
tagged with: lua
tagged with: scripting
accepted answer: http://stackoverflow.com/a/78234223
answer count: 1
has title: What are JCL Alternitives for Embeded Applications?
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78234223
tagged with: tcl
tagged with: process-control
downvote count: 1
type: Question
upvote count: 1
has body: What are modern alternatives for IBM's old JCL (Job Control Language) scripting language? 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. 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). Right now their looking at Lua or TCL as potential replacements to embed in their new system. What are alternative languages you have used for process control scripting? Pros? Cons?
has comment: http://stackoverflow.com/comment/137931504
has comment: http://stackoverflow.com/comment/137927985
favorite count: 0
tagged with: jcl

http://stackoverflow.com/comment/138032815
type: Comment
type: QuestionComment
score: 2
has text: 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.
comment on: http://stackoverflow.com/q/78295406

http://stackoverflow.com/q/78305470
has title: attempt to compare Instance <= number Roblox Studio
answer count: 1
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/78307245
tagged with: lua
type: Question
tagged with: roblox-studio
has body: 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. Code of the buy system: local lp = game.Players.LocalPlayer local ls = lp.leaderstats local backpack = lp.Backpack local rp = game:GetService("ReplicatedStorage") local price = script.Parent.Price script.Parent.MouseButton1Click:Connect(function() if ls.Money.Value >= price or ls.Money.Value == price then local tool = rp.Tools.ClassicSword:Clone() tool.Parent = backpack ls.Money.Value = ls.Money.Value-price print("Player has enough money to purchase tool, player currency now is"..ls.Money.Value) else return end end)

http://stackoverflow.com/a/78151815
type: Answer
answers question: http://stackoverflow.com/q/78151700
score: 3
has comment: http://stackoverflow.com/comment/137780595
has body: Is this what you're looking for? for i=1,10 do local part = display.newImage("part" .. i .. ".png", 0, 0) part:scale ( 0.5, 0.5) part.isVisible = false end
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/78176292
downvote count: 0
score: 1
upvote count: 1
has body: args = (#cmd_tb.args == 0 and false or cmd_tb.args) cannot work. Lua doesn't have a ternary statement. The … and … or … does not replace it completely. (condition) and false will always evaluate to false (or falsy nil, if condition == nil, per Luatic), and the "ternary statement" will always return the second alternative. If you want a one-liner, you could rewrite this statement like this: args = #cmd_tb.args > 0 and cmd_tb.args
has comment: http://stackoverflow.com/comment/137823251
answers question: http://stackoverflow.com/q/78176234
type: Answer

http://stackoverflow.com/q/78210778
accepted answer: http://stackoverflow.com/a/78278111
has comment: http://stackoverflow.com/comment/137909082
score: 2
tagged with: lua
downvote count: 0
tagged with: scope
has comment: http://stackoverflow.com/comment/137888380
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/137908276
has comment: http://stackoverflow.com/comment/137883175
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/137888724
has title: Lua imported global and local variables with the same name
has body: I have a file module.lua in which I have a ( or 2? ) variable(s). -- module.lua test = 30 local test = 20 test = 40 print("module.lua: " .. test) I also have my main file: -- main.lua require("module") print("main.lua: " .. test) Result of lua main.lua: module.lua: 40 main.lua: 30 I was playing with lua variable scopes but I no longer understand What's happening here. What happens when I have a Global variable and a local variable with the same name? (and then import that file in another one) I guess after the local keyword, changes to the test variable are no longer global, But everything happened before it is Global. What is the use of this? why doesn't the interpreter throw an error and prevent this confusing situation? (I'm new to lua, came from the python world) -- Trying this clearly says that changes made to test before local are global: -- module.lua test = 30 test = 70 local test = 20 test = 40 print("module.lua: " .. test) lua main.lua -> module.lua: 40 main.lua: 70
upvote count: 2
has answer: http://stackoverflow.com/a/78278111
type: Question

http://stackoverflow.com/a/78227704
answers question: http://stackoverflow.com/q/78227135
downvote count: 0
type: Answer
has body: function insertDash(str) str = string.gsub(str, "(%d)(%a)", "%1-%2") -- digit-letter str = string.gsub(str, "(%a)(%d)", "%1-%2") -- letter-digit str = string.gsub(str, "(%a)(%a)(%a)(%a)", "%1%2-%3%4") -- 4 letters to 2 letters and 2 letters return str end Examples: print(insertDash("aa11")) -- aa-11 print(insertDash("11aa")) -- 11-aa print(insertDash("123abc")) -- 123-abc print(insertDash("abc123")) -- abc-123 print(insertDash("abcd123")) -- ab-cd-123 print(insertDash("abcd1234")) -- ab-cd-1234
score: 1
upvote count: 1

http://stackoverflow.com/comment/137905212
comment on: http://stackoverflow.com/a/78221257
score: 0
has text: Thank you very much! Yes, this code works. However, I tried to write this code without using a loop because I feel that using a loop may slightly decrease the execution speed.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/78294178
answers question: http://stackoverflow.com/q/78293342
score: 0
type: Answer
has body: Use this table.sort(ITEMSCRAPESTATS, function(a,b) return a[key] &gt; b[key] end)

http://stackoverflow.com/comment/137887650
type: Comment
comment on: http://stackoverflow.com/q/78210282
has text: so how do i fix it?
type: QuestionComment
score: 0

http://stackoverflow.com/comment/137891002
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78214956
has text: 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.
type: Comment

http://stackoverflow.com/comment/137858816
type: Comment
has text: 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)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78194647

http://stackoverflow.com/a/78295407
score: 0
answers question: http://stackoverflow.com/q/78268821
type: Answer
has body: Have you tried making all your localplayer's character parts transparency 0?

http://stackoverflow.com/q/78262990
has answer: http://stackoverflow.com/a/78383663
type: AnsweredQuestion
answer count: 1
has body: I have two parabolas defined by their respective focuses ((fx1, fy1) and (fx2, fy2)), and a common directrix dirY. I need to find the intersection point of these two parabolas with given height of intersection (y). I have very long solution, but is here a way to make it shorter, without a, b, c? local function twoParabolasCrossByHeight (fx1, fy1, fx2, fy2, dirY, y) local f1 = math.abs(dirY-fy1)/2 local f2 = math.abs(dirY-fy2)/2 if fy1 == fy2 then return (fx1+fx2)/2, y end local a1 = -1/(4*f1) local a2 = -1/(4*f2) local b1 = -2*fx1*a1 local b2 = -2*fx2*a2 local c1 = fx1*fx1*a1 + fy1 + f1 local c2 = fx2*fx2*a2 + fy2 + f2 local a = a1-a2 local b = b1-b2 local c = c1-c2 local d = b*b-4*a*c if d &lt; 0 then return end local x1 = (-b-math.sqrt (d))/(2*a) local y1 = a1*x1*x1 + b1*x1 + c1 return x1, y1 end Two examples: -- must be 400 50: print (twoParabolasCrossByHeight (250, 250, 550, 250, 300, 50)) -- must be aprox. 400 50: print (twoParabolasCrossByHeight (250, 250, 550, 251, 300, 50))
score: 0
tagged with: math
accepted answer: http://stackoverflow.com/a/78383663
has title: Find Intersection Point of Two Parabolas Given Their Focuses and Common Directrix [Lua]
type: Question
tagged with: trigonometry
tagged with: lua

http://stackoverflow.com/a/78185603
has comment: http://stackoverflow.com/comment/137839531
has body: Because there's a newline behind the number it reads that the first time you do io.read("*l"). The io.read("n") only takes the number without the newline. You could make this the input to make it work 5Amir Hamid Bahar Emad Maryam or simply do an extra io.read("*l") right after the local memberNum = io.read("n")
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78185511
answers question: http://stackoverflow.com/q/78185511
downvote count: 0
type: AcceptedAnswer
type: Answer
score: 1

http://stackoverflow.com/comment/137892371
has text: I don't know Lua but wouldn't `line, _ = string.gsub(line, "(%S+)/(%S+)", "\\frac{%1}{%2}")` work?
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/78216065
type: Comment

http://stackoverflow.com/comment/138037655
score: 0
comment on: http://stackoverflow.com/q/78289911
type: QuestionComment
has text: Which version of premake5 do you use? (shell type detection has changed in master branch).
type: Comment

http://stackoverflow.com/comment/137906640
score: 0
type: QuestionComment
has text: Added mspaint flow chart, currently pressing and releasing left click types "z"
type: Comment
comment on: http://stackoverflow.com/q/78210282

http://stackoverflow.com/comment/137793755
type: QuestionComment
comment on: http://stackoverflow.com/q/78160089
type: Comment
score: 0
has text: 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??

http://stackoverflow.com/a/78172169
has body: In the doc for luaL_loadstring, it says: this function only loads the chunk; it does not run it. As stated in the comments, you should use luaL_dostring instead. Note that select is a preexisting function in the standard library, so the error you see is coming from a whole different function.
answers question: http://stackoverflow.com/q/78171948
type: Answer
upvote count: 3
score: 3
downvote count: 0

remap
tag name: remap
type: Tag
tags question: http://stackoverflow.com/q/78298729

http://stackoverflow.com/comment/138027933
comment on: http://stackoverflow.com/q/78292293
type: QuestionComment
has text: Please try the https://stackoverflow.com/a/1647577/12968803 Is it good for you?
score: 1
type: Comment

can-bus
type: Tag
tags question: http://stackoverflow.com/q/78302174
tag name: can-bus

http://stackoverflow.com/a/78164919
upvote count: 1
has comment: http://stackoverflow.com/comment/137811023
type: AcceptedAnswer
has body: Read the manual carefully, then you'll notice the type of lua_resume's last argument is int*, it's an output argument. int lua_resume (lua_State *L, lua_State *from, int nargs, int *nresults); Although in your example, it is 0, in general, you need to handle them. lua_State* co = lua_tothread(L, 2); int nresults; status = lua_resume(co, NULL, 0, &amp;nresults); lua_pop(co, nresults); //handle the results by removing them You'd better use the co variable above for your 2nd lua_resume call too, because you put the global co (which doesn't exist) on the top of the stack.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78164268
score: 1
accepted answer of: http://stackoverflow.com/q/78164268

http://stackoverflow.com/q/78210282
has comment: http://stackoverflow.com/comment/137887650
has comment: http://stackoverflow.com/comment/137888453
has comment: http://stackoverflow.com/comment/137882845
type: Question
has comment: http://stackoverflow.com/comment/138457270
answer count: 0
has title: Immediately break the loop when condition is not met and go to next line
tagged with: logitech-gaming-software
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137890802
has body: EnablePrimaryMouseButtonEvents(true); function OnEvent(event, arg) if IsKeyLockOn("numlock" )then if IsMouseButtonPressed(3)then repeat if IsMouseButtonPressed(1) then PressKey("z") ReleaseKey("z") repeat if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("a") ReleaseKey("a") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("b") ReleaseKey("b") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("c") ReleaseKey("c") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("d") ReleaseKey("d") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("e") ReleaseKey("e") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("f") ReleaseKey("f") end until not IsMouseButtonPressed(3) PressKey("z") ReleaseKey("z") end if IsMouseButtonPressed(1) then PressKey("z") ReleaseKey("z") repeat if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("a") ReleaseKey("a") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("b") ReleaseKey("b") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("c") ReleaseKey("c") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("d") ReleaseKey("d") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("e") ReleaseKey("e") if not IsMouseButtonPressed(1) then break end; Sleep(91) PressKey("f") ReleaseKey("f") until not IsMouseButtonPressed(1) PressKey("z") ReleaseKey("z") end end end Z key need to be pressed once and type " A B C D E F G" 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. 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.
has comment: http://stackoverflow.com/comment/137906640
score: 0

http://stackoverflow.com/comment/137888162
type: QuestionComment
has text: 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.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78213071

http://stackoverflow.com/comment/137941315
score: 0
type: QuestionComment
has text: I did as it says in the update.
type: Comment
comment on: http://stackoverflow.com/q/78240791

http://stackoverflow.com/comment/137978448
score: 0
comment on: http://stackoverflow.com/a/78258776
type: AnswerComment
has text: it's possible that the syntax differs. In that case, you may need to consult the documentation from Rongo.
type: Comment

http://stackoverflow.com/comment/137899148
comment on: http://stackoverflow.com/a/78219787
type: Comment
score: 0
has text: 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).
type: AnswerComment

http://stackoverflow.com/q/78298729
has body: i want to set keymap for lua to be sinppets for example: vim.api.nvim_set_keymap("n", "<leader>rs", ":call append(line('.'), welcome)<CR>") and now i want to make sinppets for react component const welcome = => ( <> welcome </> ); export default welcome; i try to make the sinppets but its not working very well: -- vim.api.nvim_set_keymap( "n", "<leader>rs", [[ <cmd>call append(line('.'), 'const welcome = () => {')<CR> <cmd>normal! o<CR> '\treturn (')<CR> <cmd>normal! o<CR> '\t\t<>\')<CR> <cmd>normal! o<CR> '\t\t\twelcome')<CR> <cmd>normal! o<CR> '\t\t</>\')<CR> <cmd>normal! o<CR> '}\')<CR> <cmd>normal! o<CR> 'export default welcome;')<CR> ]], { noremap = true, silent = true } ) i just want to help to know how to write remap for snippets not for react only !!
has title: neovim making snippets write in lua with nvim_set_keymap
tagged with: lua
tagged with: remap
type: UnansweredQuestion
score: 0
tagged with: code-snippets
type: Question
tagged with: neovim
answer count: 0

http://stackoverflow.com/comment/137931504
type: QuestionComment
score: 0
has text: 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.
comment on: http://stackoverflow.com/q/78233831
type: Comment

http://stackoverflow.com/comment/137883175
has text: It is impossible to explain why some content such as "example", "main1" that does not exist in the code appears in the final result.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78210778
score: 0

http://stackoverflow.com/a/78202921
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78202258
has body: Try this code. It detects health change and maxHealth change. local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild("Humanoid") local HealthBar = script.Parent local function UpdateHealthbar() local healthPercentage = Humanoid.Health / Humanoid.MaxHealth HealthBar.Size = UDim2.new(healthPercentage, 0, 1, 0) end UpdateHealthbar() Humanoid:GetPropertyChangedSignal("Health"):Connect(UpdateHealthbar) Humanoid:GetPropertyChangedSignal("MaxHealth"):Connect(UpdateHealthbar)

http://stackoverflow.com/comment/137900761
comment on: http://stackoverflow.com/a/78216720
has text: `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`
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137925230
comment on: http://stackoverflow.com/a/78234223
type: Comment
has text: 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.
score: 0
type: AnswerComment

http://stackoverflow.com/q/78284139
tagged with: mitre-attck
has body: 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 ? 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 ?
tagged with: suricata
tagged with: ids
score: 0
type: Question
tagged with: rules
tagged with: lua
answer count: 0
has title: MITRE ATT&CK Framework with Suricata
type: UnansweredQuestion

http://stackoverflow.com/q/78278826
has answer: http://stackoverflow.com/a/78278914
type: Question
upvote count: 1
favorite count: 0
tagged with: replace
has title: Replace shortened variables with their full string
score: 1
downvote count: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/78278914
has body: I have a code written in Lua with a load of variables in a string like this: local var={[1]= "dothis", [2]= "clevermaths", [3]= "longstring"} than the rest of the code uses these variables in the format of var[1], var [2] all over the place. I was to replace all the var[1]s with "dothis", the var[2]s with "clevermaths". 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. I googled along the lines of "how to replace shortened variables stored in a table with their full-length values" - no help (unless I'm some sort of coding expert - which I'm not). 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. 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.
has answer: http://stackoverflow.com/a/78278955
accepted answer: http://stackoverflow.com/a/78278955
tagged with: lua
type: AnsweredQuestion

http://stackoverflow.com/comment/137793859
type: QuestionComment
score: 0
has text: @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.
type: Comment
comment on: http://stackoverflow.com/q/78160089

http://stackoverflow.com/q/78215215
type: Question
tagged with: lua
has answer: http://stackoverflow.com/a/78319706
has comment: http://stackoverflow.com/comment/138072688
upvote count: 0
tagged with: roblox-studio
has title: I have this error in roblox studio: ServerScriptService.Main.Base:17: attempt to index nil with 'CurrentHealth'
has body: 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: ServerScriptService.Main.Base:17: attempt to index nil with 'CurrentHealth' Here's my script:
answer count: 1
type: UnansweredQuestion
favorite count: 0
score: -1
downvote count: 1

http://stackoverflow.com/comment/137888724
type: QuestionComment
comment on: http://stackoverflow.com/q/78210778
has text: This is explained in the manual: https://www.lua.org/manual/5.4/manual.html#3.5
score: 1
type: Comment

http://stackoverflow.com/comment/137797432
has text: 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 MoveMouseRelative(0,4) Sleep(50)"
comment on: http://stackoverflow.com/q/78149365
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/137887766
comment on: http://stackoverflow.com/q/78202387
type: Comment
has text: @Tribhuwan which README.md ? on the github? I don't see where? if you could point to to where exactly, that could be great.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138050872
score: 1
has text: What did you try?
type: QuestionComment
comment on: http://stackoverflow.com/q/78305561
type: Comment

http://stackoverflow.com/q/78214965
has comment: http://stackoverflow.com/comment/137897390
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/137901313
score: 1
has comment: http://stackoverflow.com/comment/137901325
has body: 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. local players = game:GetService("Players") local plr = players.LocalPlayer.Character local sanity = plr.Sanity.Value local hum = plr:FindFirstChild("Humanoid") while sanity > 0 do if sanity == 0 then hum.Health = 0 end wait(0.05) sanity -= 1 print(sanity) end The problem is that even though the value exists, it is not decrementing it or printing the new value. 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 edit: i found a different way to do it that works perfectly fine
favorite count: 0
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/137923779
has title: How do i make a "sanity" bar?
downvote count: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/137914605
tagged with: roblox

http://stackoverflow.com/a/78176289
upvote count: 4
has body: This is a common pitfall. cond and a or b is not a ternary. It's just (cond and a) or b, which, due to lazy evaluation, behaves almost like a ternary: If cond is truthy, cond and a evaluates to a. If a is truthy, a or b then evaluates to a. If cond is falsey, cond and a evaluates to cond, so cond or b evaluates to b. The problem is that if a is falsey (nil or false), then a or b evaluates to b, when it should evaluate to a. In your case, since b is truthy (nil and false don't support #, unless you mess with debug metatables), you could just negate your condition and swap a and b: args = #cmd_tb.args ~= 0 and cmd_tb.args or false The or false is not necessary in this case, since #cmd_tb.args ~= 0 will already evaluate to false. It may be necessary if your condition could be nil; or nil is also sometimes useful when you want nil rather than a boolean, but your condition produces a boolean. PS: I would test for the empty string using ~= &quot;&quot; / == &quot;&quot; respectively. It is clearer than comparing #x against 0.
accepted answer of: http://stackoverflow.com/q/78176234
score: 4
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/137821687
has comment: http://stackoverflow.com/comment/137823223
answers question: http://stackoverflow.com/q/78176234

http://stackoverflow.com/q/78150730
type: UnansweredQuestion
tagged with: neovim
upvote count: 4
score: 4
downvote count: 0
has answer: http://stackoverflow.com/a/78163209
favorite count: 0
tagged with: eslint
has title: failed to load builtin eslint_d for method diagnostics
answer count: 1
type: Question
tagged with: lua
has body: I encountered this problem after watching typecrafts Neovim series on Youtube. I tried with AI but it didn't work. I tried adding both eslint_d and eslint-lsp and received the same error the following error for both of them. [null-ls] failed to load builtin eslint_d for method diagnostics; please check your config: return { "nvimtools/none-ls.nvim", config = function() local null_ls = require("null-ls") null_ls.setup({ sources = { null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.prettier, null_ls.builtins.diagnostics.eslint_d, }, }) vim.keymap.set("n", "<leader>gf", vim.lsp.buf.format, {}) end, }

http://stackoverflow.com/comment/137824410
has text: Replace `PocketDetails[i].[field]` with `PocketDetails[i][field]`
score: 2
type: Comment
comment on: http://stackoverflow.com/q/78175954
type: QuestionComment

http://stackoverflow.com/comment/137897390
has text: 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?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78214965

http://stackoverflow.com/comment/137818739
score: 0
has text: I tried it with its default configurations as mentioned above, and the plugin still saves the file when I press enter inside any parentheses
type: AnswerComment
comment on: http://stackoverflow.com/a/78173900
type: Comment

http://stackoverflow.com/comment/137784541
has text: 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...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78154763
type: Comment

http://stackoverflow.com/comment/137794494
comment on: http://stackoverflow.com/a/78160572
type: AnswerComment
type: Comment
has text: Try adding `printf("%f\n", lua_tonumber(L, -1));` before `lua_rawseti`.
score: 0

http://stackoverflow.com/comment/137986387
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78209978
has text: 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?
type: Comment

http://stackoverflow.com/comment/137939490
type: Comment
comment on: http://stackoverflow.com/q/78240791
score: 0
type: QuestionComment
has text: @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

http://stackoverflow.com/a/78250502
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/78249339
has body: I made it work local HP = cube.Healthbar local Cooldown = false local function Healtbar() do if Cooldown then return() end HP.Value =- 5 Cooldown = true wait(0.5) Cooldown = false end cube.Touched:Connect(Healthbar)
type: Answer

http://stackoverflow.com/a/78188699
has body: I suggest keeping track of all the pocket details in a larger table. PocketPositions.AllPocketDetails = {} -- keep track of all the pocket details here -- can reference one of the details as 'PocketPositions.AllPocketDetails[pocketNum]' function PocketPositions.UpdateField(pocketNum, field, newVal) local theseDetails = PocketPositions.AllPocketDetails[pocketNum] if theseDetails == nil then theseDetails = { PocketNumber = pocketNum, -- other default values can go here } theseDetails[field] = newVal PocketPositions.AllPocketDetails[pocketNum] = theseDetails else theseDetails[field] = newVal end end
answers question: http://stackoverflow.com/q/78175954
score: 0
type: Answer

replace
tag name: replace
tags question: http://stackoverflow.com/q/78221180
tags question: http://stackoverflow.com/q/78278826
type: Tag
tags question: http://stackoverflow.com/q/78647470

http://stackoverflow.com/comment/137897449
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78213846
has text: Does `[^%p%s]` (everything except space+punctuation) work for your use-case?

http://stackoverflow.com/comment/137952023
score: 1
comment on: http://stackoverflow.com/q/78247619
has text: 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.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/78228118
has body: One regular expression is: function replaceFraction(str) str = string.gsub(str, "(%S+)/(%S+)", "\\frac{%1}{%2}") return str end Examples: print(replaceFraction("Hello a/b hi")) -- Hello \frac{a}{b} hi print(replaceFraction("a/b hi")) -- \frac{a}{b} hi print(replaceFraction("Hello a/b")) -- Hello \frac{a}{b}
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78216065
answers question: http://stackoverflow.com/q/78216065
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/78173900
score: 0
has comment: http://stackoverflow.com/comment/137818739
has comment: http://stackoverflow.com/comment/137818977
type: Answer
has body: I use this plugin for autosaving in nvim. This works well. You can add these lines in your plugin config file for auto saving in normal mode and after text change event. { enabled = true, execution_message = { message = function() return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S")) end, dim = 0.18, }, trigger_events = {"InsertLeave", "TextChanged"}, condition = function(buf) local fn = vim.fn local utils = require("auto-save.utils.data") if fn.getbufvar(buf, "&modifiable") == 1 and utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then return true end return false end, write_all_buffers = false, debounce_delay = 135, callbacks = { enabling = nil, disabling = nil, before_asserting_save = nil, before_saving = nil, after_saving = nil, } } This is the default configuration of this plugin, consider configuring yourself as you want
has comment: http://stackoverflow.com/comment/137846516
answers question: http://stackoverflow.com/q/78173715

http://stackoverflow.com/comment/137945292
comment on: http://stackoverflow.com/a/78244356
type: AnswerComment
score: 0
has text: You're a wizard. Thank you, this works exactly as I had hoped.
type: Comment

http://stackoverflow.com/comment/138072313
score: 0
type: AnswerComment
has text: nw, i already fixed it
comment on: http://stackoverflow.com/a/78290787
type: Comment

http://stackoverflow.com/comment/137984648
type: QuestionComment
comment on: http://stackoverflow.com/q/78262662
type: Comment
has text: From lua 5.1 ref: next (table [, index]) "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. "
score: 0

http://stackoverflow.com/q/78258650
type: Question
has answer: http://stackoverflow.com/a/78258776
has title: MongoDB: Check if a value is true or false in a collection
upvote count: 0
tagged with: lua
tagged with: roblox
score: -2
answer count: 1
has body: 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: if FFlagsData:FindOne({["allowRebirthing"] = true }) then print("Test1") else if FFlagsData:FindOne({["allowRebirthing"] = false }) then print("Test2") end end image of my collection
type: UnansweredQuestion
favorite count: 0
downvote count: 2
tagged with: mongodb

http://stackoverflow.com/a/78240232
upvote count: 4
accepted answer of: http://stackoverflow.com/q/78239786
downvote count: 0
answers question: http://stackoverflow.com/q/78239786
score: 4
type: AcceptedAnswer
type: Answer
has body: Hash sets in Lua Yes, a table with string keys and truthy values (usually true) is the idiomatic, and most likely most efficient, way to implement a hash set of strings (or numbers, or "pointers" (like functions or tables, which are compared by reference)) in Lua. Method - data name collisions This however: function dict.contains(self, word) do return self[word] end is a bad idea, because suddenly dict:contains("contains") will be truthy (it will be the contains function). Similarly, dict.word will suddenly be truthy as well, even though you probably want all accesses to go through contains. I'd recommend just directly doing something like if words[word] then rather than unnecessarily complicating this by forcing it into an OOP style when it is not needed or useful. If you do want this, encapsulate the internal "set" of words, so store it in a field like dict._words to not have the methods conflict with the actual data you're storing. Premature optimization concerns Is this option good enough? It most probably is - try it and see. "20k" is a very small number of words for Lua to handle. I see no reason why the first solution shouldn't be fully satisfying. In asymptotical terms, accessing this table - both to insert new strings, or to get strings - has expected constant time complexity. Using the optimized hash table implementation provided by your Lua implementation is most probably a better idea than rolling your own. Or maybe this one would be better: [...] I am inclining to vote for the 2nd option So far you have provided no reason why it should be better, and barring exceptional circumstances, I don't think it will be. In many aspects, it's very blatantly worse: It's more complex. This complexity would need to be justified. 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. A hashing algorithm written in Lua is very unlikely to outperform the optimized hashing algorithm pres…

cheat-engine
type: Tag
tag name: cheat-engine
tags question: http://stackoverflow.com/q/78213080

http://stackoverflow.com/comment/137818977
has text: `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.
comment on: http://stackoverflow.com/a/78173900
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137890741
type: Comment
comment on: http://stackoverflow.com/q/78209189
type: QuestionComment
has text: Can rectangles overlap?
score: 0

http://stackoverflow.com/comment/137890792
has text: But "a" and "å" are different letters.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78214956
type: AnswerComment

http://stackoverflow.com/comment/137814247
score: 1
type: Comment
type: QuestionComment
has text: Because you were using `loadstring` instead of `dostring`.
comment on: http://stackoverflow.com/q/78171948

http://stackoverflow.com/q/78289911
tagged with: lua
tagged with: premake
tagged with: build-system
type: UnansweredQuestion
has title: Why is Premake5 not creating the necessary output directories for my project?
has comment: http://stackoverflow.com/comment/138037655
score: 0
has comment: http://stackoverflow.com/comment/138037637
answer count: 0
type: Question
has body: I'm using Premake5 as my build system for a C project on Windows. I'm using three scripts for my project: premake5.lua workspace "epoch" configurations { "Debug", "Release", "Dist" } architecture "x86_64" startproject "sandbox" include "runtime/runtime.lua" include "sandbox/sandbox.lua" runtime/runtime.lua project "runtime" kind "SharedLib" language "C" targetdir "../bin/%{cfg.buildcfg}" objdir "../obj/%{cfg.buildcfg}" files { "runtime/src/**.c", "runtime/src/**.h" } filter "configurations:Debug" symbols "On" filter "configurations:Release or configurations:Dist" optimize "On" sandbox/sandbox.lua project "sandbox" kind "WindowedApp" language "C" targetdir "../bin/%{cfg.buildcfg}" objdir "../obj/%{cfg.buildcfg}" files { "sandbox/src/**.c", "sandbox/src/**.h" } filter "configurations:Debug" symbols "On" filter "configurations:Release or configurations:Dist" optimize "On" I;m using the gmake2 generator, but when I call make on the resulting Makefile, I get the following error: ==== Building runtime (debug) ==== Creating ../bin/Debug mkdir: cannot create directory '..\\bin\\Debug': No such file or directory make[1]: *** [Makefile:88: ../bin/Debug] Error 1 make: *** [Makefile:36: runtime] Error 2 My understanding is that this is due to the bin directory not existing prior to the mkdir call. How can I fix this?

http://stackoverflow.com/a/78188819
has comment: http://stackoverflow.com/comment/137909500
score: 0
has comment: http://stackoverflow.com/comment/137902179
has body: 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. task.wait() and wait() 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. 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. Methods RunService PreSimulation RunService Heartbeat RunService RenderStepped wait() wait(1/60) minimum (seconds) 0.0125 0.0110 0.0127 0.0308 0.0312 maximum (seconds) 0.0667 0.5910 0.7072 0.0506 0.0493 median (seconds) 0.0167 0.0169 0.0166 0.0333 0.0333 std dev (seconds) 0.0080 0.0474 0.0565 0.0019 0.0019 And an example distribution of those frame-rates would look like this : We can see that wait() most consistently pauses frames, but it looks to be two frames before it resumes. But here's the thing... I think you've got a bit of an XY problem. 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. In your main script, set up the drawing segments : local rs = game:GetService("RunService") local drawPWave = require(script.p_wave) local drawRestPhase = require(script.rest) local drawQRSComplex = require(script.qrs_complex) local drawTWave = require(script.t_wave) local colGreen = Color3.fromRGB(25, 255, 25) local ecgPhases = { { name = "P_Wave", getCursorPosition = drawPWave, duration = 0.300, --seconds color = colGreen, }, { name = "PQ_Wave", getCursorPosition = drawRestPhase, duration = 0.120, --seconds color = colGreen, }, { name = …
type: Answer
answers question: http://stackoverflow.com/q/78167836

fonts
tag name: fonts
tags question: http://stackoverflow.com/q/78177017
type: Tag

http://stackoverflow.com/comment/137896838
type: Comment
comment on: http://stackoverflow.com/a/78216720
score: 0
type: AnswerComment
has text: 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.

ids
tags question: http://stackoverflow.com/q/78292585
tags question: http://stackoverflow.com/q/78284139
type: Tag
tag name: ids

http://stackoverflow.com/comment/137909082
comment on: http://stackoverflow.com/q/78210778
type: Comment
score: 0
has text: This is explained in the section "Chunks", you can understand that the file itself is also a block.
type: QuestionComment

http://stackoverflow.com/comment/137904690
comment on: http://stackoverflow.com/a/78221248
type: Comment
type: AnswerComment
score: 0
has text: 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.

http://stackoverflow.com/comment/137913500
type: Comment
type: QuestionComment
score: 0
has text: Is 2 dashes - max amount of them?
comment on: http://stackoverflow.com/q/78227135

http://stackoverflow.com/a/78221333
type: Answer
has body: 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}. Please try this solution: https://love2d.org/wiki/TileMerging Matrix example: local grid = { {1,1,1,1,1,1,1,1,1}, {1,0,0,1,1,1,0,0,1}, {1,0,1,1,1,1,1,0,1}, {1,1,1,0,1,0,1,1,1}, {1,1,1,1,0,1,1,1,1}, {1,1,1,0,1,0,1,1,1}, {1,0,1,1,1,1,1,0,1}, {1,0,0,1,1,1,0,0,1}, {1,1,1,1,1,1,1,1,1}, } Result:
answers question: http://stackoverflow.com/q/78209189
score: 0

http://stackoverflow.com/comment/137817369
has text: 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. Also 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()
comment on: http://stackoverflow.com/a/78172741
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/138072688
comment on: http://stackoverflow.com/q/78215215
has text: 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.
type: QuestionComment
score: 2
type: Comment

port-scanning
tag name: port-scanning
type: Tag
tags question: http://stackoverflow.com/q/78292585

http://stackoverflow.com/q/78235556
score: 2
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has title: Neovim Kickstart config "E5113: Error while calling lua chunk: vim/_editor.lua:0: attempt to compare two table values" everytime I open neovim
tagged with: neovim
answer count: 0
upvote count: 2
has body: 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. Error that displays when I open neovim lines 150-179 in my init.lua file neovim version I am using Ubuntu jammy. I was expecting to run this command from the kickstart repository readme git clone https://github.com/nvim-lua/kickstart.nvim.git &quot;${XDG_CONFIG_HOME:-$HOME/.config}&quot;/nvim and have a fully functional neovim configuration but I keep getting this error. I was also expecting to find a comparison of two table values of the init.lua file after reading the error but all I see is a keymap. And it seems to keymap fine on line 159. 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.
type: Question
tagged with: lua

c-api
tag name: c-api
type: Tag
tags question: http://stackoverflow.com/q/78164268
tags question: http://stackoverflow.com/q/78171948

http://stackoverflow.com/comment/137879754
type: QuestionComment
has text: You should consider reading `README.md`
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78202387

http://stackoverflow.com/comment/137888769
score: 0
has text: It seems like the character variable is nil. How was that variable defined?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78194647

tcl
type: Tag
tag name: tcl
tags question: http://stackoverflow.com/q/78233831

http://stackoverflow.com/comment/137978789
has text: Forgot to mention, the code does work, it only returns "true" though. Might help you solve this.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78258776
type: AnswerComment

http://stackoverflow.com/a/78290699
accepted answer of: http://stackoverflow.com/q/78177017
answers question: http://stackoverflow.com/q/78177017
type: AcceptedAnswer
score: 0
type: Answer
has body: 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.

http://stackoverflow.com/comment/137908678
score: 0
has text: 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.
type: AnswerComment
comment on: http://stackoverflow.com/a/78225181
type: Comment

http://stackoverflow.com/comment/137957704
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78245755
type: Comment
has text: 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. This code fragment is the only code there is. I 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.

http://stackoverflow.com/a/78303552
answers question: http://stackoverflow.com/q/78290698
upvote count: 1
type: AcceptedAnswer
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/78290698
downvote count: 0
has body: I think you call wrong function. luasnip.lspexpand(args.body) It should be luasnip.lsp_expand(args.body)

mongodb
tags question: http://stackoverflow.com/q/78258650
type: Tag
tag name: mongodb

http://stackoverflow.com/comment/137898025
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78219171
type: QuestionComment
has text: Your `sorted_table` is sorted by value in descending order. Is that what you want?

http://stackoverflow.com/comment/137902879
type: QuestionComment
comment on: http://stackoverflow.com/q/78220636
has text: 8 separate queries; one each for the min and max of each column.
type: Comment
score: 0

http://stackoverflow.com/comment/138066040
type: QuestionComment
comment on: http://stackoverflow.com/q/78300144
score: 0
has text: 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.
type: Comment

http://stackoverflow.com/comment/137889140
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78213846
has text: 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.
score: 1

http://stackoverflow.com/comment/138134270
has text: You can likely checking the `OreString.Value` wrong if the print works fine, please provide the script that handles `OreString.Value`.
comment on: http://stackoverflow.com/q/78294940
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/137899433
type: QuestionComment
type: Comment
has text: yes, it needs to return sorted_table
score: 0
comment on: http://stackoverflow.com/q/78219171

http://stackoverflow.com/comment/138142421
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78294469
has text: 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).

http://stackoverflow.com/q/78275372
tagged with: game-development
has answer: http://stackoverflow.com/a/78279899
linked to: http://stackoverflow.com/q/67471149
favorite count: 0
has comment: http://stackoverflow.com/comment/137998849
has title: Infinite yield possible on 'ServerScriptService.Modules:WaitForChild("Modules")' in Leaderstats code
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138001125
tagged with: random
answer count: 2
downvote count: 3
tagged with: lua
has body: Whenever I try running this Data Manager Module script I get a script error saying: Infinite yield possible on 'ServerScriptService.Modules:WaitForChild("Modules")' - Studio But for some reason the leaderboard works fine, just the rolls are not appearing next to my name in the leader board. 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. 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 : local modules = ServerScriptService:WaitForChild("Modules", 5) -- waits up to 5 seconds and the same error occurs : Infinite yield possible on 'ServerScriptService.Modules:WaitForChild("Modules")' - Studio 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. If you need any other info to solve this please let me know I will gladly provide any script just ask! :D What I tried: Running Data Manager Module script 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. What actually resulted: Script error Infinite yield possible on 'ServerScriptService.Modules:WaitForChild("Modules")' - Studio
tagged with: roblox
score: -2
has answer: http://stackoverflow.com/a/78293999
type: Question
upvote count: 1

http://stackoverflow.com/a/78221257
answers question: http://stackoverflow.com/q/78221180
has body: I agree with @darkfrei, you seem to overcomplicate things. This is much simpler and works: local MAP = { ["&red"] = "#FF0000", ["&blue"] = "#4C9FFF", ["&purple"] = "#C33AFF", ["&green"] = "#53FF4A", ["&gray"] = "#E2E2E2", ["&black"] = "#000000", ["&white"] = "#FFFFFF", ["&pink"] = "#FB8DFF", ["&orange"] = "#FF8E1C", ["&yellow"] = "#FAFF52", --TODO Add Colors } function colorate(text) assert(text and type(text) == "string") local result = text for k,v in pairs(MAP) do result = result:gsub(k, v) end return result end local text = "&whiteHello&white World Hello &greenWorld" print(colorate(text)) -- Output: #FFFFFFHello#FFFFFF World Hello #53FF4AWorld
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/137905643
has comment: http://stackoverflow.com/comment/137905212
upvote count: 2
type: Answer

process-control
tag name: process-control
type: Tag
tags question: http://stackoverflow.com/q/78233831

http://stackoverflow.com/comment/137998849
comment on: http://stackoverflow.com/q/78275372
has text: https://idownvotedbecau.se/imageofcode - Please copy and paste your code into your question.
type: QuestionComment
score: 3
type: Comment

http://stackoverflow.com/comment/137923779
type: QuestionComment
score: 0
has text: 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.
comment on: http://stackoverflow.com/q/78214965
type: Comment

http://stackoverflow.com/a/78228232
answers question: http://stackoverflow.com/q/78213080
has body: Making a string change its value randomly, the code: function randomNumbers (str) local matches = {} for match in str:gmatch("#") do table.insert(matches, match) end for i = #matches, 1, -1 do local n = tostring(math.random(0, 9)) str = string.gsub(str, "#", n, 1) end return str end Examples: print(randomNumbers("a#bcd")) -- a7bcd print(randomNumbers("a#b#cd")) -- a6b5cd print(randomNumbers("a#b#c#d")) -- a7b0c6d print(randomNumbers("a#b#c#d#")) -- a3b7c4d5 print(randomNumbers("a#b#c#d##")) -- a1b0c9d71 strings = { "1foo2bar3", "foo1", "bar1", } for i, str in ipairs (strings) do str = string.gsub(str, "(%d)", "#") -- replacing any digit by # print(randomNumbers(str)) end Result: 7foo6bar5 foo7 bar0
has comment: http://stackoverflow.com/comment/137966322
has comment: http://stackoverflow.com/comment/137933543
has comment: http://stackoverflow.com/comment/137926735
score: 0
type: Answer

mitre-attck
tag name: mitre-attck
type: Tag
tags question: http://stackoverflow.com/q/78284139

http://stackoverflow.com/comment/137839531
comment on: http://stackoverflow.com/a/78185603
type: AnswerComment
score: 2
type: Comment
has text: I changed `io.read("*n")` to `io.read("n","l')` and its worked. Thanks for replay!

http://stackoverflow.com/a/78172741
has comment: http://stackoverflow.com/comment/137817369
has comment: http://stackoverflow.com/comment/137821676
has body: just use task.wait() why do you even overthink it
answers question: http://stackoverflow.com/q/78167836
score: -1
downvote count: 1
upvote count: 0
type: Answer

http://stackoverflow.com/comment/138005902
comment on: http://stackoverflow.com/a/78274946
type: Comment
type: AnswerComment
has text: I know that and it is not the question I asked. I wanted to know a good practice to achieve the result I wanted.
score: 0

http://stackoverflow.com/a/78240789
score: 0
has body: @Luatic Nice note about method names collision. Although my code was a dummy example, I think it's worth to to be aware of such particularities. Thank you! And my impediments were mostly of the following: 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). If I load those word dynamically, why "intern" them? and even more correctly - how can it be interned? local data = load() if data then for word in data:gmatch("[^\r\n]+") do self._words[word] = true end end 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 "origin_key" (let's call it a display value)? My approach was to get rid of that redundant visual representation of a "pretty long" key. Now I see, in my 2nd option I still have a "display value" - it is just a display value of a hash of string. And yes, pure strings as keys for 20k-words tables work perfectly. Will stick with them )
answers question: http://stackoverflow.com/q/78239786
type: Answer

grand-theft-auto
type: Tag
tag name: grand-theft-auto
tags question: http://stackoverflow.com/q/78280643

http://stackoverflow.com/comment/137953676
type: Comment
score: 0
type: QuestionComment
has text: I'm just trying to get the badge pls don't dislike
comment on: http://stackoverflow.com/q/78250537

http://stackoverflow.com/comment/138001125
has text: https://stackoverflow.com/questions/67471149/how-do-i-fix-infinite-yield-possibility
comment on: http://stackoverflow.com/q/78275372
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139081117
type: Comment
comment on: http://stackoverflow.com/a/78222090
has text: I already do have luarocks installed.
type: AnswerComment
score: 0

split
tags question: http://stackoverflow.com/q/78292293
type: Tag
tag name: split

http://stackoverflow.com/a/78234223
downvote count: 0
answers question: http://stackoverflow.com/q/78233831
score: 1
has comment: http://stackoverflow.com/comment/137925230
type: AcceptedAnswer
type: Answer
upvote count: 1
has body: 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). This isn't something that has a definite answer though, at least with the small amount of information you have provided; there are lots 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.
accepted answer of: http://stackoverflow.com/q/78233831
has comment: http://stackoverflow.com/comment/137925195

http://stackoverflow.com/comment/138046411
has text: Try my [lmathx](https://web.tecgraf.puc-rio.br/~lhf/ftp/lua/#lmathx) library.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78302174

http://stackoverflow.com/a/78255190
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78251874
has body: You want to make a connection on Remote.OnServerEvent I recommend reading about it here and trying to write the code yourself. It's a good way to learn. But here's the code for your problem: local div = game:GetService("ReplicatedStorage").Events.divisionEvent div.OnServerEvent:Connect(function(Player, Team) --Player is the player instance who fired the remote (Assigned automatically by Roblox) Example: game:GetService("Players").Guest --The first argument given to :FireServer, for your case would be "Frontline" end)

mta
type: Tag
tags question: http://stackoverflow.com/q/78280643
tags question: http://stackoverflow.com/q/78295406
tag name: mta

http://stackoverflow.com/comment/137902045
type: Comment
score: 7
type: QuestionComment
comment on: http://stackoverflow.com/q/78221219
has text: Because in Lua arrays are 1-based.

http://stackoverflow.com/comment/137794469
comment on: http://stackoverflow.com/a/78160572
type: AnswerComment
has text: Is this the actual code? I tried it and it printed 1,2,3,4 as expected. What compiler are you using?
type: Comment
score: 0

http://stackoverflow.com/comment/137970958
score: 0
type: Comment
has text: On ANSI terminals, try `io.write("\27[H\27[2J")`.
comment on: http://stackoverflow.com/q/78257369
type: QuestionComment

http://stackoverflow.com/comment/137943228
score: 0
type: AnswerComment
has text: 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?)
comment on: http://stackoverflow.com/a/78244054
type: Comment

http://stackoverflow.com/comment/137905643
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/78221257
has text: @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.
type: Comment

http://stackoverflow.com/comment/137895245
has text: 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}")`
comment on: http://stackoverflow.com/q/78216065
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78225181
type: Answer
has comment: http://stackoverflow.com/comment/137908678
has body: maybe this question helps you Also, a quick solution would be to replace "%2F" to "/". newUrl = oldUrl:gsub("%2F", "/")
score: 0
answers question: http://stackoverflow.com/q/78225022

http://stackoverflow.com/comment/137939538
score: 0
type: QuestionComment
has text: Is there some simple solution? Maybe a library to solve this problem. @Luatic
comment on: http://stackoverflow.com/q/78240791
type: Comment

http://stackoverflow.com/a/78240279
type: Answer
score: 0
has body: (Actually you can skip the hash function and set key value as key hashedValue) Code: function createHashChecker(hashFunction) local hashTable = {} return function(value) local hashedValue = hashFunction(value) if hashTable[hashedValue] then return true -- hahsed value is already in hashTable else hashTable[hashedValue] = true return false -- hahsed value was not in hashTable end end end Example: local function hashFunction (str) return str end local checkHash = createHashChecker(hashFunction) print (checkHash('foo')) -- false print (checkHash('bar')) -- false print (checkHash('foo')) -- true
answers question: http://stackoverflow.com/q/78239786

http://stackoverflow.com/a/78220745
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78219171
has body: Just make list, not table as : local mytable = { {name = "name10", value = 6}, [name = "name9", value = 10}, [name = "name8", value = 8}, } and then sort it as usually: function compareValuesBackwards(a,b) return a.value > b.value end table.sort(items, compareValuesBackwards)
accepted answer of: http://stackoverflow.com/q/78219171
score: 0

http://stackoverflow.com/comment/137953472
comment on: http://stackoverflow.com/q/78246221
score: 0
type: QuestionComment
has text: Please delete this post as it is a duplicate of your another post https://stackoverflow.com/questions/78247619
type: Comment

http://stackoverflow.com/comment/137824393
type: QuestionComment
has text: 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)
comment on: http://stackoverflow.com/q/78177017
score: 2
type: Comment

servicemesh
tags question: http://stackoverflow.com/q/78262424
tag name: servicemesh
type: Tag

http://stackoverflow.com/q/78256918
type: UnansweredQuestion
score: 0
answer count: 0
has title: Player moves but the custom bloxy cola can does not
has body: The script moves the player not the item, it should work like a bloxy cola, this is the script: local Tool = script.Parent; enabled = true function onActivated() if not enabled then return end enabled = false Tool.GripForward = Vector3.new(0,-.759,-.651) Tool.GripPos = Vector3.new(1.5,-.5,.3) Tool.GripRight = Vector3.new(1,0,0) Tool.GripUp = Vector3.new(0,.651,-.759) Tool.Handle.DrinkSound:Play() wait(3) local h = Tool.Parent:FindFirstChild("Humanoid") if (h ~= nil) then if (h.MaxHealth > h.Health + 5) then h.Health = h.Health + 5 else h.Health = h.MaxHealth end end Tool.GripForward = Vector3.new(-.976,0,-0.217) Tool.GripPos = Vector3.new(0.03,0,0) Tool.GripRight = Vector3.new(.217,0,-.976) Tool.GripUp = Vector3.new(0,1,0) enabled = true end function onEquipped() Tool.Handle.OpenSound:play() end script.Parent.Activated:connect(onActivated) script.Parent.Equipped:connect(onEquipped) Here is a screenshot of the can tool : it should work like a regular bloxy cola.
tagged with: lua
type: Question
tagged with: roblox

http://stackoverflow.com/q/78289418
answer count: 1
favorite count: 0
has title: Why are some values disappearing?
has body: I need to use a function that executes another function but adding an extra argument at the end, so I wrote this: function ExecuteWithMyNameAtTheEnd(f, ...) f(..., "Maxi") end ExecuteWithMyNameAtTheEnd(print, 1, 2, 3) But for some reason instead of printing 1 2 3 Maxi it prints 1 Maxi and I don't know why. I thought the ... contained the values 1 2 3 because when I use print(...) it says 1 2 3. I am using Lua 5.4 if that helps. 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.
type: AnsweredQuestion
downvote count: 0
score: 3
has answer: http://stackoverflow.com/a/78289436
tagged with: lua
upvote count: 3
accepted answer: http://stackoverflow.com/a/78289436
type: Question

http://stackoverflow.com/comment/138003483
type: AnswerComment
has text: 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.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/78278914

http://stackoverflow.com/q/78295406
tagged with: lua
has title: Mta account char limit
type: UnansweredQuestion
score: 0
tagged with: mta
has comment: http://stackoverflow.com/comment/138032815
type: Question
answer count: 1
has body: 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, "charlimit" is recorded as "1", but despite this, a player can still create a second character. What is the solution? https://hizliresim.com/a4tmpb9 I was aiming to limit players' ability to create characters by implementing a character creation limit.
has answer: http://stackoverflow.com/a/78333552

http://stackoverflow.com/comment/137889615
comment on: http://stackoverflow.com/q/78209189
type: Comment
has text: 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.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/137984617
score: 0
type: QuestionComment
has text: 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`
type: Comment
comment on: http://stackoverflow.com/q/78263055

continuations
tag name: continuations
type: Tag
tags question: http://stackoverflow.com/q/78164268

mouse
tag name: mouse
type: Tag
tags question: http://stackoverflow.com/q/78149365
tags question: http://stackoverflow.com/q/78527511
tags question: http://stackoverflow.com/q/78715199

http://stackoverflow.com/a/78308665
score: 3
answers question: http://stackoverflow.com/q/78305561
type: Answer
has body: Check out :help vim.keymap.set(). That will take you to a reference in the lua.txt help file. Here is one of the examples from the help file: vim.keymap.set('n', '<leader>w', "<cmd>w<cr>", { silent = true, buffer = 5 }) The general form is set({mode}, {lhs}, {rhs}, {opts}) You might need to try escaping some quotes, but it could be something like this vim.keymap.set('i', '<c-f>', "<Esc>: silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"'<CR><CR>:w<CR", { silent = true, noremap = true })
upvote count: 3
downvote count: 0

suricata
tag name: suricata
tags question: http://stackoverflow.com/q/78292585
tags question: http://stackoverflow.com/q/78284139
type: Tag

http://stackoverflow.com/a/78327654
has body: To avoid your error just check whether the character has a PrimaryPart or not. If not then just set the variable as nil so we know there is no hitTarg. if character.PrimaryPart then local hitTarg = hb(Vector3.new(4,6,4), character.PrimaryPart.CFrame * Cframe.new(0,0,-3) {character}, character) else local hitTarg = nil end Just be sure that your code that handles/uses hitTarg will properly account for when that variable is nil.
score: 0
answers question: http://stackoverflow.com/q/78194647
type: Answer

watchmaker
type: Tag
tag name: watchmaker
tags question: http://stackoverflow.com/q/78245755

http://stackoverflow.com/comment/137891488
type: Comment
comment on: http://stackoverflow.com/a/78215421
score: 0
has text: Please read wiki youtube for finite state machine, it's very useful tool for such multiple modes situations aka states.
type: AnswerComment

http://stackoverflow.com/a/78320286
answers question: http://stackoverflow.com/q/78294940
score: 0
type: Answer
has body: make sure the Ore object is a string, i hope this helps :D

http://stackoverflow.com/comment/137783595
has text: 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
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78149365
type: Comment

http://stackoverflow.com/comment/137916537
type: Comment
comment on: http://stackoverflow.com/a/78225561
score: 0
type: AnswerComment
has text: This `encode_uri` implementation in Lua helped. Thanks!

http://stackoverflow.com/comment/137887173
has text: Does this answer your question? [Dealing with big numbers in Lua](https://stackoverflow.com/questions/45270543/dealing-with-big-numbers-in-lua)
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/78213071

http://stackoverflow.com/a/78224407
has body: However, if there is no space after the pattern, like: &quot;Hello &amp;greenWorld&quot; Then the code behaves incorrectly The reason for this is that %w &quot;represents all alphanumeric characters&quot;. So your match will be &amp;greenWorld rather than just &amp;green, hence the table lookup will return nil and you won't perform the replacement. Is there a way to fix this issue? Is the color name delimited? HTML escape codes for example end with a semicolon, like this: &amp;amp;. If your color names are guaranteed not to be followed by a lowercase letter, you could replace %w with [a-z]. Wanting to &quot;map&quot; some kind of &quot;names&quot; to &quot;values&quot; using gsub is a frequent occurrence, which is why gsub 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 nil, no substitution will happen. Otherwise, the entire match will be substituted with the value. Using this, you could just write: local name_to_colorcode = { [&quot;red&quot;] = &quot;#FF0000&quot;, [&quot;blue&quot;] = &quot;#4C9FFF&quot;, [&quot;purple&quot;] = &quot;#C33AFF&quot;, [&quot;green&quot;] = &quot;#53FF4A&quot;, [&quot;gray&quot;] = &quot;#E2E2E2&quot;, [&quot;black&quot;] = &quot;#000000&quot;, [&quot;white&quot;] = &quot;#FFFFFF&quot;, [&quot;pink&quot;] = &quot;#FB8DFF&quot;, [&quot;orange&quot;] = &quot;#FF8E1C&quot;, [&quot;yellow&quot;] = &quot;#FAFF52&quot;, -- TODO add more colors } local text = &quot;&amp;whiteHello&amp;white World&quot; print(text:gsub(&quot;&amp;([a-z]+)&quot;, name_to_colorcode)) This solution is pretty much strictly better 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. It is also less error-prone; there are no is…
score: 3
answers question: http://stackoverflow.com/q/78221180
type: Answer
upvote count: 3
downvote count: 0

http://stackoverflow.com/a/78219787
has comment: http://stackoverflow.com/comment/137899148
upvote count: 5
type: Answer
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/78219522
has body: If you need to convert a recursive function into a loop, then you need a stack to simulate the call stack during recursion. The for-in statement in lua needs 3 values: an iterator function, a state (the stack here), an initial value (omitted here): function NODE:visit() return function (stack) if #stack == 0 then return nil end local node = table.remove(stack) if node.right then stack[#stack + 1] = node.right end if node.left then stack[#stack + 1] = node.left end return node; end, {self} end And the usage: for node in tree:visit() do print(node.x) end

http://stackoverflow.com/comment/137925195
type: Comment
comment on: http://stackoverflow.com/a/78234223
has text: What job control advantage does Python have over some of the other embedded scripting languages mentioned above?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/137947508
type: Comment
has text: You could simplify your code to ` function on_minute() your_control.rotation = os.date '%H' * 15 end`
score: 1
comment on: http://stackoverflow.com/q/78245755
type: QuestionComment

http://stackoverflow.com/comment/137982567
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78263055

http://stackoverflow.com/a/78250564
type: Answer
has body: local Backpack = game:GetService("ReplicatedStorage"):Waitforchild("Backpack") local Player = game:GetService("Players").localplayer Player.Character.Respawned:Connect(function(Character) local clone = Backpack:clone(Character:Waitforchild("Torso")) end
answers question: http://stackoverflow.com/q/78250537
score: 0

http://stackoverflow.com/a/78278914
score: 0
has body: Find and replace in Visual Studio Code In Visual Studio Code you can find and replace all by hitting Ctrl + Shift + f Clicking on the > icon to the left of the search text 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 There is an icon to the right of the replace box, which says "Replace All (Ctrl + Alt + Enter)". You can either click on that, or use the keyboard combination it has suggested to proceed with replacing all Explanation of your variables var is an array, it is a variable which has elements, such as var[1], var[2] and so on. Precautions 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 git init git add . git commit -m "backup" Now, do the find and replace stuff and switch back to the terminal/cmd afterwards and run git diff to review all the changes you generated, see whether everything is correctly set, everything is in place, etc.
type: Answer
has comment: http://stackoverflow.com/comment/138003483
answers question: http://stackoverflow.com/q/78278826

grafana
tag name: grafana
tags question: http://stackoverflow.com/q/78254595
type: Tag

http://stackoverflow.com/a/78289436
accepted answer of: http://stackoverflow.com/q/78289418
answers question: http://stackoverflow.com/q/78289418
score: 5
has body: Multiple values get truncated when there's a comma after them. Something like this will work as a workaround: function ExecuteWithMyNameAtTheEnd(f, ...) local arg = table.pack(...) arg[arg.n + 1] = "Maxi" f(table.unpack(arg, 1, arg.n + 1)) end ExecuteWithMyNameAtTheEnd(print, 1, 2, 3)
downvote count: 0
type: AcceptedAnswer
upvote count: 5
type: Answer

http://stackoverflow.com/a/78163209
has body: This may have happened due to a recent change. Try using nvimtools/none-ls-extras.nvim as depicted below. return { "nvimtools/none-ls.nvim", dependencies = { "nvimtools/none-ls-extras.nvim", }, config = function() local null_ls = require("null-ls") null_ls.setup({ sources = { require("none-ls.diagnostics.eslint_d"), null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.prettier, }, }) vim.keymap.set("n", "<leader>fm", vim.lsp.buf.format, {}) end, }
score: 5
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78150730

binary-tree
tag name: binary-tree
type: Tag
tags question: http://stackoverflow.com/q/78219522

http://stackoverflow.com/comment/138069360
comment on: http://stackoverflow.com/a/78300938
type: Comment
has text: Yes, sure. Possible way - shift by `-tx1, -ty1`, then rotate by `-math.atan2(ty2-ty1, tx2-tx1)`
score: 0
type: AnswerComment

language-server-protocol
tag name: language-server-protocol
tags question: http://stackoverflow.com/q/78202387
type: Tag

http://stackoverflow.com/comment/137785780
has text: what kind of drawing? Can you show the full code and screenshot?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78154763

grid
type: Tag
tag name: grid
tags question: http://stackoverflow.com/q/78209189

http://stackoverflow.com/a/78247404
has body: You use packer.init and looking at the quickstart part of the packer README.md, it seems like plugins are installed using packer.startup. In there, you have to pass a function that takes a parameter use. ... local packer = require('packer') packer.startup(function(use) use{ "kylenchui/nvim-surround", tag = "*", config = function() require("nvim-surround").setup({}) end } end) ... And packer.init seems to be for configuration of packer itself.
accepted answer of: http://stackoverflow.com/q/78243000
answers question: http://stackoverflow.com/q/78243000
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/138066150
type: Comment
score: 1
has text: [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.
type: QuestionComment
comment on: http://stackoverflow.com/q/78300144

http://stackoverflow.com/a/78215421
has comment: http://stackoverflow.com/comment/137891138
has body: The state machine: sum = function (a, b) return a + b end sub = function (a, b) return a - b end States = {sum=sum, sub=sub} State = States.sum -- current state is sum c1 = State (5, 4) -- 9 State = States.sub -- and now current state is sub c2 = State (5, 4) -- 1 Just switch the state and you don't need to check condition, the state is already there.
has comment: http://stackoverflow.com/comment/137891488
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78215348

for-loop
type: Tag
tags question: http://stackoverflow.com/q/78151700
tags question: http://stackoverflow.com/q/78262662
tag name: for-loop
tags question: http://stackoverflow.com/q/78390389
tags question: http://stackoverflow.com/q/78836865

http://stackoverflow.com/a/78289010
has body: You might want to start by reading/referencing sections 10 (Lua Support in Wireshark) and 11 (Wireshark’s Lua API Reference Manual) in the Wireshark Developer's Guide. After that, you may want to reference the Wireshark Lua Wiki Page for additional help and resources, including Examples and user Contributions. You may also find the example foo.lua dissector I wrote and shared on the wireshark-dev mailing list a few years ago of some help. I included a sample foo.pcap file for testing it as well.
accepted answer of: http://stackoverflow.com/q/78283791
answers question: http://stackoverflow.com/q/78283791
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/78299952
has body: Your table ITEMSCRAPESTATS is not a sequence, instead, it is a dictionary. A regular Lua table (which essentially is a set of "key-value" pairs) is stored unsorted. In other words, Lua does not know that table key 60004 is greater than 60001. Lua does not even know that these keys are comparable. Any 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. 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 ipairs instead of pairs to traverse all keys in their numeric order. Do you have all missing keys 1-59999 present in your table? So, try to enforce the order you expect: for key = 60000, 60004 do do_smth_with(t[key]) end 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: -- collect all keys local all_keys = {} for key in pairs(t) do table.insert(all_keys, key) end -- sort keys table.sort(all_keys) -- traverse table in that order of keys for _, key in ipairs(all_keys) do do_smth_with(t[key]) end
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/78293342
downvote count: 0
score: 3

istio
tags question: http://stackoverflow.com/q/78262424
type: Tag
tag name: istio
tags question: http://stackoverflow.com/q/79358099

hash
tags question: http://stackoverflow.com/q/78239786
type: Tag
tag name: hash

scope
type: Tag
tag name: scope
tags question: http://stackoverflow.com/q/78210778

wait
tag name: wait
type: Tag
tags question: http://stackoverflow.com/q/78167836

http://stackoverflow.com/comment/138292699
type: Comment
comment on: http://stackoverflow.com/q/78434058
type: QuestionComment
has text: @Ryan_Luu the class names are numbered 1, 2, 3, 4, 5.
score: 0

http://stackoverflow.com/comment/138082398
has text: nope, nothing D:
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78320009
type: Comment

http://stackoverflow.com/comment/138179953
comment on: http://stackoverflow.com/a/78377386
type: Comment
score: 0
type: AnswerComment
has text: Oh my bad, yeah you were correct the humanoid root part IS anchored, mb for thinking it wasnt. Thank you so much i was scratching my head about this for weeks and only recently decided to get back into this

http://stackoverflow.com/a/78439808
score: 0
has body: You can use a for loop and then use the loop's index to reduce your code down to only six lines. In the below script, we iterate over subject.Name and see if index, a number, is in the subject.Name and then set the inVal.Value if it matches. for index: number = 0, 9 do if string.find(subject.Name, tostring(index)) then inVal.Value = index break end end
type: Answer
answers question: http://stackoverflow.com/q/78439743
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/78402894
tagged with: midi
tagged with: lua
has title: error ''undefigned symbol: lua_rawgetp'' while trying to bind a love project with rust
tagged with: rust
tagged with: love2d
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138242463
answer count: 0
has comment: http://stackoverflow.com/comment/138226071
has body: I have a love2d project where I am trying to bind midi controllers with rust and mlua rust library, I have this file configuration : . ├── conf.lua ├── data/ ├── fonts/ ├── icon.png ├── images/ ├── lib │ ├── bump/ │ ├── discordRPC/ │ ├── gamepadguesser/ │ └── midi_input_handler │ ├── Cargo.lock │ ├── Cargo.toml │ ├── libmidi_input_handler.so │ ├── makefile │ ├── src │ │ ├── lib.rs │ │ └── midi_handler.rs │ └── target │ ├── CACHEDIR.TAG │ └── debug │ ├── build │ │ ├── alsa-sys-77e1bf3e25c0debe/ │ │ ├── alsa-sys-b741dd268b3e925f/ │ │ ├── libc-a02a8f1a1757eae3/ │ │ ├── libc-c87ef9fe5c4c07ea/ │ │ ├── mlua-sys-54611b35a16a6525/ │ │ ├── mlua-sys-620da340fb195242/ │ │ ├── num-traits-88de8cf05bbdf5ea/ │ │ ├── num-traits-bc09a7d6340429b8/ │ │ ├── proc-macro2-590fdbef782f5a29/ │ │ └── proc-macro2-c2a63acaec6ca8e8/ │ ├── deps/ │ ├── examples/. │ ├── incremental/ │ ├── libmidi_input_handler.d │ └── libmidi_input_handler.so ├── main.lua ├── makefile ├── makelove.toml ├── README.md ├── scripts | . │ ├── input │ │ ├── input_action_state.lua │ │ ├── input_button.lua │ │ ├── input.lua │ │ ├── input_midi.lua │ │ ├── input_profile.lua │ │ └── input_user.lua | . | : ├── sfx/ └── test.toml and lib.rs : use crate::midi_handler::*; use mlua::prelude::*; use std::thread; //same name as the lib (path include...) #[mlua::lua_module] fn libmidi_input_handler(lua: &Lua) -> LuaResult<LuaTable> {lua_init(lua)} #[mlua::lua_module] fn target_debug_libmidi_input_handler(lua: &Lua) -> LuaResult<LuaTable> {lua_init(lua)} #[mlua::lua_module] fn libmidi_input_handler_libmidi_input_handler(lua: &Lua) -> LuaResult<LuaTable> {lua_init(lua)} #[mlua::lua_module] fn lib_midi_input_handler_libmidi_input_handler(lua: &Lua) -> LuaResult<LuaTable> {lua_init(lua)} #[mlua::lua_module] fn lua_init(lua: &Lua) -> LuaResult<LuaTable> { let exports = lua.create_table()?; exports.set("print_rust", lua.create_function(lua_print_rust)?)?; exports.set("innit_midi", lua.create_function(lua_innit_midi)?)?; Ok(exports) } //te…
score: 0
type: Question

http://stackoverflow.com/a/78439043
has comment: http://stackoverflow.com/comment/138338772
has comment: http://stackoverflow.com/comment/138287493
answers question: http://stackoverflow.com/q/78438152
upvote count: 3
downvote count: 0
score: 3
has body: If all you are concerned with is that it is possible to have the value be a block, inspecting the lua syntax will reveal a block can be converted to an expression by wrapping it in a function definition: return (function() print "hello"; print "world"; return 1; end)() 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. For example: some_really_long_function_name() is a valid chunk, while some_really_long_function_name() + 1 is not. however, some_really_long_function_name(2+2) is a valid expression. 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.
type: Answer

http://stackoverflow.com/comment/138143493
has text: no errors in the output D:
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78317719
type: QuestionComment

http://stackoverflow.com/q/78373365
tagged with: docker
type: Question
tagged with: lua
answer count: 0
has comment: http://stackoverflow.com/comment/138177915
tagged with: custom-plugins
tagged with: declarative
tagged with: kong
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138177479
has comment: http://stackoverflow.com/comment/138177431
score: 0
has body: I have a Kong setup based on Docker, configured in declarative mode (YAML manifest). Reference docs: Kong | DB-less and Declarative Configuration. Kong Docker Setup File kong_install.bat: @echo off docker run -d ^ --name kong-dbless ^ --network=kong-net ^ -v "C:/path/to/config/:/kong/declarative/" ^ -e "KONG_DATABASE=off" ^ -e "KONG_DECLARATIVE_CONFIG=/kong/declarative/kong.yml" ^ -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" ^ -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" ^ -e "KONG_PROXY_ERROR_LOG=/dev/stderr" ^ -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" ^ -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" ^ -e "KONG_ADMIN_GUI_URL=http://localhost:8002" ^ -p 8000:8000 ^ -p 8443:8443 ^ -p 127.0.0.1:8001:8001 ^ -p 127.0.0.1:8444:8444 ^ kong:3.6.1 pause Kong Declarative Config Here's my kong.yml manifest: _format_version: "3.0" _transform: true services: - name: example_service protocol: http host: httpbin.org port: 80 routes: - name: example_route paths: - /mock strip_path: true plugins: - name: rate-limiting route: example_route config: second: 1 minute: 10 policy: local Custom Plugin "log-test" I have a simple custom plugin that logs some message in the Kong gateway, during the processing of the request headers. File handler.lua: local LOG_TEST_Handler = {} LOG_TEST_Handler.PRIORITY = 1000 LOG_TEST_Handler.VERSION = "1.0.0" LOG_TEST_Handler.NAME = "log-test" function LOG_TEST_Handler:header_filter(config) kong.log("LOG.header_filter: start\n\n") kong.log("LOG.header_filter:\nHello world from log-test custom plugin\n\n") kong.log("LOG.header_filter: end\n\n") end return LOG_TEST_Handler File schema.lua: local typedefs = require "kong.db.schema.typedefs" return { name = "log-test", no_consumer = true, -- This plugin does not require a Consumer to be configured. fields = { }, } Question Is there a way to configure (possibly in a declarative way, i.e. via YAML manifest) Kong to install custom plugins? I've searched the documentation for hours but couldn't find anything related, excep…
has title: How can I install custom plugins in Kong using declarative configuration?

http://stackoverflow.com/comment/138420918
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78369077
has text: 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 source: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/#server-snippet
score: 0

http://stackoverflow.com/q/78444284
favorite count: 0
type: Question
downvote count: 0
has title: Decompiling Lua Issue
answer count: 0
tagged with: lua
tagged with: bytecode
has body: I'm working with the game GeminiLost from playfirst, they have an assets.pfp file that can be extracted using a BMS Script After extraction it is possible to see lua scripts that were compiled using lua 5.0 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 Output Log ChunkSpy:392: bad argument #1 to `len' (string expected, got nil) using ChunkBake: ChunkBake: A Lua 5 binary chunk assembler Version 0.7.0 (20050512) Copyright (c) 2005 Kein-Hong Man The COPYRIGHT file describes the conditions under which this software may be distributed (basically a Lua 5-style license.) * Run with option -h or --help for usage information ChunkBake:260: ok.lua:1: Error: unknown character or control character using luadec: luadec.exe: bad code in ok.lua using unluac: Exception in thread "main" java.lang.NullPointerException: Cannot invoke "unluac.decompile.Op.ordinal()" because the return value of "unluac.decompile.Code.op(int)" is null at unluac.decompile.ControlFlowHandler.find_branches(ControlFlowHandler.java:344) at unluac.decompile.ControlFlowHandler.process(ControlFlowHandler.java:118) at unluac.decompile.Decompiler.decompile(Decompiler.java:136) at unluac.Main.main(Main.java:98) 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? .lua file examples
score: 2
tagged with: scripting
tagged with: decompiling
tagged with: luadec
type: UnansweredQuestion
upvote count: 2

http://stackoverflow.com/q/78324370
score: 0
answer count: 0
tagged with: lua
has title: Wrong key, Right key script in lua
type: Question
has body: I'm doing a prank ransomware program using AutoPlay Media Studio and the only script I did was this: Dialog.Message("A message from ElsaWare...","WRONG CODE! Didn't you pay to me?") 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 "That's the right code! Now your videos will be recovered.". But if you add the incorrect code, you'll get the message that I've written above.
tagged with: autoplay-media-studio
type: UnansweredQuestion

http://stackoverflow.com/comment/138079895
score: 0
type: AnswerComment
has text: verify that the ModuleScript is being used by the appropriate ServerScript or that workspace.Checkpoints is a Model with ModelStreamingMode set to "Persistent"
type: Comment
comment on: http://stackoverflow.com/a/78320009

http://stackoverflow.com/q/78424147
score: 0
has comment: http://stackoverflow.com/comment/138263084
has body: 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. -------------------------------------- ---------- Dont touch this ----------- EnablePrimaryMouseButtonEvents (true); function OnEvent(event,arg) if EnableRCS ~= false then if RequireToggle ~= false then if IsKeyLockOn(ToggleKey)then if IsMouseButtonPressed(3)then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0,RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end else if IsMouseButtonPressed(3)then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0,RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end else end end
tagged with: logitech
type: Question
has title: Script randomly stopped working, despite not changing it or updating g hub
tagged with: lua
has comment: http://stackoverflow.com/comment/138263097
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78424253

http://stackoverflow.com/comment/138277857
has text: Monaco is a "code editor" and has nothing in particular to do with WPF.
comment on: http://stackoverflow.com/q/78432834
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138181656
type: QuestionComment
has text: [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.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78361215

http://stackoverflow.com/comment/138074608
comment on: http://stackoverflow.com/q/78309427
type: Comment
score: 0
has text: @An5Drama oh okay, so basically just validation. Got it. Edited my answer.
type: QuestionComment

http://stackoverflow.com/a/78350899
downvote count: 0
answers question: http://stackoverflow.com/q/78349259
type: Answer
upvote count: 1
has body: Yeah, you can map the key map like this. vim.keymap.set("n", "<C-BS>", "dw", {silent = true, desc = 'delete from cursor to ending word'}) vim.keymap.set("n", "<C-Del>", "db", {silent = true, desc = 'delete from cursor to beginning word'}) But note that, in some case, <C-BS> does not work as expect.
score: 1

http://stackoverflow.com/a/78369077
downvote count: 1
upvote count: 1
answers question: http://stackoverflow.com/q/78366974
has comment: http://stackoverflow.com/comment/138430855
has comment: http://stackoverflow.com/comment/138420918
has comment: http://stackoverflow.com/comment/138426808
type: AcceptedAnswer
score: 0
type: Answer
has body: So this creates a location context in your nginx.conf (under a server context): - path: /app-2 pathType: Prefix backend: service: name: app-2 port: number: 80 and this also creates a location context with the same name: location /app-2 { rewrite_by_lua_block { ngx.status = 403; ngx.exit(ngx.HTTP_FORBIDDEN); } } It's likely that this one is defined above the other one so it's overriding it. You can check with this: kubectl cp &lt;nginx-ingress-controller-pod&gt; -c nginx nginx.conf nginx.conf cat nginx.conf
accepted answer of: http://stackoverflow.com/q/78366974

http://stackoverflow.com/comment/138615002
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78427362
has text: Am I missing something or there is no actual error in the question?

http://stackoverflow.com/a/78391151
score: 0
accepted answer of: http://stackoverflow.com/q/78390389
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78390389
has body: Normally, any collision checking is a loop: (here block is a list of tiles, each tile is a table with x and y positions) function detectCollision (movingBlock, staticBlock) for i, movingTile in ipairs (movingBlock) do for j, staticTile in ipairs (staticBlock) do if isColliding (movingTile, staticTile) then return true -- yes, at least one collision end end end return false -- no, there was no collision end For the movement you can just add extra dx and dy to check the collision by this movement: function detectCollision (movingBlock, staticBlock, dx, dy) for i, movingTile in ipairs (movingBlock) do for j, staticTile in ipairs (staticBlock) do if isColliding (movingTile, staticTile, dx, dy) then return true -- yes, at least one collision end end end return false -- no, there was no collision end Example function to compare two tiles after movement to dx, dy: function isColliding (movingTile, staticTile, dx, dy) if movingTile.x + dx == staticTile.x and movingTile.y + dy == staticTile.y then return true -- same position of tiles means collision else return false -- no collision end end

http://stackoverflow.com/comment/138181638
type: QuestionComment
has text: [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.
comment on: http://stackoverflow.com/q/78361215
score: 1
type: Comment

http://stackoverflow.com/comment/138211799
score: 0
type: QuestionComment
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78394057

http://stackoverflow.com/comment/138243326
comment on: http://stackoverflow.com/q/78414522
type: Comment
score: 0
type: QuestionComment
has text: it's an option too if it works as that supposed to be

http://stackoverflow.com/a/78432412
upvote count: 1
has body: 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.)
score: 1
has comment: http://stackoverflow.com/comment/138279669
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/138274312
answers question: http://stackoverflow.com/q/78432378
has comment: http://stackoverflow.com/comment/138285623
has comment: http://stackoverflow.com/comment/138274655

http://stackoverflow.com/comment/138276191
comment on: http://stackoverflow.com/q/78433500
type: Comment
score: 0
type: QuestionComment
has text: 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.

http://stackoverflow.com/comment/138206926
comment on: http://stackoverflow.com/a/78391747
score: 0
type: Comment
type: AnswerComment
has text: 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: 1. I have to to :Lazy load lazygit in order for the keymap to work. 2. Even when I do that and Lazygit opens, it doesn't recognize the repository I am in while navigating Nvim. Appreciate your kind help.

http://stackoverflow.com/comment/138168059
type: AnswerComment
has text: Debug info was stripped, as usual, for saving space.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78330687

http://stackoverflow.com/q/78383151
answer count: 0
tagged with: openresty
type: Question
has body: How can I create symlinks in openresty via post? 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. I'm the developer using openresty as a reportportal.
has title: openresty create symlinks via post
type: UnansweredQuestion
score: 0
tagged with: lua

http://stackoverflow.com/comment/138274655
score: 0
type: AnswerComment
has text: Which physics library are you using to determine a hit between the ball and the player?
comment on: http://stackoverflow.com/a/78432412
type: Comment

http://stackoverflow.com/a/78407665
type: AcceptedAnswer
type: Answer
has body: 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. With this in mind, you can try the following, local bg_image = "beach.jpeg" local bg_pos = "left" local bg_opacity = "0.25" local bg_size = "33%" function Header(el) if el.level == 1 then el.attributes["data-background-image"] = bg_image el.attributes["data-background-position"] = bg_pos el.attributes["data-background-opacity"] = bg_opacity el.attributes["data-background-size"] = bg_size return el end end function Meta(m) m["title-slide-attributes"] = { ["data-background-image"] = bg_image, ["data-background-position"] = bg_pos, ["data-background-opacity"] = bg_opacity, ["data-background-size"] = bg_size } return m end
answers question: http://stackoverflow.com/q/78343371
accepted answer of: http://stackoverflow.com/q/78343371
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/78318512
accepted answer: http://stackoverflow.com/a/78561844
type: Question
tagged with: require
tagged with: lua
has title: Nvim lua cant require lua module with hyphens
answer count: 1
has body: 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. My Code looks like this: local function loadmodule(modulePath, moduleName) vim.opt.rtp:append(modulePath) package.loaded[moduleName] = nil require(moduleName) end loadmodule("path/to/module", "module-name") 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: E5108: Error executing lua ./lua/script.lua:5: module 'module-name' not found: no field package.preload['module-name'] cache_loader: module module-name not found cache_loader_lib: module module-name not found no file './module-name.lua' no file '/usr/share/luajit-2.1/module-name.lua' no file '/usr/local/share/lua/5.1/module-name.lua' no file '/usr/local/share/lua/5.1/module-name/init.lua' no file '/usr/share/lua/5.1/module-name.lua' no file '/usr/share/lua/5.1/module-name/init.lua' no file './module-name.so' no file '/usr/local/lib/lua/5.1/module-name.so' no file '/usr/lib/lua/5.1/module-name.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/home/user/.config/nvim//lua/lib/lua/5.1/module-name.so' obviously I am not just plugging module-name in and the module does exist on the runtimepath but nvim doesn't seem to be able to find it. I tried plugging in the modules name and it loading the module. What happened was, nvim loading the module when it doesn't have hyphens and not loading the module when it has hyphens.
has answer: http://stackoverflow.com/a/78561844
type: AnsweredQuestion
tagged with: neovim-plugin
tagged with: module
tagged with: neovim
score: 0

http://stackoverflow.com/q/78329768
downvote count: 0
tagged with: timezone-offset
has title: Why does a roundtrip Lua UTC os.date -> os.time -> os.date result in an HOUR Time difference?
tagged with: time
answer count: 1
has body: A roundtrip of os.date -> os.time -> os.date in UTC does not seem to get back to the same time: print(os.date( "!%a %b %d %H:%M:%S %Y")) print(os.date("%c" , os.time( os.date("!*t", os.time() ) ) )) Output: Mon Apr 15 16:08:48 2024 Mon Apr 15 17:08:48 2024 What am I missing? p.s. the first line is the correct time
tagged with: lua
type: AnsweredQuestion
score: 4
has answer: http://stackoverflow.com/a/78330276
accepted answer: http://stackoverflow.com/a/78330276
type: Question
favorite count: 0
upvote count: 4

http://stackoverflow.com/q/78427362
answer count: 0
tagged with: lua
tagged with: neovim
upvote count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/138615002
tagged with: neovim-plugin
tagged with: none-ls
has body: I am trying to setup neovim and I am getting following error in my NullLsLog plugin/null-ls.lua return { "nvimtools/none-ls.nvim", event = { "BufReadPre", "BufNewFile" }, dependencies = { "mason.nvim" }, config = function() require("null-ls").setup({ debug = true, }) end, opts = function() return require "custom.configs.null-ls" end, } config/null-ls.lua local augroup = vim.api.nvim_create_augroup("lspformatting", {}) local null_ls = require("null-ls") local opts = { sources = { null_ls.builtins.formatting.black, null_ls.builtins.formatting.stylua, -- null_ls.builtins.diagnostics.mypy, null_ls.builtins.formatting.terraform_fmt, null_ls.builtins.formatting.shellharden, null_ls.builtins.formatting.prettier.with({ filetypes = { "json" } }), null_ls.builtins.formatting.isort, null_ls.builtins.diagnostics.pylint.with({ prefer_local = ".venv/bin", }, { extra_args = { "--disable=C0114,C0115,C0116" } }), null_ls.builtins.diagnostics.terraform_validate, }, on_attach = function(client, bufnr) if client.supports_method("textdocument/formatting") then vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) vim.api.nvim_create_autocmd("bufwritepre", { group = augroup, buffer = bufnr, callback = function() vim.lsp.buf.format({ buffer = bufnr, async = false, filter = function(client) return client.name == "null-ls" end }) end, }) end end } return opts I am installing binaries through mason. plugins/mason.lua return { "williamboman/mason.nvim", opts = { ensure_installed = { "pyright", "mypy", "pylint", -- "flake8", -- removed in latest version of nulls ls "ruff", "black", "debugpy", "terraform-ls", "lua-language-server", "fixjson", "shellharden", "prettier", "isort", "stylua" }, }, }
has title: Neovim Vim - stylua is not executable (make sure it's installed and on your $PATH)
type: Question
downvote count: 0

http://stackoverflow.com/a/78374465
score: 3
answers question: http://stackoverflow.com/q/78369116
has comment: http://stackoverflow.com/comment/138172969
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/138173454
has body: 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 Touched 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. 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. 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. So follow these steps : Create a RemoteEvent in ReplicatedStorage named DisplayMessage In your LocalScript, delete everything except for this (don't worry, your code is moving to a Script) : -- import services local ReplicatedStorage = game:GetService("ReplicatedStorage") -- find the UI elements local lblMessage = script.Parent.Message -- find the RemoteEvent telling us that the server has a message for us local DisplayMessage = ReplicatedStorage.DisplayMessage -- display the messages when the server sends them to us DisplayMessage.OnClientEvent:Connect(function(message : string, color : Color3) lblMessage.Text = message lblMessage.Color3 = color end) Create a ModuleScript in ReplicatedStorage to handle logic for debouncing when a player touches a part. Name it debounceTouch. We'll use this to prevent a user from triggering a Touch event multiple times when their Character Model touches a part. local Players = game:GetService("Players") -- Debounce a function so that it only fires once per player touch event local function debounceTouch(part : BasePart, onPlayerTouched : (Player)->(), onPlayerTouchEnded : (Player)->()?) -- keep track of which players are touching the part local playersTouching : { [Player] : number…
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78369116

http://stackoverflow.com/a/78407002
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/78404269
answers question: http://stackoverflow.com/q/78404269
has comment: http://stackoverflow.com/comment/138231709
has body: 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. 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. From there you can listen to the event from a LocalScript. Something like the below. local SurfaceGui = script.Parent.SurfaceGui local ScreenPart = workspace.Screen local frame = script.Parent.Frame SurfaceGui.Adornee = ScreenPart SurfaceGui.Button.MouseButton1Click:Connect(function() frame.Visible = true end) (where the LocalScript is in the root of the ScreenGui)

libuv
tags question: http://stackoverflow.com/q/78375359
tag name: libuv
type: Tag
tags question: http://stackoverflow.com/q/79320906

http://stackoverflow.com/q/78443079
score: 0
type: Question
has body: 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 "Error: attempt to index local 'ssl' (a nil value)" 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: " Failed to create SSL object from socket: u.peer.connection.ssl is nil, context: ngx.timer" I have set the following settings: database = postgres pg_host = hostname.domain.com pg_port = 5432 pg_user = kong pg_password = <kong password> pg_database = kong pg_ssl = on pg_ssl_cert = certificate.crt pg_ssl_cert_key = certificate.key pg_ssl_ca_cert = ca-certificate.ca-bundle pg_ssl_verify = on pg_ssl_required = on pg_ssl_version = tlsv1_3 lua_ssl_trusted_certificate = system,ca-certificate.ca-bundle lua_ssl_verify_depth = 1 I have disabled most pg_ssl settings and tried with only "pg_ssl" on to run it with basics but I get the same error with every combination. To verify connectivity to the database I've connected using the psql command: PGSSLMODE=verify-full PGSSLROOTCERT=ca-certificate.ca-bundle psql -h host.domain.com -U kong -W -d kong SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) Type "help" for help. kong=# \q anyone have any ideas or encountered this before? Thanks!
tagged with: lua
has title: Kong Community migrations error when using postgres with SSL on Rocky Linux 9
type: UnansweredQuestion
tagged with: kong
answer count: 0

http://stackoverflow.com/a/78496044
accepted answer of: http://stackoverflow.com/q/78330939
downvote count: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/138394198
score: 1
has body: 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: https://neovim.io/doc/user/usr_41.html#41.8 VIM USER MANUAL - by Bram Moolenaar Write a Vim script
has comment: http://stackoverflow.com/comment/138393772
has comment: http://stackoverflow.com/comment/138385240
answers question: http://stackoverflow.com/q/78330939
upvote count: 1
has comment: http://stackoverflow.com/comment/138394150

http://stackoverflow.com/q/78405312
has comment: http://stackoverflow.com/comment/138226785
has comment: http://stackoverflow.com/comment/138226792
type: Question
has comment: http://stackoverflow.com/comment/138226753
has body: I wrote it after seeing that someone else had created code for a different purpose. I don't know the principle, But it just works. I tried to write for dcss(game) RC The content of the image is a list of orders that are being memorised. The purpose of the code is to enable efficient training of memorized spells It works normally when training 1 spell (now only have 1 memorized spell in total) When memorizing multiple spells saved in SetSpellTraining Start training it all But, starting to train multiple spells "at the same time" is very inefficient. (image situation, memorising a few orders.) function ready() SetSpellTraining("Passwall","Earth Magic","Earth Magic","Earth Magic",1) SetSpellTraining("Mephitic Cloud","Conjurations","Air Magic","Alchemy",5) SetSpellTraining("Ensorcelled Hibernation","Hexes","Ice Magic","Ice Magic",1) SetSpellTraining("Corpse Rot","Air","Necromancy","Poison",5) . . . -- I have over 20 SetSpellTraining but I didn't write them here. end local school_a_cost = tonumber(you.skill_cost(school_a)) local school_b_cost = tonumber(you.skill_cost(school_b)) local school_c_cost = tonumber(you.skill_cost(school_c)) local school_2_min_cost = tonumber(math.min(school_a_cost,school_b_cost)) local school_3_min_cost = tonumber(math.min(school_a_cost,school_b_cost,school_c_cost)) if spells.memorised(spell_name) then if school_a == school_b then if spells.fail(spell_name) > fail_chance then you.train_skill(school_a, 1) else you.train_skill(school_a, 0) end elseif school_a ~= school_b and school_b == school_c then if spells.fail(spell_name) > fail_chance then if school_a_cost == school_2_min_cost then you.train_skill(school_a, 1) you.train_skill(school_b, 0) else you.train_skill(school_a, 0) you.train_skill(school_b, 1) end else you.train_skill(school_a, 0) you.train_skill(school_b, 0) end else if spells.fail(spell_name) > fail_chance then if school_a_cost == school_3_min_cost then you.train_skill(school_a, 1) you.train_skill(school_b, 0) you.train_skill(scho…
tagged with: lua
has comment: http://stackoverflow.com/comment/138226816
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138226801
score: 0
has title: How to load just one item from the data list?
answer count: 0

http://stackoverflow.com/q/78367547
type: Question
tagged with: debugging
has body: 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. 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.
has title: how to debug FiveM LuA Language with executable file FiveM.exe on Vscode
tagged with: lua
has answer: http://stackoverflow.com/a/78920417
tagged with: fivem
answer count: 1
type: UnansweredQuestion
score: 0
tagged with: vscode-debugger

http://stackoverflow.com/a/78393109
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78386191
type: AcceptedAnswer
type: Answer
has body: i hope this is can help you. local override = { char = function() -- whatever you want here print("Hello") end, byte = function() -- whatever you want here print("World") end } local str = {}; str.__index = string; string = setmetatable(override, str); string.char() -- Hello string.byte() -- World print(string.lower("HELLO WORLD!")) -- Old string functions still work
downvote count: 0
answers question: http://stackoverflow.com/q/78386191
score: 1

http://stackoverflow.com/q/78404978
type: Question
has answer: http://stackoverflow.com/a/78405115
possible better answer: http://stackoverflow.com/a/78405110
tagged with: lua
accepted answer: http://stackoverflow.com/a/78416709
has title: What is the "undetected" symbol in lua
score: 1
upvote count: 1
tagged with: string
tagged with: symbols
favorite count: 0
has answer: http://stackoverflow.com/a/78416709
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78405110
answer count: 4
downvote count: 0
has answer: http://stackoverflow.com/a/78405022
has body: a = string.sub("слово", 1,1) слово is a word in russian which needs 2 bytes for every letter and the output for print(a) is going to something like � depending on where you run it if a =="?" then if a =="�" then if a =="" then if a ==nil then doesn't work I just want to know which symbol would work for the if statement

http://stackoverflow.com/a/78595253
score: 0
type: Answer
has body: 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: mvn clean package &amp;&amp; java -jar /path/to/*.jar in terminal. If you use Gradle, run: gradle run in terminal.
answers question: http://stackoverflow.com/q/78308549

http://stackoverflow.com/q/78432834
has comment: http://stackoverflow.com/comment/138277444
tagged with: text
type: UnansweredQuestion
has title: How to install Monaco editor into a WPF app
tagged with: wpf
tagged with: text-editor
score: 0
type: Question
answer count: 0
tagged with: lua
has body: I want to install Monaco editor into a WPF app, I Tried looking the issue up on youtube but nothing came up. 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.
has comment: http://stackoverflow.com/comment/138277857
tagged with: monaco-editor

http://stackoverflow.com/q/78400404
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/138217640
has title: Is it safe to call lua function again in a c++ funciton called by lua?
tagged with: luabind
has body: For example (pseudoc code): //c++ void foo() { // call lua function bar luapcall(bar,... } //binding code export c_foo... //lua function bar() return nil c_foo() In this case, will lua stack be broken and lead to crash?
type: UnansweredQuestion
score: 0
type: Question

http://stackoverflow.com/comment/138430855
score: 0
comment on: http://stackoverflow.com/a/78369077
type: AnswerComment
has text: feel free to edit it and i will be pleased to up vote your comment, no worries
type: Comment

utf-8
tags question: http://stackoverflow.com/q/78386191
tag name: utf-8
type: Tag

declarative
type: Tag
tag name: declarative
tags question: http://stackoverflow.com/q/78373365

http://stackoverflow.com/comment/138226753
comment on: http://stackoverflow.com/q/78405312
has text: 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
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/138338772
comment on: http://stackoverflow.com/a/78439043
score: 0
type: AnswerComment
has text: 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 `.
type: Comment

http://stackoverflow.com/a/78309710
has body: 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. %b, %1). You are right: Lua patterns do not operate on "code points", they operate on bytes. That's why \u{4e00}-\u{9FFF} doesn't work: What Lua sees here is \228\184\128-\233\191\191, equivalent to \184\191\228\128-\233, which is very different from what you want (notably, the range is suddenly from \128 to \233). I consider the interaction of - with multibyte "characters" that appear as a single code point in the sources a bit of a footgun. Since you want a pure Lua solution, and given the simplicity of your pattern, a handmade solution is feasible: local codepoints = {} for _, c in utf8.codes(s) do if utf8.char(c):match"^%s$" and codepoints[1] == nil then codepoints[1] = c elseif c >= 0x4e00 and c <= 0x9FFF then table.insert(codepoints, c) else codepoints = {} end end local match = utf8.char(table.unpack(codepoints)) if match:match"^%s?$" then match = nil end -- single space or empty string Edit: Since you want to check for a full match, this can be simplified: local match = true local got_chinese_character = false for p, c in utf8.codes(s) do if c >= 0x4e00 and c <= 0x9FFF then got_chinese_character = true elseif p > 1 or not utf8.char(c):match"^%s$" then -- non-chinese character that is not a leading space match = false break end end match = match and got_chinese_character
downvote count: 0
answers question: http://stackoverflow.com/q/78309427
score: 3
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78309427
upvote count: 3

http://stackoverflow.com/a/78424253
has comment: http://stackoverflow.com/comment/138260886
answers question: http://stackoverflow.com/q/78424147
has body: else end The else is the problem. There is no other code before the end at the else. 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.
score: 0
has comment: http://stackoverflow.com/comment/138262342
type: Answer

http://stackoverflow.com/q/78432378
has title: Player holding ball in server but not on client
upvote count: 2
type: Question
tagged with: lua
tagged with: roblox
tagged with: roblox-studio
has answer: http://stackoverflow.com/a/78432412
score: 2
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has body: 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. -- This script is made in StarterCharacterScripts -- while true do -- a loop looping forever to check if the character is touching anything for i,v in ipairs(script.Parent:GetChildren()) do -- Looping through the whole body check all the body parts if v:IsA("Part") or v:IsA("MeshPart") then -- Checking if it is a body part (just to prevent it checking he humanoid so we won't get an error v.Touched:Connect(function(hit) -- see if the body part is touching anything if hit.Name == "Ball" then -- Checking if it is a ball print("Ball") hit.Parent = script.Parent -- putting the ball inside of the body hit.Joint.Part0 = script.Parent.RightHand -- positioning it on the right place print("Holding") end end) wait() end end wait() end This is the code I am using now, I still have one on the ball before. local BALL = require(game.ServerScriptService.ModuleScript) -- requiring the base module script.Parent.Touched:Connect(function(hit) -- Checking if the ball is touched by anything if hit.Parent:FindFirstChild("Humanoid") then -- see if it is a player BALL.Pickup(hit, script.Parent) -- Using the function from the module end end) Here is the module local BALL = {} -- the table BALL.Pickup = function(hit, ball) -- The function ball.Parent = hit.Parent -- setting its parent ball.Joint.Part0 = hit.Parent:WaitForChild("RightHand") -- positioning again print(ball.Joint.Part0) -- just for debugging end return BALL I hope you guys can help me solve this problem btw the ball aren't running away on roblox player but I just can't grab it
answer count: 1

http://stackoverflow.com/comment/138287493
has text: 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
type: Comment
comment on: http://stackoverflow.com/a/78439043
score: 1
type: AnswerComment

http://stackoverflow.com/q/78308549
has comment: http://stackoverflow.com/comment/138062159
score: 0
has title: Running Java files with Neovim ide
answer count: 2
tagged with: neovim-plugin
downvote count: 1
tagged with: neovim
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/79033092
type: Question
tagged with: java
has body: 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 "java file.java" since i am using files from other classes. Is there any code runner type plugin that works perfectly in neovim specifically for java? For eg: package com.khush.distributed.cache; public class Main { public static void main(String[] args) { Cache cache = new Cache(4); cache.put("1", "1"); cache.put("2", "2"); cache.put("3", "3"); cache.put("4", "4"); cache.printList(); System.out.println(); System.out.println(); cache.get("2"); cache.printList(); cache.put("5", "5"); System.out.println(); System.out.println(); cache.printList(); } } When i try to run this. it can't find the Cache class because obviously it is not compiled (ps: Cache class is in the same package) Main.java:5: error: cannot find symbol Cache cache = new Cache(4); ^ symbol: class Cache location: class Main Main.java:5: error: cannot find symbol Cache cache = new Cache(4); ^ symbol: class Cache location: class Main 2 errors [Process exited 1] how can i fix this? here is my .lua config that i am using for running the code return { "CRAG666/code_runner.nvim", config = function() require("code_runner").setup({ filetype = { java = { "cd $dir &&", "javac $fileName &&", "java $fileNameWithoutExt", }, python = "python3 -u", typescript = "deno run", rust = { "cd $dir &&", "rustc $fileName &&", "$dir/$fileNameWithoutExt", }, }, }) vim.keymap.set("n", "<leader>r", ":RunCode<CR>", { noremap = true, silent = false }) vim.keymap.set("n", "<leader>rf", ":RunFile<CR>", { noremap = true, silent = false }) vim.keymap.set("n", "<leader>rp", ":RunProject<CR>", { noremap = true, silent = false }) end, } apart from this plugin, i did try some other plugins aswell but i am not really that good with setting things up yet, Any help with this is appreciated, thank you.
tagged with: plugins
tagged with: lua
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78595253

http://stackoverflow.com/comment/138292678
has text: 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)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78434058

http://stackoverflow.com/q/78339620
answer count: 0
tagged with: lua
type: UnansweredQuestion
has title: HAProxy Fails to Execute Lua Script Correctly and Cannot Detect Backend
has body: 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 Despite these settings, I consistently receive the error message: "No backend associated with the transaction." 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. my lua script : -- haproxy.lua -- Track the previous states of nodeA and nodeB local previous_state_nodeA = "up" -- initial state assumed to be up local previous_state_nodeB = "backup" -- initial state assumed to be backup core.register_action("server_state_change", { "http-req", "tcp-req" }, function(txn) -- Verify if the transaction is linked to a backend if txn.b ~= nil then local be = txn.b local server = be:get_server(txn.sf:srv_name()) local state = server:get_stats()["status"] if be.name == "mybackend" then if server.name == "nodeA" then -- Execute action if state change detected for nodeA check_and_trigger_action_nodeA(state) elseif server.name == "nodeB" then -- Execute action if state change detected for nodeB check_and_trigger_action_nodeB(state) end end else -- Log an error when no backend is associated with the transaction core.log(core.err, "No backend associated with the transaction") end end) Here are the details of my backend configuration: backend mybackend mode http balance roundrobin http-request lua.server_state_change cookie Cookie prefix nocache default-server inter 3s fall 3 rise 2 server nodeA nodea.example.net:80 check server nodeB nodeb.example.net:80 check backup
score: 0
type: Question
tagged with: haproxy

http://stackoverflow.com/q/78404269
has title: How do I open a frame in my screengui from pressing a button on my surfacegui?
has answer: http://stackoverflow.com/a/78407002
answer count: 1
accepted answer: http://stackoverflow.com/a/78407002
score: 0
has body: 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. local MyButton = script.Parent local frame = game.StarterGui.ScreenGui.Frame MyButton.MouseButton1Click:Connect(function() frame.Visible = true end) ![the hierarchy of the StarterGui.] (https://i.sstatic.net/TMWlbZBJ.png) I tried making the code where when button is pressed it would make frame visible.
type: AnsweredQuestion
tagged with: lua
type: Question
tagged with: roblox

http://stackoverflow.com/a/78416709
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78404978
answers question: http://stackoverflow.com/q/78404978
has body: To select n-th symbol of UTF-8 string, use utf8.offset (Lua 5.3+ is required): local s = "слово" local n = 4 local c = s:match(utf8.charpattern, utf8.offset(s,n)) print(c) --> в if c == "в" then .... end
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/138154150
type: QuestionComment
comment on: http://stackoverflow.com/q/78363120
score: 1
type: Comment
has text: What is in the `startpage` folder?

http://stackoverflow.com/q/78310793
answer count: 1
favorite count: 0
type: Question
tagged with: game-development
has body: I have a code and I want the function to be on top, not in the loop itself. How do I do that? local blocks = workspace.test:GetChildren() for indx, obj in pairs(blocks) do obj.Touched:connect(function() wait(3) obj.BrickColor = BrickColor.Random() end) end I don't know how to do it...post how to do it right please
tagged with: roblox
upvote count: 1
has title: How to remove function from "for" in Roblox Studio?
tagged with: lua
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: roblox-studio
has answer: http://stackoverflow.com/a/78310929

http://stackoverflow.com/comment/138076858
type: Comment
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/78317719
score: 1

http://stackoverflow.com/q/78433872
tagged with: neovim-plugin
tagged with: neovim
type: UnansweredQuestion
score: 1
has body: I set following in lua/community.lua: ---@type LazySpec return { "AstroNvim/astrocommunity", { import = "astrocommunity.pack.lua" }, { import = "astrocommunity.pack.java" }, } And I set the following in lua/plugins/astrolsp.lua : mappings = { n = { gl = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" }, gh = { function() vim.lsp.buf.hover() end, desc = "Show LSP Hover" }, }, }, on_attach = function(client, bufnr) end, But, when I try to use gh for the hover effect in a Java project, nothing happens.
favorite count: 0
answer count: 0
type: Question
upvote count: 1
tagged with: lua
has title: How to set mapping in AstroNvim?
downvote count: 0

http://stackoverflow.com/q/78407863
score: 0
has answer: http://stackoverflow.com/a/78410008
type: Question
has title: Source a shell script when loading a modulefile in lua
tagged with: lua
has body: I am writing some .lua files for loading modules in a HPC system. Basically the application I want to make a module is Spack, and it has an autocompletion shell script for sourcing it in linux with: source /apps/spack/share/spack/setup-env.sh 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: os.execute('source /apps/spack/share/spack/setup-env.sh') 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. Any help is welcome, thank you!
possible better answer: http://stackoverflow.com/a/78410008
accepted answer: http://stackoverflow.com/a/78435508
tagged with: spack
answer count: 2
has answer: http://stackoverflow.com/a/78435508
has comment: http://stackoverflow.com/comment/138246615
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138240281
tagged with: module
tagged with: hpc

http://stackoverflow.com/q/78411358
tagged with: roblox
accepted answer: http://stackoverflow.com/a/78411385
tagged with: lua
has answer: http://stackoverflow.com/a/78411385
type: AnsweredQuestion
answer count: 1
score: 0
type: Question
has title: Knit function signature changes when passed as an argument between service and module
has body: So through an event I use my SCP867Service:Test onto my Effect's module --Service script function SCP867Service:Test(player) Effect.Apply(self.PrintSomething, player, 10, 1, "Test") wait(5) Effect.Remove(self.PrintSomething, player, "Test") end --Module script function effect.Apply(func, player, duration, tickSpeed, tag) --Check if the player already has the effect, bad code we don't check nil cases local owningPlayer = game.Players:GetPlayerFromCharacter(player.Parent) if effectsStorage[owningPlayer] and not Macros.findValue(effectsStorage[owningPlayer], func) then --Adding to all tables local functionCoroutine = coroutine.create(function()func(player, duration, tickSpeed)end) 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: function SCP867Service:PrintSomething(player, duration, tickSpeed) for i = 1, duration, 1 do print("Testing count: ", i) task.wait(tickSpeed) end end However here player = 10, duration =1 and tickSpeed = nil What causes this? 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. local functionCoroutine = coroutine.create(function() func(nil, player, duration, tickSpeed)end)

http://stackoverflow.com/q/78360664
upvote count: 1
has comment: http://stackoverflow.com/comment/138151461
answer count: 1
has answer: http://stackoverflow.com/a/78367517
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138150471
favorite count: 0
downvote count: 0
has body: I am reading Programming in Lua, 4th edition with an intention to solve every exercise in that book. The last exercise in Chapter 21 p. 172 is the following (emphs are mine): 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. My solution is the following : Account = {} local proxyToAccount = {} function Account:new () local proxy = {} proxyToAccount[proxy] = { balance = 0 } setmetatable(proxy, self) self.__index = self return proxy end function Account:balance () return proxyToAccount[self].balance end function Account:withdraw (v) proxyToAccount[self].balance = proxyToAccount[self].balance - v end function Account:deposit (v) proxyToAccount[self].balance = proxyToAccount[self].balance + v end return Account Which is barely different from the example provided by the book itself (several pages above): local balance = {} Account = {} function Account:withdraw (v) balance[self] = balance[self] - v end function Account:deposit (v) balance[self] = balance[self] + v end function Account:balance () return balance[self] end function Account:new (o) o = o or {} -- create table if user does not provide one setmetatable(o, self) self.__index = self balance[o] = 0 -- initial balance return o end return Account I am asking for your opinion if I understand the exercise correctly and if my solution is a correct one. Thank you in advance !
has title: Dual representation and proxies to achieve privacy in Lua
tagged with: oop
tagged with: lua
tagged with: lua-table
type: Question
tagged with: private
score: 1
has comment: http://stackoverflow.com/comment/138149490
has comment: http://stackoverflow.com/comment/138148147

http://stackoverflow.com/q/78361071
has body: 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. Is that possible to do that with nvim easily? 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. Any idea and tips?
type: Question
has title: Attach and debug NVim current running session's plugin with a lua debugger
tagged with: plugins
downvote count: 0
tagged with: debugging
tagged with: runtime
answer count: 0
score: 1
tagged with: lua
type: UnansweredQuestion
tagged with: neovim
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/78325836
upvote count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: neovim-plugin
has body: I'm having some trouble using folke/todo-comments.nvim. The highlighting works great and all, but when I use <leader>st (my shortcut for :TodoTelescope), it is searching through all the files I have in any directory. This does happen with other functions like :TodoTrouble as well. This is the plugins.lua return for folke/todo-comments.nvim: { "folke/todo-comments.nvim", cmd = { "TodoTrouble", "TodoTelescope" }, event = "LazyFile", dependencies = { "nvim-lua/plenary.nvim" }, config= function() local todo_comments = require("todo-comments") todo_comments.setup() end, keys = { { "]t", function() require("todo-comments").jump_next() end, desc = "Next Todo Comment" }, { "[t", function() require("todo-comments").jump_prev() end, desc = "Previous Todo Comment" }, { "<leader>xt", "<cmd>TodoTrouble<cr>", desc = "Todo (Trouble)" }, { "<leader>xT", "<cmd>TodoTrouble keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme (Trouble)" }, { "<leader>st", "<cmd>TodoTelescope<cr>", desc = "Todo" }, { "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" }, }, }, I've already installed ripgrep and fzf, and I have all the dependencies of the project installed. I'm also using LazyVim as my Neovim distribution and Ubuntu 22.04.4 LTS as my OS.
answer count: 1
tagged with: neovim
has title: todo-comments.nvim: :TodoTelescope is searching for Todo comments in all of my files, not just the ones in the tree
type: Question
downvote count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/78331803

http://stackoverflow.com/q/78309427
tagged with: lua
tagged with: lua-patterns
has comment: http://stackoverflow.com/comment/138057459
tagged with: unicode
score: 2
favorite count: 0
linked to: http://stackoverflow.com/q/27373578
upvote count: 2
type: AnsweredQuestion
has body: I tried use string.match("Í",'%s?[\u{4e00}-\u{9FFF}]+') which is similar to how we work in JS or others. But it will match one unnecessary character like the above 'Í'. The official implementation of matching UTF-8 is using eacape \ddd but \u{XXX} seems to fail because Lua's pattern matching facilities work byte by byte Temporarily, I use the unstable workaround similar to utf8.charpattern: string.match("Í",'%s?[\228-\233][%z\1-\191][%z\1-\191]') based on the utf8 encoding will output nil and works for checking cjk like '我' although it has one wrong range for the 2nd Byte from left. Q: How to solve this problem with regex?
has comment: http://stackoverflow.com/comment/138057292
answer count: 1
has comment: http://stackoverflow.com/comment/138074608
has comment: http://stackoverflow.com/comment/138064833
has comment: http://stackoverflow.com/comment/138065445
accepted answer: http://stackoverflow.com/a/78309710
type: Question
downvote count: 0
tagged with: cjk
has comment: http://stackoverflow.com/comment/138064972
has title: regex for the pattern of one optional space before Chinese words in lua
has answer: http://stackoverflow.com/a/78309710

http://stackoverflow.com/q/78341564
score: 0
type: Question
has title: Add custom VSCode style snippets to NVChad
tagged with: lua
has body: Using Neovim with NVChad. I have read the documentation but can't get it to work unless I add my custom snippets to the default friendly-snippets folder. According to the NVChad docs: -- vscode format i.e json files vim.g.vscode_snippets_path = "your snippets path" -- snipmate format vim.g.snipmate_snippets_path = "your snippets path" -- lua format vim.g.lua_snippets_path = vim.fn.stdpath "config" .. "/lua/lua_snippets" These are the relevant files from my project, but nothing makes a difference. I can see that Neovim is picking up the vscode_snippets_path but it's not loading the custom snippets. I haven't changed anything else to do with snippets in the configuration. What am I missing?
tagged with: code-snippets
type: UnansweredQuestion
tagged with: neovim
answer count: 0

http://stackoverflow.com/a/78354275
has body: You could check your network status with ping 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). -- ping to host 8.8.8.8 without output local ret = os.execute("ping -c 3 8.8.8.8 > /dev/null 2>&1") if ret == 0 then print("Network ON") else print("Network OFF") end
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78349390
answers question: http://stackoverflow.com/q/78349390
score: 1
upvote count: 1

http://stackoverflow.com/comment/138149490
comment on: http://stackoverflow.com/q/78360664
type: Comment
has text: @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.
score: 0
type: QuestionComment

http://stackoverflow.com/q/78434058
score: 0
has body: 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 LoadAnimation() function needs to load an animation object, which I've tried keyframes and even just added an Animation Object with an animation ID of "17401496431" and nothing changes. (This is a server script) local MH = require(game.ServerStorage.modules.MuchachoHitbox) local remote = game.ReplicatedStorage:WaitForChild("Combat Event") local MaxCombo = 5 game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:SetAttribute("Combo", 1) end) end) local function SetCombo(character) local combo = character:GetAttribute("Combo") if combo < MaxCombo then character:SetAttribute("Combo", combo + 1) else character:SetAttribute("Combo", 1) end end remote.OnServerEvent:Connect(function(player) local character = player.Character local humanoid = character:WaitForChild("Humanoid") local rootPart = humanoid.RootPart local animator = humanoid:WaitForChild("Animator") local combo = character:GetAttribute("Combo") local attacking = character:GetAttribute("Attacking") if attacking then return end character:SetAttribute("Attacking", true) local animations = game.ReplicatedStorage["hit anims"]:GetChildren() local animation = animator:LoadAnimation(animations[combo]) local hitbox = MH.CreateHitbox() hitbox.Size = Vector3.new(6, 6, 6) hitbox.Offset = CFrame.new(0, 0, -2.5) hitbox.CFrame = rootPart -- hitbox.Visualizer = false animation.Stopped:Connect(function() character:SetAttribute("Attacking", nil) hitbox:Stop() end) hitbox.Touched:Connect(function(hit, hum) if hum == humanoid then return end hum:TakeDamage(5) end) animation:Play() task.wait(0.16) hitbox:Start() SetCombo(character) end) 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.
type: Question
tagged with: luau
has comment: http://stackoverflow.com/comment/138292699
has comment: http://stackoverflow.com/comment/138292678
has title: Roblox Animation Loading, Not Loading
has comment: http://stackoverflow.com/comment/138287710
tagged with: roblox
has comment: http://stackoverflow.com/comment/138287294
has comment: http://stackoverflow.com/comment/138279319
has comment: http://stackoverflow.com/comment/138279245
type: UnansweredQuestion
tagged with: lua
answer count: 0
tagged with: roblox-studio

http://stackoverflow.com/q/78369116
tagged with: roblox
has comment: http://stackoverflow.com/comment/138163177
tagged with: roblox-studio
has comment: http://stackoverflow.com/comment/138162967
has body: 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. -- This script controls the progress of the messages! (It's the GOAT) local message = script.Parent.Message -- Wait for character to load local player = game:GetService("Players").LocalPlayer local character = player.Character or player.CharacterAdded:Wait() -- Change message task.wait(7) message.Text = "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." -- Change message task.wait(7) message.Text = "[static] This is the Robloxian Police Department, Barricaded Supsects Division. We have a warrant for your arrest on counts of [static]..." message.TextColor3 = BrickColor.Red().Color script["Heli Sound"]:Play() -- Change message task.wait(5) message.Text = "Uh oh..." message.TextColor3 = BrickColor.Black().Color -- Change message task.wait(2) message.Text = "If you don't come out and surrender now, we will raid the premises!" message.TextColor3 = BrickColor.Red().Color -- Change message task.wait(3) message.Text = "Get to the panic room! NOW!!!" -- Enable panic room game:GetService("Workspace").Button.Part.ClickDetector.MaxActivationDistance = 32 message.TextColor3 = BrickColor.Black().Color game:GetService("Workspace").TouchDetector.Touched:Connect(function(otherPart: BasePart) -- In the panic room task.wait(1) script["Explosion"]:Play() -- Change message task.wait(3) message.Text = "They're raiding the house... we should be safe in here." script["Loud Explosion"]:Play() -- Change message task.wait(2) message.Text = "They're in the panic room!" message.TextColor3 = BrickColor.Red().Color script["Extra Loud Explosion"]:Play() -- Change message task.wait(2) message.Text = "I don't think we're as safe as I thought. Grab that rifle from the floor and get to the basement, Q…
tagged with: lua
has answer: http://stackoverflow.com/a/78374465
has comment: http://stackoverflow.com/comment/138163170
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138163140
has comment: http://stackoverflow.com/comment/138163191
answer count: 1
has comment: http://stackoverflow.com/comment/138162980
has title: Roblox LocalScript Triggering Code Multiple Times
favorite count: 0
has comment: http://stackoverflow.com/comment/138162990
score: 0
type: Question
upvote count: 1
tagged with: luau
tagged with: events
accepted answer: http://stackoverflow.com/a/78374465
linked to: http://stackoverflow.com/q/24004791

http://stackoverflow.com/q/78392555
accepted answer: http://stackoverflow.com/a/78397758
tagged with: optimization
tagged with: bytecode
has title: How does Lua take advantage of <const> when emitting bytecode?
tagged with: compiler-optimization
answer count: 1
has comment: http://stackoverflow.com/comment/138206514
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78397758
upvote count: 3
has body: I'm toying with Lua and using https://www.luac.nl/ to see how it translates to bytecode. I wanted to see if a pattern like if boolean_always_true then ... end where the boolean was defined with <const> would get optimized. Same for always false boolean. local always_true <const> = true local always_false <const> = false function foo() if always_true then print("Hello World!") end end function bar() if always_false then print("Hello World!") end end ends up being function foo() --line 4 through 8 1 GETTABUP 0 0 0 ; _ENV "print" 2 LOADK 1 1 ; "Hello World!" 3 CALL 0 2 1 ; 1 in 0 out 4 RETURN0 function bar() --line 10 through 14 1 LOADFALSE 0 2 TEST 0 0 3 JMP 3 to pc 7 4 GETTABUP 0 0 0 ; _ENV "print" 5 LOADK 1 1 ; "Hello World!" 6 CALL 0 2 1 ; 1 in 0 out 7 RETURN0 Why does the always_true case gets optimized and the if disappears but the always_false case doesn't? I tried different configurations of the code and looking at the produced bytecode with https://www.luac.nl/. I was expecting bar to just be RETURN0
type: Question
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/138206253
tagged with: lua

http://stackoverflow.com/q/78420466
tagged with: roblox
type: Question
has title: Set CollisionFidelity of a Union obtained using a "SubtractAsync" function
tagged with: lua
tagged with: roblox-studio
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/78421665
accepted answer: http://stackoverflow.com/a/78421665
type: AnsweredQuestion
tagged with: luau
has body: I have a script which randomly generates underground rooms in a BasePart using the SubtractAsync function. It works perfectly fine, however the CollisionFidelity is inaccurate, leading to me being unable to enter the rooms. Here is the code: [...] for _,i in workspace:GetPartsInPart(p) do -- Gets parts to be cut into 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) local fi = i:SubtractAsync({b.RemoveFromTerrain}) -- Cuts fi.Parent = i.Parent -- Replaces part with cut part i:Destroy() end) end [...] Note that despite being quite slow, if I can get it to work, the performance loss I would suffer from using SubtractAsync would be worth it in my case. I have tried the following: Setting the CollisionFidelity in the script after the Union was created -&gt; cannot set because no (The current thread cannot write 'CollisionFidelity' (lacking capability Plugin)) Setting the CollisionFidelity in Studio on the part I'm cutting into -&gt; BaseParts don't have the CollisionFidelity property

http://stackoverflow.com/q/78386191
tagged with: lua
tagged with: utf-8
accepted answer: http://stackoverflow.com/a/78393109
tagged with: overloading
has comment: http://stackoverflow.com/comment/138196883
has title: How to overload functions string.byte and string.char to support Unicode UTF-8?
tagged with: string
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78393109
has comment: http://stackoverflow.com/comment/138197212
answer count: 1
has comment: http://stackoverflow.com/comment/138195977
score: 0
type: Question
has body: I have custom functions utf8Char (decimal) and utf8Byte(char). How can I overload the functions string.char(...) and string.byte(s, i, j) in Lua? Here is an example function what I mean: local originalStringCharFunction = string.char -- new function: function string.char(...) local args = {...} local chars = {} for i, codepoint in ipairs(args) do chars[i] = utf8Char(codepoint, originalStringCharFunction) end return table.concat(chars) end

http://stackoverflow.com/comment/138236743
has text: 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)
type: Comment
comment on: http://stackoverflow.com/q/78411075
type: QuestionComment
score: 1

http://stackoverflow.com/q/78438152
answer count: 1
has comment: http://stackoverflow.com/comment/138284583
type: UnansweredQuestion
favorite count: 0
score: 3
upvote count: 3
type: Question
downvote count: 0
has title: Evaluate string as Lua expression or chunk?
tagged with: lua
has comment: http://stackoverflow.com/comment/138284585
has answer: http://stackoverflow.com/a/78439043
has body: tl;dr; is there a simple way to evaluate a string as either a Lua chunk or a Lua expression without having to first manually figure out which it is? I'm using the Lua C API (i.e. luaL_dostring) to evaluate externally supplied strings for there side effects and I have it almost working. The remaining issue is that luaL_dostring assumes that it's provided with a chunk (which I want to support in some complex cases) that assumption is causing issues in simple cases with expressions that are more complicated than a simple function call: Examples: Fn() works Fn() and Thing() FAILS if Fn() then Thing() end works Fn1() and Fn2() and Fn3() FAILS if Fn1() and Fn2() and Fn3() then ; end works if Fn1() and Fn2() then Fn3() end works return Fn1() and Fn2() and Fn3() works 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 "it does what it says on the tin" (the expression is evaluated for it's side effects so requiring "returning" something is an unwanted distraction for most users). After a bit of playing around, I've been able to find string manglings that allows each of those to work, but no one thing that makes all of the above work.
has comment: http://stackoverflow.com/comment/138285215

http://stackoverflow.com/q/78439743
has answer: http://stackoverflow.com/a/78439808
possible better answer: http://stackoverflow.com/a/78439808
downvote count: 2
upvote count: 2
answer count: 2
has title: LuaU - Need to make this efficient, don't want to spam elseifs
has answer: http://stackoverflow.com/a/78440312
favorite count: 0
score: 0
type: AnsweredQuestion
has body: 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. if string.find(subject.Name, 0) then inVal.Value = 0 elseif string.find(subject.Name, 1) then inVal.Value = 1 elseif string.find(subject.Name, 2) then inVal.Value = 2 elseif string.find(subject.Name, 3) then inVal.Value = 3 elseif string.find(subject.Name, 4) then inVal.Value = 4 elseif string.find(subject.Name, 5) then inVal.Value = 5 elseif string.find(subject.Name, 6) then inVal.Value = 6 elseif string.find(subject.Name, 7) then inVal.Value = 7 elseif string.find(subject.Name, 8) then inVal.Value = 8 elseif string.find(subject.Name, 9) then inVal.Value = 9 end
tagged with: luau
accepted answer: http://stackoverflow.com/a/78440312
tagged with: lua
type: Question

http://stackoverflow.com/a/78331803
type: Answer
has body: For those with the same problem, I've found out that neo-tree does not cd to the current directory. To correct that, you need to add this to your init.lua file: vim.cmd(autocmd BufEnter * silent! lcd %:p:h )
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/78325836

http://stackoverflow.com/comment/138119135
has text: is there a way to make it easier to read and less obfuscated?
comment on: http://stackoverflow.com/a/78330687
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/78396506
has answer: http://stackoverflow.com/a/78396898
tagged with: roblox-studio
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78432436
favorite count: 0
answer count: 2
score: -1
downvote count: 1
has comment: http://stackoverflow.com/comment/138215340
has body: I've written some code that allows a player to take a sip of the item "OrangeJuiceTool" 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: local DataStoreService = game:GetService("DataStoreService") local DataStore = DataStoreService:GetDataStore("TimeStats") game.Players.PlayerAdded:Connect(function(Player) local Leaderstats = Instance.new("Folder") Leaderstats.Name = "leaderstats" Leaderstats.Parent = Player local Sips = Instance.new("IntValue") Sips.Name = "Sips" Sips.Value = 0 Sips.Parent = Leaderstats local tool = game.StarterPack:WaitForChild("OrangeJuiceTool") local Data = DataStore:GetAsync(Player.UserId) if Data then Sips.Value = Data end local function IncrementSips() Sips.Value = Sips.Value + 1 end tool.Equipped:Connect(IncrementSips) Player.CharacterAdded:Connect(function(Character) local Tool = Character:FindFirstChildOfClass("Tool") if Tool and Tool.Name == "OrangeJuiceTool" then Tool.Activated:Connect(IncrementSips) end end) end) game.Players.PlayerRemoving:Connect(function(Player) DataStore:SetAsync(Player.UserId, Player.leaderstats.Sips.Value) end) I tried to update the code with different functions, didn't work :(
has title: How to add a point to a leaderboard whenever a tool is used via Lua?
type: Question
tagged with: roblox
upvote count: 0
tagged with: lua

http://stackoverflow.com/q/78411075
tagged with: c#
has comment: http://stackoverflow.com/comment/138236743
type: UnansweredQuestion
tagged with: game-development
has title: NLua calling non existant function
score: 0
type: Question
tagged with: nlua
has body: 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 "{CurrentAnimation}_Loop" 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. if (state.Looping) { curAnimFrame = state.LoopPos; LuaFunction func = luaCode.GetFunction(curState + "_Loop"); if(func != null) func.Call(); } 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 NLua.Exceptions.LuaScriptException: 'attempt to call a nil value'. 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? EDIT: Comment 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. public void CallLuaFunc(string function, params object[] args) { LuaFunction func = luaCode[function] as LuaFunction; if (func != null) func.Call(args); }
tagged with: lua
answer count: 0
has comment: http://stackoverflow.com/comment/138237780
tagged with: game-engine

http://stackoverflow.com/q/78360776
has body: I have tried this , here is my code local NumberValue = workspace.Core.Ball.Value if workspace.Core.Ball.Value >= 100 then script.Parent.Text = "Temp:"..NumberValue.."Stable" end I was expecting it to work, but I am dumb for some coding, I tried to take different little changes, and this is hoe far i have gotten.
has comment: http://stackoverflow.com/comment/138148617
tagged with: roblox
answer count: 1
type: UnansweredQuestion
score: 0
type: Question
has title: I need assistance with a Numbervalue displaying on a part ,with a Textlabel, with it smoothly going up and down
has answer: http://stackoverflow.com/a/78368596
tagged with: lua

http://stackoverflow.com/q/78356582
has title: Implementing arc-length parameterization and adaptive subdivision for Bézier curves
has comment: http://stackoverflow.com/comment/138148657
tagged with: bezier
score: 1
tagged with: geometry
tagged with: computational-geometry
upvote count: 1
has comment: http://stackoverflow.com/comment/138152123
has answer: http://stackoverflow.com/a/78383628
answer count: 1
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/138141586
tagged with: math
downvote count: 0
tagged with: lua
has body: 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: function Bezier:Hodograph(t: number): Curve<Bezier> -- A single step in the Casteljau algorithm. Yields a curve 1 degree lower than itself. local hodograph = Bezier.new() for i = 1, #self.Controls - 1 do hodograph.Controls[i] = self.Controls[i]:Lerp(self.Controls[i+1], t) end return hodograph end function Bezier:Casteljau(t: number, derivative: number?): Curve<Bezier> -- Reduces control points and returns a new curve containing the control points. derivative = derivative or 0 if #self.Controls <= derivative+1 then return self end return self:Hodograph(t):Casteljau(t, derivative) end function Bezier:Split(t: number): (Curve<Bezier>, Curve<Bezier>) -- Cuts the curve at point `t` and returns the slices in a tuple, left before right. local left = Bezier.new() local right = Bezier.new() local hodograph = self for i = 1, #self.Controls do left.Controls[i] = hodograph.Controls[1] right.Controls[(#self.Controls) - (i-1)] = hodograph.Controls[#hodograph.Controls] hodograph = hodograph:Hodograph(t) end return left, right end function Bezier:GetPoint(t: number): Vector3 return self:Casteljau(t).Controls[1] end function Bezier:GetTangent(t: number): Vector3 -- Gets the 1st derivative, or rate of change (tangent) of point t. local controls: {Vector3} = self:Casteljau(t, 1).Controls if #controls < 2 then return Vector3.zero -- Not enough control points to calculate first derivative (tangent). end return ((controls[2] - controls[1]) * (#self.Controls - 1)) end function Bezier:GetAcceleration(t: number): Vector3 -- Gets the 2n…
type: Question

http://stackoverflow.com/q/78404007
upvote count: 2
accepted answer: http://stackoverflow.com/a/78404103
tagged with: roblox
tagged with: roblox-studio
score: 2
tagged with: lua
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78404103
answer count: 1
has title: Roblox Studio Lua: Detecting with Water reduces Health. How to make it stop when out of water
type: Question
has body: I want to make an area in which you lose health, but once out, you don't. So i have created a part, made transparency to 1, and canCollide to false, than put it inside of water. In the code character loses health when enter water, but still lose when out. This is a code i have local parent = script.Parent -- the part local Player = game:GetService('Players') local isInWater = false local setHealth = 0 local function onCollide (hit) local character = hit.Parent local player = Player:GetPlayerFromCharacter(character) local humanoid = character:FindFirstChild('Humanoid') isInWater = true print('in water') if player and humanoid and isInWater then for initalHealth = humanoid.Health, setHealth, -10 do humanoid.Health = initalHealth task.wait(.2) end end end parent.Touched:Connect(onCollide) parent.TouchEnded:Connect(function() isInWater = false print('left water') task.wait(1) end) I made a variable isInWater, which is set to false by default, but once you collide with parent it sets to true, in for loop it's mandatory to work with isInWater being set to true. Then came up with yet another function for TouchEnded event to set isInWater to false once you end touching the part. Now for loop should probably stop. Than i thought that for loop 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

http://stackoverflow.com/comment/138263084
comment on: http://stackoverflow.com/q/78424147
has text: This script is not full, so it can not work at all. Not defined variables and functions: `RecoilControlStrength`, `DelayRate`, `MoveMouseRelative`, `ToggleKey`
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/78349259
has answer: http://stackoverflow.com/a/78350899
tagged with: windows
has comment: http://stackoverflow.com/comment/138128601
tagged with: powershell
has title: ctrl + or <backspace> won't delete a whole word in Neovim
tagged with: lua
type: UnansweredQuestion
has body: problem: ctrl + &lt;del&gt; or ctrl + &lt;backspace&gt; 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. So I tried changing my mappings but ctrl + del doesn't work I use powershell on the windows terminal to use neovim. config in lua, highlighted lines are the changes I made here's my current config GitHub
score: 1
downvote count: 0
favorite count: 0
tagged with: neovim
answer count: 1
type: Question
upvote count: 1

http://stackoverflow.com/q/78433500
has body: 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 local NextButton = script.Parent local ScreenGui = NextButton.Parent local UsernameTextBox = ScreenGui.Frame.UsernameTextBox -- List of NPC names local npcNames = {"ROBLOX", "Bacon", "builderman"} -- Assuming you have a RemoteEvent for sending messages to NPCs local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent") UsernameTextBox.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Return then local username = UsernameTextBox.Text if username == "" then -- If username is empty, randomly select an NPC local randomIndex = math.random(1, #npcNames) local randomNPC = npcNames[randomIndex] print("Randomly selected NPC:", randomNPC) -- Now you can use 'randomNPC' as the recipientUsername or do further processing -- Example: Send a message to the randomly selected NPC local message = ScreenGui.Frame.MessageTextBox.Text .. randomNPC RemoteEvent:FireServer("SendMessageToNPC", message, randomNPC) else print("Enter key pressed") NextButton.MouseButton1Click:Fire() end end end) hierarchy I expected it to take me to the second frame to type the message.
score: 0
type: Question
tagged with: lua
has comment: http://stackoverflow.com/comment/138276191
tagged with: roblox
tagged with: roblox-studio
has title: My Roblox frame isn't going to the next frame?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138277838
has answer: http://stackoverflow.com/a/78507369
answer count: 1

http://stackoverflow.com/q/78415986
score: 0
type: Question
answer count: 0
tagged with: lua
has body: (if anything, this post has been translated through a translator from Russian into English) For my play, I need the object to change smoothly with a delay, of course I decided to use transition.to() and timer.performwithdelay(). Everything worked fine on the first, second and third scenes, but as soon as I decided to finish the "menu", where a short scene was just shown, timer.performwithdelay() stopped working with a delay (which is why it was made). He just went straight to transition.to (), without delay. 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 "framework", removed unnecessary functions and objects. And it stopped working!!! As I found out empirically, timer.performwithdelay() for some reason skipped the delay and immediately proceeded to execute the function IF it was with "parentheses", that is, it worked only in this form: timer.performWithDelay( 1000, function ) I do not know why it works like this somewhere, but somewhere like this, if you can help, then I will be very grateful :) (And by the way, yes, yes, I know about local functions, but they take up more space than I would like)
has title: timer.performwithdelay() works without delay from transition.to ()
type: UnansweredQuestion
tagged with: coronasdk

http://stackoverflow.com/a/78920417
answers question: http://stackoverflow.com/q/78367547
score: 0
has body: When developing your own server, you can simply save the file you're editing, then in the server console, execute the "refresh" command and then "ensure [name of the resource]". This will update the scripts without having to restart the server and the client !
type: Answer

http://stackoverflow.com/comment/138366380
score: 0
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/78394057
type: QuestionComment

http://stackoverflow.com/q/78433994
has body: 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. Can anyone give an idea? local Debris = game:GetService("Debris") local wall = script.Parent script.Parent.Touched:Connect(function(hit) if hit.Name ~= "Rails" then if hit.Name ~= "Baseplate" then if hit.Name ~= "Essential" then local explode = Instance.new("Explosion") explode.Parent = hit explode.Position = hit.Position hit:BreakJoints() Debris:AddItem(hit, 5) end end end end) Thanks
tagged with: lua
tagged with: roblox
possible better answer: http://stackoverflow.com/a/78435133
accepted answer: http://stackoverflow.com/a/78435108
tagged with: roblox-studio
type: AnsweredQuestion
answer count: 2
has title: Check if a part is a part of a character | Roblox
has answer: http://stackoverflow.com/a/78435108
upvote count: 2
type: Question
has answer: http://stackoverflow.com/a/78435133
favorite count: 0
score: 2
downvote count: 0

http://stackoverflow.com/q/78343371
tagged with: quarto
answer count: 1
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/78407665
tagged with: reveal.js
has body: I'd like to build off of the answer in this question. 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. 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. function Header(el) if el.level == 1 then el.attributes["data-background-image"] = "bg.png" el.attributes["data-background-position"] = "left" el.attributes["data-background-opacity"] = "0.25" el.attributes["data-background-size"] = "33%" return el end end I've tried this, based on my super limited lua knowledge, but it doesn't work. function Header(el) if el.level == 1 or el.classes:includes("title-slide") then el.attributes["data-background-image"] = "bg.png" el.attributes["data-background-position"] = "left" el.attributes["data-background-opacity"] = "0.25" el.attributes["data-background-size"] = "33%" return el end end And finally, the minimal example that I'll work with comes from the answer to the linked question.
has title: How to create a lua filter that targets title slides in Quarto revealjs presentations
has answer: http://stackoverflow.com/a/78407665
type: AnsweredQuestion
tagged with: lua
linked to: http://stackoverflow.com/q/74138392

http://stackoverflow.com/comment/138279245
score: 0
has text: What is [ClassName](https://create.roblox.com/docs/en-us/reference/engine/classes/Instance#ClassName) of the children in `animations`?
type: QuestionComment
comment on: http://stackoverflow.com/q/78434058
type: Comment

http://stackoverflow.com/q/78325013
tagged with: ouya
type: Question
tagged with: apk
tagged with: lua
tagged with: coronasdk
tagged with: decompiling
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78330687
has title: trouble decompiling apk
has body: 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 https://archive.org/details/ouya_com.f5games.hotlouya_1.0.1 download the android package archive. 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?
score: 0

http://stackoverflow.com/a/78369605
type: Answer
has comment: http://stackoverflow.com/comment/138275785
score: 0
has comment: http://stackoverflow.com/comment/138276172
answers question: http://stackoverflow.com/q/78360132
has comment: http://stackoverflow.com/comment/138194183
has comment: http://stackoverflow.com/comment/138195083
has body: You can iterate for each key or child in items and then for each one, create a button. In the below code, for each item in items we will create a TextButton. If the user presses the TextButton, then print that the user wants to sell an item. local player = game.Players.LocalPlayer local pack = player.Backpack local itemSell = script.Parent.Item1 local items = pack:GetChildren() -- Function to create a button given a tool local function addItem(item: Tool): () local newButton = Instance.new("TextButton") newButton.Name = item.Name newButton.Text = item.Name newButton.MouseButton1Down:Connect(function() print(player.Name " wants to sell " .. item.Name) -- Username wants to sell item name end) newButton.Parent = workspace -- Change this to the frame you want the buttons parented to end -- Loop through each item and create a button for each for _, item: Tool in pairs(items) do addItem(item) end Make sure to replace the newButton's parent with the Frame that you want the buttons to appear in instead of workspace or they won't appear at all. If you have any questions on the code or explanation on some parts feel free to comment on what does what.
has comment: http://stackoverflow.com/comment/138317062

http://stackoverflow.com/comment/138259088
comment on: http://stackoverflow.com/a/78410008
type: Comment
has text: Now i find this problem when using the following on the .lua script `source_sh("bash", "/apps/spack/share/spack/setup-env.sh")` ==> Error: `spack load` requires Spack's shell support. To set up shell support, run the command below for your shell. For bash/zsh/sh: . /apps/spack/share/spack/setup-env.sh
score: 0
type: AnswerComment

http://stackoverflow.com/a/78435108
has comment: http://stackoverflow.com/comment/138292574
has comment: http://stackoverflow.com/comment/138300913
has body: We can use FindFirstAncestorOfClass and FindFirstChild together for finding whether a part is a child of the Player.Character. If hit has a Model ancestor and that ancestor has a Humanoid, we can assume that Model is the Player.Character. In the below script, I made it so that whenever script.Parent is touched we check for a Model ancestor and then if that Model has a Humanoid. If so we add an explosion to it. local Debris = game:GetService("Debris") local wall = script.Parent script.Parent.Touched:Connect(function(hit) local characterModel = hit:FindFirstAncestorOfClass("Model") if characterModel then local humanoid = characterModel:FindFirstChild("Humanoid") if humanoid then local explode = Instance.new("Explosion") explode.Parent = hit explode.Position = hit.Position hit:BreakJoints() Debris:AddItem(hit, 5) end end end) Note that you may need to modify the code for explode. It is unclear in your question what to do if we hit the Player so I left it as is. You can use hit for the Player's Part we hit, humanoid for the Player's Humanoid and characterModel for the the Player's Character.
has comment: http://stackoverflow.com/comment/138300557
accepted answer of: http://stackoverflow.com/q/78433994
answers question: http://stackoverflow.com/q/78433994
downvote count: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/138280376
score: 0
has comment: http://stackoverflow.com/comment/138285166
type: AcceptedAnswer
type: Answer

text
tag name: text
tags question: http://stackoverflow.com/q/78432834
type: Tag

http://stackoverflow.com/comment/138177479
type: QuestionComment
comment on: http://stackoverflow.com/q/78373365
type: Comment
score: 0
has text: @Ôrel I don't know how, that's the issue :') Maybe I wasn't clear enough in my question

http://stackoverflow.com/comment/138284585
comment on: http://stackoverflow.com/q/78438152
score: 6
type: QuestionComment
has text: 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
type: Comment

http://stackoverflow.com/comment/138200530
type: Comment
comment on: http://stackoverflow.com/a/78330687
score: 0
has text: 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?
type: AnswerComment

http://stackoverflow.com/q/78330950
has answer: http://stackoverflow.com/a/78368130
score: 0
type: Question
has body: I am trying to write a script that executes a mouse movement when the character "f" on the keyboard is pressed but for some reason it doesn't work. Any suggestions? function test(event,arg) if isKeyPressed("f") then repeat MoveMouseRelative(0,20) until not isKeyPressed("f") end end
tagged with: lua
answer count: 1
type: UnansweredQuestion
has title: isKeyPressed() function is not working for me

http://stackoverflow.com/comment/138300913
comment on: http://stackoverflow.com/a/78435108
type: AnswerComment
has text: .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
type: Comment
score: 0

wpf
type: Tag
tag name: wpf
tags question: http://stackoverflow.com/q/78432834

http://stackoverflow.com/comment/138215340
type: Comment
score: 0
type: QuestionComment
has text: The first `tool.Equipped:Connect(IncrementSips)` is unnecessary, because that tool will never be equipped by anyone. Only clones of that tool will.
comment on: http://stackoverflow.com/q/78396506

http://stackoverflow.com/q/78370029
tagged with: ftplugin
type: UnansweredQuestion
score: 1
tagged with: lunarvim
tagged with: lua
has body: In LunarVIM config, what I would like is to create a new ftplugin named log with it's associated syntax. I'd like to have the filetype and syntax within a custom folder (~/.lvim) under source control that it loaded by the default config.lua. Actually I have: ~/.config/lvim/config.lua local custom_path = vim.env.HOME .. "/.lvim/?.lua" package.path = package.path .. ";" .. custom_path require(custom-config) ~/.lvim/custom-config.lua require(xxxx) -- same folder xxxx.lua require(yyyy) -- same folder yyyy.lua This is an example of the log file content (it's logs so nothing really fancy): [I] [TAG] This is an info level log [T] [TAG_2] This is a trace level log [E] [TAG] I think you figured this one out! I have tried to create just a basic syntax file named log.vim like this to easily see that it has been loaded: if exists("b:current_syntax") finish endif echom "Log syntax file loaded" syn match line '^.*$' highlight line ctermfg=red let b:current_syntax = "log" Right now it does not automatically detect all log files (code will be added towards that with also specific ftplugin) but I manually set filetype=log` when I open such file. If I am here, it is that, of course, my log.vim is never loaded (messages never shows my echom). I have tried to source ~/.lvim/log.vim, it does output the echom but the syntax does not work. I have tried to put this file in multiple folders found during my research on how to add syntax without any success (~/.config/nvim/after/syntax/log.vim, ~/.lvim ). These are my questions: How can I add syntax/ftplugin files in a custom folder and tell LunarVim to automatically load them ? Is my syntax file (this is just for "debugging") valid ?
answer count: 0
has title: LunarVIM/Neovim create new filtetype and syntax
tagged with: neovim
type: Question
upvote count: 1
tagged with: syntax-highlighting
favorite count: 0
downvote count: 0

http://stackoverflow.com/comment/138192737
type: Comment
score: 0
type: QuestionComment
has text: 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)
comment on: http://stackoverflow.com/q/78386134

http://stackoverflow.com/q/78349390
has body: 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?
tagged with: network-programming
favorite count: 0
has title: Get network connection status in neovim
downvote count: 0
score: 1
tagged with: lua
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/78354275
accepted answer: http://stackoverflow.com/a/78354275
tagged with: neovim
type: Question
upvote count: 1

http://stackoverflow.com/a/78440312
score: 4
has body: You can parse the int value from the string using string.match and then use tonumber function on it. This would be more efficient then looping every possible answer. local match = string.match(subject.Name, "%d") inVal.Value = tonumber(match)
answers question: http://stackoverflow.com/q/78439743
upvote count: 4
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/138292861
accepted answer of: http://stackoverflow.com/q/78439743

encode
tags question: http://stackoverflow.com/q/78317635
tag name: encode
type: Tag

http://stackoverflow.com/q/78432428
has title: Wireshark Lua: Sending http POST requests using Lua in Wireshark
has body: I am trying but failing to send http POST requests using Lua in Wireshark. My approach is to use the socket.http and ltn12 Lua modules, however, I do not know how to have Wireshark load these modules into its Lua base correctly. I am simply just adding the following lines to a Lua file which Wireshark reads on program boot up: local http = require("socket.http") local ltn12 = require("ltn12") The error I receive is: module 'socket.http' not found:\n\tno field package.preload['socket.http']\n\tno file Obviously, I am missing some source socket.http (and ltn12) module files but do not know how to include them or what files they should be. Thank you for any help.
score: 1
upvote count: 1
type: UnansweredQuestion
favorite count: 0
tagged with: wireshark
downvote count: 0
tagged with: http
answer count: 0
tagged with: lua
tagged with: http-post
type: Question

http://stackoverflow.com/q/78318964
type: Question
has title: AstroNVim disable neo-tree sitter and replace it with nvim-tree or other
tagged with: lua
downvote count: 1
tagged with: ide
upvote count: 1
type: UnansweredQuestion
favorite count: 0
has body: I've been trying out astroNVim works great but due to enterprise limitations i couldnt get neo-treesitter work for some reason and every time i save a file tree sitter crashes throwing a bunch of alert prompts. 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. Please help me mitigate this issue.
tagged with: neovim
answer count: 0
score: 0

http://stackoverflow.com/q/78386134
type: Question
tagged with: roblox
tagged with: roblox-studio
has title: Roblox Studio Anti-Noclip Script
tagged with: anti-cheat
has comment: http://stackoverflow.com/comment/138192621
has answer: http://stackoverflow.com/a/78393025
answer count: 1
has body: 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? This is the code I currently have: local function CheckNoclip(previous_pos: CFrame, current_pos: CFrame, player: string) local raycastResult = workspace:Raycast(current_pos, previous_pos) local char = workspace:FindFirstChild(player) if raycastResult then print("Instance:", raycastResult.Instance) print("Position:", raycastResult.Position) print("Distance:", raycastResult.Distance) print("Material:", raycastResult.Material) print("Normal:", raycastResult.Normal) end if raycastResult then if raycastResult.Instance.CanCollide == true and (not (raycastResult.Instance:IsDescendantOf(char)) ) then local Physical_Part = workspace:FindFirstChild(player) local RootPart = Physical_Part:WaitForChild("HumanoidRootPart") RootPart.CFrame = CFrame.new(previous_pos) warn("No-Clip Found") end print("---------------------------------") end end local players = game.Players players.PlayerAdded:Connect(function(plr: Player) local player_name = plr.Name plr.CharacterAdded:Wait() local RootPart = workspace:FindFirstChild(player_name).HumanoidRootPart local prev_position = RootPart.CFrame.Position local current_position = prev_position while true do current_position = RootPart.CFrame.Position if prev_position ~= current_position then CheckNoclip(prev_position, current_position, player_name) prev_position = current_position end wait() end end) This keeps happening: https://youtu.be/5hF6SoNxX08 (I uploaded it as an unlisted youtube video)
score: 0
has comment: http://stackoverflow.com/comment/138192737
accepted answer: http://stackoverflow.com/a/78393025
type: AnsweredQuestion
tagged with: lua

http://stackoverflow.com/q/78330939
has answer: http://stackoverflow.com/a/78496044
type: Question
has title: Where does Neovim's Lua List type come from?
tagged with: lua
has body: Edit This question was very misguided - the feature I'm referring to is from vimscript, not Lua. Original question In Neovim's Lua, in addition to normal table objects, you can create List objects like so: x = [1, 2, 3] The documentation 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: &gt; x = [1, 2, 3] stdin:1: unexpected symbol near '[' NB, Neovim ships with Lua 5.1, with LuaJIT additionally available on common platforms. Neovim also loads many utility functions by default in addition to the Lua standard library. This seems straightforward enough to me. 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?
accepted answer: http://stackoverflow.com/a/78496044
upvote count: 3
tagged with: neovim
downvote count: 0
answer count: 1
tagged with: luajit
favorite count: 0
score: 3
type: AnsweredQuestion

http://stackoverflow.com/q/78414522
has answer: http://stackoverflow.com/a/79530562
score: 2
has comment: http://stackoverflow.com/comment/138242291
has comment: http://stackoverflow.com/comment/138243287
has answer: http://stackoverflow.com/a/79102801
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138243326
has title: How to install lua-language-server on linux (Ubuntu)?
has comment: http://stackoverflow.com/comment/138242401
downvote count: 1
accepted answer: http://stackoverflow.com/a/78415023
favorite count: 0
answer count: 3
tagged with: linux
type: Question
has body: I'm trying to configure LSP in Neovim using lsp-config. I need to install lua-language-server to make the Lua LSP work, but I don't know how to install lua-language-server on Linux. The official documentation only shows how to install it for macOS and Windows. Could you help me install it? Ultimately, lua-language-server should be available in the terminal so that lsp-config can use it.
possible better answer: http://stackoverflow.com/a/79102801
has comment: http://stackoverflow.com/comment/138243296
has answer: http://stackoverflow.com/a/78415023
tagged with: lua
upvote count: 3

http://stackoverflow.com/comment/138162967
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78369116
score: 1
has text: 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?

http://stackoverflow.com/comment/138260886
comment on: http://stackoverflow.com/a/78424253
type: AnswerComment
has text: thank you, how would i fix this if you dont mind helping?{ im still new to coding
score: 0
type: Comment

http://stackoverflow.com/comment/138163177
has text: (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
comment on: http://stackoverflow.com/q/78369116
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/78629873
score: 0
type: Answer
has body: If you also put a comma in the last line, the formatting will be implemented accordingly: const Container = struct { childs: std.ArrayList(), content: []u8, }; This also applies, for example, to parameters in functions, etc.: fn foo( p1: u8, p2: u8, p3: u8, ) void {
answers question: http://stackoverflow.com/q/78433138

http://stackoverflow.com/a/78411385
score: 1
has body: Let's follow the path of func inside this coroutine : coroutine.create(function() func(player, duration, tickSpeed) end) You pass it into the parent function as self.PrintSomething but it is defined on the module as &lt;moduleName&gt;:PrintSomething. Notice the difference between the period and the colon? When you define a function using a colon, this is syntactic sugar for a function signature that passes in the self object as a hidden first argument. What this means is this : function module:PrintSomething(a, b, c) end -- is the same as... function module.PrintSomething(self, a, b, c) end So, because you defined your PrintSomething function with a colon, there is an expectation you will call the function with a colon, or manually pass in the self object. Since you didn't, it is treating the first argument you did pass in as the self which is why all of your inputs are offset by one. In this case, you're lucky, since your PrintSomething function doesn't access self 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 : function SCP867Service.PrintSomething(player, duration, tickSpeed)
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78411358
answers question: http://stackoverflow.com/q/78411358
upvote count: 1
downvote count: 0

regex
tags question: http://stackoverflow.com/q/78319200
type: Tag
tag name: regex
tags question: http://stackoverflow.com/q/78693009
tags question: http://stackoverflow.com/q/79419434

http://stackoverflow.com/a/78330687
answers question: http://stackoverflow.com/q/78325013
score: 0
has comment: http://stackoverflow.com/comment/138200543
type: Answer
has comment: http://stackoverflow.com/comment/138200530
has comment: http://stackoverflow.com/comment/138120450
has comment: http://stackoverflow.com/comment/138204101
has comment: http://stackoverflow.com/comment/138161249
has comment: http://stackoverflow.com/comment/138168059
has body: The APK file can be extracted as a zip. Using the Corona-archiver you can extract the content of the resource.car file. Using unluac you can decompile the *.lu files. However, at this point you will notice that all the names of local variables are gone and thus unrecoverably hard to read.
has comment: http://stackoverflow.com/comment/138160950
has comment: http://stackoverflow.com/comment/138119135

http://stackoverflow.com/comment/138162990
type: QuestionComment
comment on: http://stackoverflow.com/q/78369116
score: 1
type: Comment
has text: @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.

http://stackoverflow.com/q/78319200
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138078321
tagged with: regex
tagged with: lua-patterns
answer count: 0
has title: Simple yet incredibly frustrating lua pattern
type: Question
upvote count: 1
tagged with: neovim
favorite count: 0
has comment: http://stackoverflow.com/comment/138078048
downvote count: 0
has body: 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. &quot;([%a%d}])_&quot; -- _ should be the trigger character for a subscript in this case.
score: 1

events
type: Tag
tag name: events
tags question: http://stackoverflow.com/q/78369116

http://stackoverflow.com/q/78337673
has answer: http://stackoverflow.com/a/78344510
tagged with: raycasting
answer count: 1
score: 0
type: Question
tagged with: roblox
tagged with: lua
has title: How can I detect if the raycast hits the player in roblox studio?
accepted answer: http://stackoverflow.com/a/78344510
tagged with: roblox-studio
has body: local PathfindingService = game:GetService("PathfindingService") local Humanoid = script.Parent.Humanoid local Root = script.Parent.HumanoidRootPart local goal = script.Parent.Goal -- Change the name of the goal to your Part that you want it to reach. local prompt = game.Workspace.KickDoor.Door.KickPromptAttachment.ProximityPrompt prompt.Triggered:Connect(function(plr) local playerhumanoid = plr.Character:WaitForChild("Head") local path = PathfindingService:CreatePath() path:ComputeAsync(Root.Position, goal.Position) local waypoints = path:GetWaypoints() for i, waypoint in ipairs(waypoints) do Humanoid:MoveTo(waypoint.Position) if waypoint.Action == Enum.PathWaypointAction.Jump then Humanoid.Jump = true end local RunService = game:GetService("RunService") Humanoid.MoveToFinished:Connect(function() RunService.Heartbeat:Connect(function() Root.CFrame = CFrame.lookAt( Root.Position, playerhumanoid.Position * Vector3.new(1,0,1) + Root.Position * Vector3.new(0,1,0)) while true do local a = script.Parent.Head local b = playerhumanoid local direction = b.position - a.Position local raycastResult = workspace:Raycast(a.Position,direction) if raycastResult and raycastResult.Instance then raycastResult.Instance.Color = Color3.new(1,0,0) end task.wait(1) end end) end) end end) Humanoid.Died:Connect(function() local ragdoll = game.ReplicatedStorage.Ragdoll local clonedModel = ragdoll:Clone() clonedModel.Parent = workspace clonedModel:MoveTo(Humanoid.Parent.HumanoidRootPart.Position-Vector3.new(0,-5.5,0)) wait(.1) Humanoid.Parent:Destroy() end) 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.
type: AnsweredQuestion

http://stackoverflow.com/comment/138194183
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78369605
has text: 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.

http://stackoverflow.com/a/78365706
type: Answer
has body: You don't need Lua to achieve this, location directives are enough: location = / { alias ./startpage/; try_files index.html =404; } location / { root ./html/; } URL → filesystem path: / → /startpage/index.html /foo/ → /html/foo/index.html /foo/img.jpg → /html/foo/img.jpg /bar/text.txt → /html/bar/text.txt
answers question: http://stackoverflow.com/q/78363120
score: 0

http://stackoverflow.com/a/78378904
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/138179639
has body: You named both a property and a function position. 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 function Transform:position(x, y, z) to function Transform:setPosition(x, y, z) and change transform:position(10, 20, 30) to transform:setPosition(10, 20, 30)
accepted answer of: http://stackoverflow.com/q/78378851
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/78378851
score: 3

http://stackoverflow.com/a/79033092
upvote count: 1
answers question: http://stackoverflow.com/q/78308549
type: Answer
downvote count: 0
has body: In your case to run correctly it should be like: java -classpath target/classes com.khush.distributed.cache.Main But it's wrong to run like java com.khush.distributed.cache.Main 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 java Main 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) java -classpath src/main/java/ com.khush.distributed.cache.Main In case CRAG666/code_runner.nvim can be java = { "java -classpath src/main/java/", "$(grep '^package' $dir/$fileName | awk '{print $2}' | sed 's/;//').$fileNameWithoutExt" }, But I highly recomment to use Maven or Gradle for similar purposes! See below MAVEN 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 java -cp class_name, 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. I will show basic idea on maven, but the same can be used easily for gradle or another managers of course In case maven, I'm using next command in my CRAG666/code_runner.nvim config (but with caching classpath script, see below) return { "CRAG666/code_runner.nvim", config = function() require('code_runner').setup({ filetype = { java = { "java -classpath $(mvn -o -q dependency:build-classpath -Dmdep.outputFile=/dev/stdout -DincludeScope=runtime):target/classes", "$(grep '^package' $dir/$fileName | awk '{print $2}' | sed 's/;//').$fileNameWithoutExt" }, }, }) vim.keymap.s…
score: 1

http://stackoverflow.com/comment/138300557
has text: @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.
type: AnswerComment
comment on: http://stackoverflow.com/a/78435108
score: 0
type: Comment

http://stackoverflow.com/q/78415893
accepted answer: http://stackoverflow.com/a/78416006
downvote count: 0
score: 1
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/60309665
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78416006
tagged with: neovim
type: Question
upvote count: 1
has body: I'm trying to change the background of the neovim using lua. -- init.lua vim.o.termguicolors = true vim.api.nvim_set_hl(0, "Normal", { bg="#04110d" }) The expected result should be like this (modified directly via Terminal settings) But it renders like this I use the default Ubuntu Terminal with default configuration. I tried to use a "simplier" color and it works Instead of this vim.api.nvim_set_hl(0, "Normal", { bg="#04110d" }) I used this vim.api.nvim_set_hl(0, "Normal", { bg="#ff0000" }) (sorry for the red image) Does anyone know the root cause of the problem and how I can fix that? I'd expect the specified color #04110d to work as expected (displaying the dark green background). Thanks
tagged with: lua
has title: Why neovim can't render a background color?

http-post
tag name: http-post
tags question: http://stackoverflow.com/q/78432428
type: Tag

http://stackoverflow.com/q/78374652
has body: trying to write a lua script where an npc walks to the player, code that i have struggled in troubleshooting is basically as follows: enemy = script.parent torso = player:FindFirstChild("UpperTorso") position = torso.Position enemy.humanoid:MoveTo(position) my code for getting the player works so thats not something im worried about 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.
has title: I dont understand why i Humanoid:MoveTo isnt working like i want it to
tagged with: logic-error
favorite count: 0
downvote count: 1
answer count: 1
upvote count: 0
accepted answer: http://stackoverflow.com/a/78377386
tagged with: roblox
type: Question
score: -1
tagged with: lua
has answer: http://stackoverflow.com/a/78377386
type: AnsweredQuestion

http://stackoverflow.com/q/78334699
score: 1
type: AnsweredQuestion
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/78335032
type: Question
downvote count: 0
upvote count: 1
tagged with: luau
accepted answer: http://stackoverflow.com/a/78335032
tagged with: lua
has body: The title says it all. I want to do an operation to apply key values to a dictionary from a dictionary Here, I'll explain what I meant. I have these long dictionaries initialized in my code. local globalDefault = { ["LastPlayed"] = "", ["Grades"] = { ["Grade"] = 1, ["Level"] = 1 }, ["Challenge"] = { ["History"] = {} }, ["Settings"] = { ["ScrollFrameHitbox"] = false } } local globalData = { ["Settings"] = { ["ScrollFrameHitbox"] = true } } I want to apply all globalData's key values to globalDefault. This is what globalDefault dictionary should look like after applying them: { ["LastPlayed"] = "", ["Grades"] = { ["Grade"] = 1, ["Level"] = 1 }, ["Challenge"] = { ["History"] = {} }, ["Settings"] = { ["ScrollFrameHitbox"] = true } } How can I do such a simple operation?
has title: Apply key values to a dictionary from a dictionary

http://stackoverflow.com/comment/138285259
has text: `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.
type: Comment
comment on: http://stackoverflow.com/a/78435133
score: 0
type: AnswerComment

spack
tag name: spack
tags question: http://stackoverflow.com/q/78407863
type: Tag

http://stackoverflow.com/comment/138150471
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78360664

syntax-highlighting
tag name: syntax-highlighting
tags question: http://stackoverflow.com/q/78370029
type: Tag
tags question: http://stackoverflow.com/q/79293179

http://stackoverflow.com/comment/138226016
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78397758
has text: "resulting in some slight deviations in the final result" What do you mean by this? What deviations? Is the intended print "nil" or "false"?

http://stackoverflow.com/comment/138292574
comment on: http://stackoverflow.com/a/78435108
score: 0
type: AnswerComment
has text: this would also count accessories/tool as a hitbox wich would give some players a disadvantage to others. @Ryan
type: Comment

http://stackoverflow.com/a/78404295
downvote count: 0
answers question: http://stackoverflow.com/q/78400232
score: 1
type: Answer
upvote count: 1
has body: The issue was with my understanding of the for loop. in this block, the v needed to be i since I wanted to check against the index not the value. OLD: for i,v in ipairs(check) do if (v ~= my-2) then check[i] = 0 end end NEW: for i,v in ipairs(check) do if (i ~= my-2) then check[i] = 0 end end

http://stackoverflow.com/a/78383628
score: 0
has body: I think your determination to find a solution that's "scientific" 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. 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.
type: Answer
answers question: http://stackoverflow.com/q/78356582

http://stackoverflow.com/a/78318537
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/78317635
has body: 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 id, for example. local gamesArray = { { ["id"] = "777_Thimble", ["game_name"] = "777 Thimble", ["game_thumbnail"] = "img/777thimble_logo.svg", ["1x_multiplier"] = 2.88, ["2x_multiplier"] = 1.44, ["first_bet"] = 50, ["second_bet"] = 100, ["third_bet"] = 250, ["four_bet"] = 1000, ["five_bet"] = 5000, ["min_attributable_bet_value"] = 5, ["max_attributable_bet_value"] = 10000, }, { ["id"] = ,"777e_Thimble" ["game_name"] = "777 Thimble", ["game_thumbnail"] = "img/game_bg.svg", ["1x_multiplier"] = 2.88, ["2x_multiplier"] = 1.44, ["first_bet"] = 50, ["second_bet"] = 100, ["third_bet"] = 250, ["four_bet"] = 1000, ["five_bet"] = 5000, ["min_attributable_bet_value"] = 5, ["max_attributable_bet_value"] = 10000, }, -- more entries ... }
type: Answer

http://stackoverflow.com/a/78410008
has comment: http://stackoverflow.com/comment/138259088
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78407863
has body: Lmod supports sourcing of shell scripts via the source_sh function: https://lmod.readthedocs.io/en/latest/260_sh_to_modulefile.html#using-source-sh

http://stackoverflow.com/comment/138224462
type: AnswerComment
has text: It did help me, thank you. Never assumed i could actually break the loop this way.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/78404103

http://stackoverflow.com/comment/138146310
type: Comment
comment on: http://stackoverflow.com/q/78359732
score: 0
type: QuestionComment
has text: The editing for the code is a bit wonky for some reason. Probably because of the multitude of 'end's

http://stackoverflow.com/q/78408798
tagged with: lua
tagged with: visual-studio-code
has body: I'm working on a piece of software that uses Solar2D game engine. For Visual Studio Code exists an extension for Solar2D called "Solar2D Editor" but it doesn't provide the possibility to navigate through the Solar2D API. 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 Lua.workspace.library setting in VSCode but with no success so far.
upvote count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: solar2d
downvote count: 0
answer count: 0
has title: Integrating VSCode with Solar2d libraries via Lua Language Server extension
type: Question

http://stackoverflow.com/comment/138226816
has text: 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.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78405312

midi
tags question: http://stackoverflow.com/q/78402894
tag name: midi
type: Tag

http://stackoverflow.com/comment/138160950
comment on: http://stackoverflow.com/a/78330687
type: Comment
has text: `the files are obfuscated` - they look like usual Lua 5.1 bytecode files, without obfuscation
score: 0
type: AnswerComment

robotics
tag name: robotics
tags question: http://stackoverflow.com/q/78359732
type: Tag

http://stackoverflow.com/comment/138161249
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78330687
has text: @ESkri You are right, I used the wrong name here. Tho, shouldn't local names be included in compiled files?
type: Comment

luadec
type: Tag
tags question: http://stackoverflow.com/q/78444284
tag name: luadec

http://stackoverflow.com/q/78433138
has answer: http://stackoverflow.com/a/79464484
tagged with: liskov-substitution-principle
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138275811
answer count: 2
has comment: http://stackoverflow.com/comment/138275747
tagged with: lua
has body: 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). In config_gen/config.json: { "name": "enable_autofix", "description": "Whether to automatically fix errors on save. Currently supports adding and removing discards.", "type": "bool", "default": false }, And it still compresses my struct into a single line: //before const Container = struct { childs: std.ArrayList(), content: []u8 }; //after saving const Container = struct { childs: std.ArrayList(), content: []u8 }; I tried to configure it in init.lua (I installed kickstart and did almost no changes): zls = { cmd = { 'C:/zig/lsp/1.12.0/zig-out/bin/zls.exe' }, settings = { Lua = { format_on_save = false, }, }, }, And copypasted in Autoformat section right after lua's formater It is better if I fix it not only for nvim, but in ZLS config or whatever
score: 0
type: Question
tagged with: zig
has title: Remove auto format and autofix from ZLS COMPLETELY (with nvim kickstart)
has answer: http://stackoverflow.com/a/78629873

http://stackoverflow.com/comment/138197212
type: QuestionComment
has text: It has: https://www.lua.org/manual/5.3/manual.html#6.5
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78386191

http://stackoverflow.com/comment/138163170
score: 1
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/78369116
type: QuestionComment

http://stackoverflow.com/comment/138234654
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78407718
has text: You cannot edit the player UI from the server, you must do it client sided
type: Comment

http://stackoverflow.com/a/78416006
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/78415893
has body: I found the root cause of the problem. The issue was with tmux. 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. -- ~/.tmux.conf set-option -ga terminal-overrides ",xterm-256color:Tc" Also see - Neovim colorscheme does not look right when using nvim inside tmux
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78415893
type: Answer
downvote count: 0

http://stackoverflow.com/comment/138203573
has text: 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.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78391747
type: AnswerComment

http://stackoverflow.com/q/78414828
has answer: http://stackoverflow.com/a/78415826
score: 0
has title: Property cannot be assigned to
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/78415826
tagged with: roblox
tagged with: lua
has body: local Core = Instance.new("Part",workspace) local OuterCore = Instance.new("Part",workspace) Core.CanCollide = false OuterCore.CanCollide = false Core.Position = Missile.Position OuterCore = Core.Position Core.BrickColor = BrickColor.new("New Yeller") OuterCore.BrickColor = BrickColor.new("Neon orange") Core.Transparency = 0.3 OuterCore.Transparency = 0.3 Literally no property can be assigned to the part except for parent. The error is "(property) cannot be assigned to".This is inside a module script if that helps. Please help
type: AnsweredQuestion

windows-terminal
type: Tag
tag name: windows-terminal
tags question: http://stackoverflow.com/q/78337661

http://stackoverflow.com/a/78396898
has body: have you tried using remote events? make a remote event in replicated storage then make a local script in the tool local remote = game.ReplicatedStorage.yourRemoteEvent local plr = game.Players.LocalPlayer local tool = game.StarterPack:WaitForChild("OrangeJuiceTool") tool.Equipped:Connect(function(plr) remote:FireServer(plr) -- firing remote end) and then make a script in server script service local remote = game.ReplicatedStorage.yourRemoteEvent remote.OnServerEvent:Connect(function(plr) plr.leaderstats.Sips.Value += 1 end)
has comment: http://stackoverflow.com/comment/138212578
answers question: http://stackoverflow.com/q/78396506
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/138212366

http://stackoverflow.com/q/78431135
has answer: http://stackoverflow.com/a/78431181
type: Question
has body: 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. My cultivation toggle script (local script under the text button): local button = script.Parent local cultivating = game.Players.LocalPlayer.leaderstats.Cultivating button.MouseButton1Click:Connect(function() if cultivating.Value == false then cultivating.Value = true button.Text = "Stop Cultivating" else cultivating.Value = false button.Text = "Start Cultivating" end end) My leaderstats script (server script under serverscriptservice): game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local qi = Instance.new("IntValue") qi.Name = "Qi" qi.Value = 0 qi.Parent = leaderstats local cultivating = Instance.new("BoolValue") cultivating.Name = "Cultivating" cultivating.Value = true cultivating.Parent = leaderstats end) My cultivation script (server script under serverscriptservice): game.Players.PlayerAdded:Connect(function(player) local leaderstats = player:WaitForChild("leaderstats") local qi = leaderstats:WaitForChild("Qi") local cultivating = leaderstats:WaitForChild("Cultivating") while true do if cultivating.Value == true then qi.Value += 1 end wait(0.5) end end) Basically the variable "cultivating" is getting updated by the local script which works but doesn't get updated inside the cultivation script. I was expecting this to give me 1 qi every 0.5 seconds if I'm cultivating. 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.
tagged with: roblox
tagged with: lua
answer count: 1
score: 0
has title: Value not updating in script although it is getting update outside of it
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/78431181

client-side
tags question: http://stackoverflow.com/q/78322705
tag name: client-side
type: Tag

http://stackoverflow.com/comment/138200543
type: Comment
has text: Also is the resource.car file where the source code is or where is it?
comment on: http://stackoverflow.com/a/78330687
score: 0
type: AnswerComment

http://stackoverflow.com/a/78391747
type: AcceptedAnswer
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/138206926
accepted answer of: http://stackoverflow.com/q/78391628
has comment: http://stackoverflow.com/comment/138203864
downvote count: 0
score: 1
has body: If using Lazygit plugin: You would put this in your nvim/lua/plugins/lazy.lua file since your package manager is Lazy. # nvim/lua/plugins/lazy.lua require("lazy").setup({ -- Rest of your requirements... { "kdheepak/lazygit.nvim", cmd = { "LazyGit", "LazyGitConfig", "LazyGitCurrentFile", "LazyGitFilter", "LazyGitFilterCurrentFile", }, -- optional for floating window border decoration dependencies = { "nvim-lua/plenary.nvim", }, -- setting the keybinding for LazyGit with 'keys' is recommended in -- order to load the plugin when the command is run for the first time keys = { { "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" } } }, -- Rest of your requirements... }) Run :Lazy install at the end. If using Lazygit installed separately on the system: Running :terminal lazygit will open up Lazygit for you. vim.keymap.set('n', '<space>gg', ':terminal lazygit<CR>') Or in my personal config I run it on Togglterm in a floating/split terminal. local Terminal = require("toggleterm.terminal").Terminal -- Lazygit local lazygit = Terminal:new({ cmd = "lazygit", hidden = true, direction = "float", close_on_exit = true, }) function _LAZYGIT_TOGGLE() lazygit:toggle() end keymap("n", "<leader>tg", "<cmd>lua _LAZYGIT_TOGGLE()<CR>", opts)
answers question: http://stackoverflow.com/q/78391628
has comment: http://stackoverflow.com/comment/138203573
has comment: http://stackoverflow.com/comment/138207272

http://stackoverflow.com/a/78507369
has body: Your issue is coming from this line: NextButton.MouseButton1Click:Fire() The MouseButton1Click event doesn't have a :Fire() method. You will have to bind another event to the function that switches the page (the function binded to MouseButton1Click). To do this just make a Bindable Event and connect BindableEvent.Event to the function that switches the page.
score: 0
answers question: http://stackoverflow.com/q/78433500
type: Answer

http://stackoverflow.com/comment/138292861
score: 1
type: Comment
comment on: http://stackoverflow.com/a/78440312
type: AnswerComment
has text: I've no idea how this works... But it works so well. I'm going to look into this, thanks! Edit: 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!

http://stackoverflow.com/comment/138084686
has text: Thank you so much, this worked. I just put the script in StarterGui
type: Comment
comment on: http://stackoverflow.com/a/78323044
type: AnswerComment
score: 0

http://stackoverflow.com/a/78421665
upvote count: 2
accepted answer of: http://stackoverflow.com/q/78420466
has body: As read in the documentation the second paameter in the SubtractAsync/UnionAsync is the collision fidelity collisionfidelity: Enum.CollisionFidelity The Enum.CollisionFidelity value for the resulting UnionOperation. Default Value: "Default" So use local fi = i:SubtractAsync({b.RemoveFromTerrain}, Enum.CollisionFidelity.PreciseConvexDecomposition) -- Cuts
downvote count: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78420466
score: 2

autoplay-media-studio
tags question: http://stackoverflow.com/q/78324370
tag name: autoplay-media-studio
type: Tag

double-free
tags question: http://stackoverflow.com/q/78430344
type: Tag
tag name: double-free

http://stackoverflow.com/comment/138243296
score: 1
type: Comment
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/78414522

http://stackoverflow.com/a/78404103
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78404007
answers question: http://stackoverflow.com/q/78404007
has body: Your onCollide 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: isInWater = true -- this runs every time onCollide runs What this is doing is that isInWater is being set to true every single time onCollide runs, when you should really check for the player before running your for-loop. Then, inside of your for-loop, to check if the player is still in the water, you should insert: if not isInWater then -- breaks the for loop when not in water break end before you decrement health. Hope I helped!
type: AcceptedAnswer
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/138224462

http://stackoverflow.com/comment/138109068
has text: 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.
score: 1
comment on: http://stackoverflow.com/q/78337661
type: QuestionComment
type: Comment

http://stackoverflow.com/a/78415826
score: 2
accepted answer of: http://stackoverflow.com/q/78414828
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: the problem is in this line: OuterCore = Core.Position this line will set the variable OuterCore to a Vector3 value and BrickColor is not a valid member of Vector3 resulting into this error: BrickColor cannot be assigned to. the way to fix this error is to change that line to the following: OuterCore.Position = Core.Position
answers question: http://stackoverflow.com/q/78414828
downvote count: 0

http://stackoverflow.com/q/78390389
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/78391151
has body: 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. 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. Here's how I implemented the wall collisions function tetros.wallLeftCollision(x) for i, c in pairs(tetros.shapes[v.shape].angles[v.angle].cubes) do local cx= c.x+x if cx-1 <= v.window.x then return true else return false end end end x: is the piece's x position "tetros.shapes[v.shape].angles[v.angle].cubes": is the table that contains the relative positions of the tiles that forms the piece "cx= c.x+x": here I convert the relative position to a normal position "cx-1" I just shift the position slightly to the left "v.window.x" this is the x position of the space where the pices fall (idk how to call it) But when I run the code it apparently choses a random tile and compare it instead of comparing all the tiles. 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. 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. Note:Please consider the fact that I have no programming experience beside Minecraft commands and I am just getting started
tagged with: for-loop
answer count: 1
has comment: http://stackoverflow.com/comment/138200376
type: Question
downvote count: 0
upvote count: 1
tagged with: lua
tagged with: lua-table
score: 1
has title: Comparing multiple values in a table makes it that it choses to compare only one randomly
has answer: http://stackoverflow.com/a/78391151
tagged with: love2d

luabind
tag name: luabind
tags question: http://stackoverflow.com/q/78400404
type: Tag

http://stackoverflow.com/comment/138243287
type: QuestionComment
type: Comment
score: 0
has text: you can show what went wrong with building from scratch, if the target os is linux like, suppose it's fixable
comment on: http://stackoverflow.com/q/78414522

apk
tags question: http://stackoverflow.com/q/78325013
type: Tag
tag name: apk

http://stackoverflow.com/comment/138162082
score: 2
type: Comment
has text: [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551)
comment on: http://stackoverflow.com/q/78362205
type: QuestionComment

http://stackoverflow.com/comment/138366388
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78394057
has text: 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.
type: Comment

http://stackoverflow.com/a/78330276
has body: i think for some reason the isdst (daylight savings) value got switched and if gave a 1 hour offset. edit: i did a bit more research and i figured that the os.time gets the UTC time as a date table 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 isdst to nil because UTC time doesnt have daylight savings time. print(os.date("!%a %b %d %H:%M:%S %Y")) local dt = os.date("!*t",os.time()) dt.isdst = nil print(os.date("%c", os.time(dt)))
type: AcceptedAnswer
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/78329768
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/138094709
answers question: http://stackoverflow.com/q/78329768

http://stackoverflow.com/q/78430344
answer count: 1
type: UnansweredQuestion
tagged with: luajit
has answer: http://stackoverflow.com/a/78432189
has body: I need to write a test that diagnoses double free for a Lua object created using ffi.new. As a result, you need to call collectgarbage() twice, after which a double free situation should occur. I wrote this example: local ffi = require("ffi") ffi.cdef[[ typedef struct { int x; } my_struct; ]] local obj = ffi.new("my_struct", {10}) obj = ffi.gc(obj, function (o) print(123) end) obj = nil collectgarbage("collect") collectgarbage("collect") but the destructor of this object is called only 1 time
score: 0
type: Question
has comment: http://stackoverflow.com/comment/138271157
tagged with: lua
tagged with: ffi
has title: How to call the destructor on a Lua object twice to catch double free?
tagged with: double-free

http://stackoverflow.com/comment/138151461
comment on: http://stackoverflow.com/q/78360664
score: 0
type: QuestionComment
type: Comment
has text: You can store any values in the object, but you are using object just as unique key.

http://stackoverflow.com/comment/138394198
comment on: http://stackoverflow.com/a/78496044
has text: 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!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/78430148
has comment: http://stackoverflow.com/comment/138282631
has body: How can i use Lua FFI for LuaFFIAction() in my dnsdist's configuration file? 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. Do I need include dnsdist-lua-ffi.hh in my C/C++ code and all dependencies for use dnsdist_ffi_dnsquestion_t? If I only include dnsdist-lua-ffi.hh, it need all headers into it, and this include a lot of files.
score: 0
type: Question
has title: Using Lua FFI in dnsdist
tagged with: powerdns
answer count: 0
tagged with: lua
type: UnansweredQuestion
tagged with: c++

http://stackoverflow.com/q/78361215
upvote count: 1
has comment: http://stackoverflow.com/comment/138181656
answer count: 1
type: UnansweredQuestion
tagged with: neovim
has body: This is the LSP part of my neovim config https://pastebin.com/3zMWCnhG this is the entire init.lua file https://pastebin.com/CuB3bMmg I don't get why the lsp does not attach to any buffers? When I run :LspInfo, I get Language client log: /Users/jgs/.local/state/nvim/lsp.log Detected filetype: lua 0 client(s) attached to this buffer: Configured servers list: When I run :Mason however, I can see Installed ◍ astro-language-server astro ◍ chrome-debug-adapter ◍ clangd ◍ debugpy ◍ deno denols ◍ eslint-lsp eslint ◍ jdtls ◍ json-lsp jsonls ◍ lua-language-server lua_ls ◍ pyright ◍ rust-analyzer rust_analyzer ◍ standardjs ◍ stylua ◍ tailwindcss-language-server tailwindcss ◍ typescript-language-server tsserver the language servers are obviously installed. What's going wrong? I copied this from kickstart.nvim and didn't change anything. I'm really confused why it's not working In case you don't want to open the pastebin link, here is the part { -- LSP Configuration &amp; Plugins 'neovim/nvim-lspconfig', dependencies = { 'williamboman/mason.nvim', 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', { 'j-hui/fidget.nvim', opts = {} }, { 'folke/neodev.nvim', opts = {} }, }, config = function() vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) local map = function(keys, func, desc) vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') map('&lt;leader&gt;D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition') map('&lt;leader&gt;ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') map('&lt;leader&gt;ws', require('telescope.builtin').lsp_dyna…
favorite count: 0
has comment: http://stackoverflow.com/comment/138181638
has comment: http://stackoverflow.com/comment/138181748
has comment: http://stackoverflow.com/comment/138182346
has answer: http://stackoverflow.com/a/78484296
type: Question
has title: Neovim: LSP not attaching to buffer
downvote count: 0
tagged with: lua
score: 1

http://stackoverflow.com/comment/138274312
type: Comment
comment on: http://stackoverflow.com/a/78432412
type: AnswerComment
has text: 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.
score: 1

http://stackoverflow.com/q/78360132
type: Question
tagged with: lua
has title: How to use for loops in Lua / Roblox?
tagged with: roblox
has answer: http://stackoverflow.com/a/78369605
score: 0
answer count: 1
type: UnansweredQuestion
has body: 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. Here is the code shown: local player = game.Players.LocalPlayer local pack = player.Backpack local itemSell = script.Parent.Item1 local items = pack:GetChildren() for i = 1, #items do end The blank space is where I got stumped. How can I make it work?

http://stackoverflow.com/comment/138277838
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78433500
type: Comment
has text: the output/console is blank when it came to the frames

http://stackoverflow.com/comment/138242401
comment on: http://stackoverflow.com/q/78414522
type: Comment
score: 0
has text: I tried to [build from scratch](https://luals.github.io/wiki/build/) (plan C) but it showed me errors and I stopped the installation :(
type: QuestionComment

monaco-editor
type: Tag
tags question: http://stackoverflow.com/q/78432834
tag name: monaco-editor

http://stackoverflow.com/q/78362205
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138162082
has title: 'socket.http' module isn't found when using require
score: 0
type: Question
has comment: http://stackoverflow.com/comment/138156662
tagged with: require
tagged with: lua
answer count: 0
has body: So I am trying to make a lua script that use "socket.http" 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 "local socket = require("socket.http"). screenshot: I have already downloaded the src for socket.http from luasocket repository but i don't know what to do after like where do i add the files in the folder of my executable, so that I could be able to use socket.http? I've tried just adding the src folder to the path where my "executor" is and that didn't work for some reason, i also tried adding a folder called "lua" with only socket.lua and http.lua but that yet again didn't work too.

custom-plugins
tags question: http://stackoverflow.com/q/78373365
tag name: custom-plugins
type: Tag

http://stackoverflow.com/q/78379717
tagged with: game-development
answer count: 0
tagged with: javascript
score: 0
type: Question
tagged with: lua
tagged with: lua-table
type: UnansweredQuestion
tagged with: fivem
has body: 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. enter image description here enter image description here I tried many ways but still not work this is my current js function clearText(ids) { ids.forEach(function(id) { $('#' + id).text(''); }); } window.addEventListener('message', function(event) { const type = event.data.type; const playerData = event.data.PlayerData; const zonedata = event.data.zonedata; updateUI(playerData, zonedata); }); function updateUI(playerData, zonedata) { // Get UI elements const leaderElement = document.getElementById("leader"); const leaderKillsElement = document.getElementById("leaderkills"); const killStreakNameElement = document.getElementById("killstreakname"); const killStreakNumberElement = document.getElementById("killstreaknumber"); const rewardOnKillElement = document.getElementById("rewardonkill"); const totalKillsElement = document.getElementById("totalkills"); const killsElement = document.getElementById("kills"); const deathsElement = document.getElementById("deaths"); const top1NameElement = document.getElementById("top1name"); const player1KillsElement = document.getElementById("player1kills"); const top2NameElement = document.getElementById("top2name"); const player2KillsElement = document.getElementById("player2kills"); const top3NameElement = document.getElementById("top3name"); const player3KillsElement = document.getElementById("player3kills"); const top4NameElement = document.getElementById("top4name"); const player4KillsElement …
has title: Fivem JS not updating UI

http://stackoverflow.com/comment/138064833
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78309427
has text: 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 (`^...$`)?
type: Comment

http://stackoverflow.com/comment/138285623
type: Comment
comment on: http://stackoverflow.com/a/78432412
score: 0
type: AnswerComment
has text: How are you determining on the client that the ball goes from player 1 to player 2? And on the server?

powershell
tags question: http://stackoverflow.com/q/78337661
tag name: powershell
type: Tag
tags question: http://stackoverflow.com/q/78349259
tags question: http://stackoverflow.com/q/79059064
tags question: http://stackoverflow.com/q/79503032

http://stackoverflow.com/q/78359732
answer count: 0
has body: 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. This is the code in the script: function sysCall_init() -- Define handles for the Sawyer robot arm and the cube sawyer = sim.getObjectHandle('Sawyer') cube = sim.getObjectHandle('Cube') -- Define positions for point A and point B local posA = {x = 1.0, y = 0.875, z = 0.050} local posB = {x = 0.5, y = 2, z = 0.050} -- Move the arm to point A moveToPosition(posA) -- Open gripper and grab cube openGripper() sim.wait(1) -- Wait for gripper to open grabCube() -- Move the arm to point B moveToPosition(posB) -- Release cube releaseCube() end function moveToPosition(position) -- Calculate joint angles using inverse kinematics local jointHandles = {sim.getObjectHandle('joint1'), sim.getObjectHandle('joint2'), sim.getObjectHandle('joint3'), sim.getObjectHandle('joint4'), sim.getObjectHandle('joint5'), sim.getObjectHandle('joint6')} local config = sim.getConfigForTipPose(sawyer, jointHandles, 0.1, 10, nil, nil, position) -- Set joint positions for i = 1, 6 do sim.setJointPosition(jointHandles[i], config[i]) end end function openGripper() -- Open gripper sim.setJointTargetPosition(sim.getObjectHandle('sawyerGrabber'), 0.04) end function grabCube() -- Attach cube to gripper sim.setObjectParent(cube, sim.getObjectHandle('sawyerGrabber'), true) end function releaseCube() -- Detach cube from gripper sim.setObjectParent(cube, -1, true) end When I run it I get error message: And this is my scene hierarchy: Note: I have never used coppeliaSim nor lua before so please explain as clearly as possible. Thank you.
upvote count: 1
tagged with: simulation
has title: Lua script for coppeliaSim grabber
tagged with: lua
downvote count: 0
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/138146310
tagged with: robotics
favorite count: 0
type: Question

http://stackoverflow.com/a/78561844
accepted answer of: http://stackoverflow.com/q/78318512
has body: If anybody runs into this problem in the future what I did to solve this was to source the file using nvim's vim.cmd functionality. So what I did was: local function loadmodule(modulePath, moduleName) vim.opt.rtp:append(modulePath) vim.cmd("source " .. modulePath .. "/" .. moduleName) end loadmodule("path/to/module", "module-name") this works for .vim and .lua files.
answers question: http://stackoverflow.com/q/78318512
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/138227949
has text: It should be false because `or` should return the right operand when the left operand is a nil.
type: Comment
comment on: http://stackoverflow.com/a/78397758
score: 0
type: AnswerComment

timezone-offset
type: Tag
tag name: timezone-offset
tags question: http://stackoverflow.com/q/78329768

http://stackoverflow.com/comment/138359499
type: QuestionComment
comment on: http://stackoverflow.com/q/78394057
type: Comment
score: 0
has text: 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?

http://stackoverflow.com/comment/138172969
has text: 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.
comment on: http://stackoverflow.com/a/78374465
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/78431181
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/78431135
has body: In your cultivation toggle script, are you changing the cultivating value on the client and not on the server. That's why your cultivation script which is server-sided is not updating because the cultivating never updates on the server but on the client so the server-side script can't detect it. Roblox uses a client-server model so to communicate on the server it is necessary to use a RemoteEvent to tell the server that the user is cultivating and then use that information to add qi. 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. — https://create.roblox.com/docs/reference/engine/classes/RemoteEvent In this case, you would use the Client → Server remote event to tell the server that a user is cultivating. The changes you should make in your script would include: Modifying cultivation toggle script to fire a RemoteEvent to the server when the player starts or stops cultivating Remaking the cultivation script entirely to handle the cultivating event and then calculating qi based on that
answers question: http://stackoverflow.com/q/78431135

http://stackoverflow.com/comment/138162980
type: QuestionComment
comment on: http://stackoverflow.com/q/78369116
score: 1
has text: 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).
type: Comment

http://stackoverflow.com/q/78363120
type: UnansweredQuestion
tagged with: nginx
answer count: 1
has body: I am running an NGINX server with Lua (via OpenResty). I want to implement a very simple thing: If the user accesses / serve from the folder startpage If the user accesses any other path, for example /foo, serve from the folder /html/foo I tried many things, nothing seems to work. I can not change the root folder by ngx.var.document_root = "/startpage" - I get an error. Then I tried this script, but instead of an internal rewrite of the url, I get an redirect to "/startpage", so the user can see "/startpage" in the browser adress bar, which I do not want. -- Check if the script has already been executed - without this check, this script is called recursively if rewritten ~= true then rewritten = true -- Root ("/") was called, set correct startpage if ngx.var.uri == "/" then ngx.req.set_uri("/startpage") -- Otherwise, set correct path to the called resource else ngx.req.set_uri("/html"..ngx.var.uri) end end If anyone can point me to the right direction, I would be very thankful. What is the goal exactly? If the user calls the root /: If the user is logged in: Serve files from /startpage/user If the user is logged in: Serve files from /startpage/guest Else (user calls any other URL): Example: User calls /foo: Serve files from /html/foo Example: User calls /foo/bar/baz: Serve files from /html/foo/bar/baz 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.
has answer: http://stackoverflow.com/a/78365706
has comment: http://stackoverflow.com/comment/138154150
score: 0
has comment: http://stackoverflow.com/comment/138155331
has title: NGINX / Lua - dynamic root folder / URI rewrite
type: Question
tagged with: url-rewriting
has comment: http://stackoverflow.com/comment/138154822
tagged with: lua
has comment: http://stackoverflow.com/comment/138154948

http://stackoverflow.com/comment/138057459
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78309427
has text: @AlexanderMashin Thanks for your comment. One pure lua solution without using one external lib is preferred.

http://stackoverflow.com/comment/138226071
has text: Are you sure you are running lua 5.4?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78402894
type: Comment

http://stackoverflow.com/comment/138231709
score: 0
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/78407002
type: AnswerComment

http://stackoverflow.com/comment/138057292
type: QuestionComment
score: 0
has text: Can you install lrexlib?
type: Comment
comment on: http://stackoverflow.com/q/78309427

http://stackoverflow.com/a/78368596
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78360776
has body: 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. I also believe you are making the grave mistake of using a numbervalue, instead of intvalue: Since the number value cannot be set/incremented to another value. So if you are change that to an intvalue too. I also took note that you did made a nice variable called "NumberValue" but didnt used it. Which I believe you should as it makes your code much more cleaner. local NumberValue = workspace.Core.Ball.Value NumberValue:GetPropertyChangedSignal("Value"):Connect(function() if NumberValue >= 100 then script.Parent.Text = "Temp:"..NumberValue.."Stable" end end)

http://stackoverflow.com/q/78394057
has comment: http://stackoverflow.com/comment/138211799
has comment: http://stackoverflow.com/comment/138366388
has comment: http://stackoverflow.com/comment/138359499
has comment: http://stackoverflow.com/comment/138366380
answer count: 0
tagged with: awesome-wm
score: 0
has title: Get client content from minimized window - Awesome WM
type: Question
has body: 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. 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: function theme.at_screen_connect(s) ... -- Create an icon only tasklist widget s.mytasklist = awful.widget.tasklist { screen = s, filter = awful.widget.tasklist.filter.currenttags, source = function() -- Get all clients local cls = client.get() -- Filter by an existing filter function and allowing only one client per class local result = {} local class_seen = {} local class_num = 0 local class_index = {} for _, c in pairs(cls) do if awful.widget.tasklist.filter.currenttags(c, s) then if not class_seen[c.class] then class_seen[c.class] = true class_index[c.class] = class_num class_num = class_num + 1 table.insert(result, c) end end end return result end, -- buttons = awful.util.tasklist_buttons, --buttons = awful.button({ }, 1, tasklistButton(c)), buttons = awful.button({ }, 1, function (c) local client_num=0 for i, cl in pairs(client.get()) do if cl.class == c.class then if cl.screen == c.screen then client_num = client_num + 1 end end end if client_num > 1 then if cl_menu then if cl_menu_class == c.class then cl_menu.visible = false cl_menu=nil else cl_menu.visible = false cl_menu=nil cl_menu_class = c.class cl_menu=clientClassPopup(c) cl_menu.visible=true end else cl_menu_class = c.class cl_menu=clientClassPopup(c) cl_menu.visible=true end else if cl_menu then cl_menu.visible = false cl_menu = nil end if client.focus == c then c.minimized = true else client.focus = c awful.tag.viewonly(c:tags()[1]) c:raise() end end end), layout = { spacing_widget = { { forced_width = 24, forced_height = 1, thickness = 1, color = '#BBBBBB', widget = wibox.widget.separator }, valign = 'center', halign = 'center', widget = wibox.container.place, }, spacing = 2, layout = wibox.layout.fixed.vertical }, -…
tagged with: lua
type: UnansweredQuestion
tagged with: cairo

http://stackoverflow.com/comment/138277444
has text: 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 ?
type: QuestionComment
comment on: http://stackoverflow.com/q/78432834
type: Comment
score: 0

http://stackoverflow.com/comment/138237780
type: Comment
comment on: http://stackoverflow.com/q/78411075
score: 0
type: QuestionComment
has text: [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")`

http://stackoverflow.com/comment/138152123
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78356582
type: Comment
has text: @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?

http://stackoverflow.com/q/78391628
has title: How to enable keymap for Lazygit?
upvote count: 1
answer count: 1
score: 1
favorite count: 0
has body: I am trying to enable a keymap for Lazygit. I have added the following into my tmux.conf: set -g @plugin 'kdheepak/lazygit.nvim' And have added the following to my keymaps.lua: -- Keymap for launching Lazygit by hitting space+gg vim.keymap.set('n', '&lt;space&gt;gg', ':LazyGit&lt;CR&gt;') 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. 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: https://github.com/omerxx/dotfiles 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. Thank you all.
accepted answer: http://stackoverflow.com/a/78391747
type: AnsweredQuestion
tagged with: neovim
has answer: http://stackoverflow.com/a/78391747
type: Question
downvote count: 0
tagged with: lua

text-editor
tags question: http://stackoverflow.com/q/78432834
type: Tag
tag name: text-editor

http://stackoverflow.com/comment/138203864
comment on: http://stackoverflow.com/a/78391747
type: Comment
score: 0
has text: @Assaf Sorry made a mistake with the instructions. Made an edit to the answer. Reload Neovim after you make the changes as well.
type: AnswerComment

http://stackoverflow.com/comment/138287294
has text: I made and published the animation so I don’t know why it’s not working. They are named from 1 to 5
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78434058

http://stackoverflow.com/comment/138204101
type: Comment
comment on: http://stackoverflow.com/a/78330687
score: 0
has text: Again. the names are gone, without wizardry you can not recover them. Yes code files are in the resource,car,
type: AnswerComment

http://stackoverflow.com/a/78435133
answers question: http://stackoverflow.com/q/78433994
has body: you can check if a hit part is a part inside of a character by checking if the parent is a character using the GetPlayerFromCharacter method. local Players = game:GetService("Players"); script.Parent.Touched:Connect(function(hit) local Character = hit.Parent local Player = Players:GetPlayerFromCharacter(Character); if (not Player) then return; end -- exit function, no player touched local explode = Instance.new("Explosion", hit); explode.Position = hit.Position; hit:BreakJoints(); Debris:AddItem(hit, 5); end);
has comment: http://stackoverflow.com/comment/138285259
type: Answer
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/138286051

http://stackoverflow.com/comment/138148617
has text: Can you show the ideal result that you want to get?
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/78360776
type: Comment

http://stackoverflow.com/comment/138163191
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78369116
has text: 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.
type: QuestionComment

http://stackoverflow.com/comment/138242463
has text: 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. I don't know what was the problem, but it solved by itself.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78402894
type: Comment

http://stackoverflow.com/a/78415023
accepted answer of: http://stackoverflow.com/q/78414522
answers question: http://stackoverflow.com/q/78414522
upvote count: 2
has body: The easiest way that I found is to use brew package manager. Install Brew on Linux Add Brew to $PATH. (It will be suggested at the end of the Brew installation. Just copy-paste) Reload terminal to be able to use brew after setting the $PATH Run brew install lua-language-server in terminal Run lua-language-server (just to check if it is installed correctly) Close lua-luangage-server (Ctrl + C) Done
downvote count: 1
type: AcceptedAnswer
type: Answer
score: 1

http://stackoverflow.com/comment/138206253
comment on: http://stackoverflow.com/q/78392555
type: QuestionComment
score: 0
has text: Probably necause of upvalues (_ENV) can not disappear while optimising.
type: Comment

http://stackoverflow.com/comment/138200376
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78390389
has text: 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.
type: QuestionComment

http://stackoverflow.com/q/78407718
answer count: 0
tagged with: roblox
type: Question
has body: 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. Problem: It didnt change.. nothing is showing in the console. Basically i tried adding some debug statements but again it didnt show up. Note: Yes that is the literal names of the team local function updateText(message) textObject.Text = message end local function updateTextOnTeamChange(player) local teamService = game:GetService("Teams") if teamService then local playerTeam = teamService:GetPlayerTeam(player) if playerTeam then local teamName = playerTeam.Name if teamName == "Starting Point <3" then updateText("Enter a portal to start~!") elseif teamName == " Playing ~ !!" then updateText("Checkpoint : ") elseif teamName == "Finish Line ^w^" then updateText("You finished the tower!") else updateText("An error occurred!") warn("Unknown player team: " .. teamName) end else updateText("You are not on any team") end else warn("Teams service not found!") updateText("An error occurred! Please try again later.") end end game.Players.PlayerAdded:Connect(function(player) print("Player added:", player.Name) -- Debugging statement player:GetPropertyChangedSignal("Team"):Connect(function() print("Team changed for player:", player.Name) -- Debugging statement updateTextOnTeamChange(player) end) end) this is for the proximity prompt local trigger = checkpoint:FindFirstChild("ProximityPrompt") if trigger then trigger.Triggered:Connect(function(player) if player == game.Players.LocalPlayer then print("Checkpoint triggered successfully.. Proceeding to update checkpoint " .. checkpoint.Name) checkpoint.Transparency = 1 updateText("Checkpoint: " .. checkpoint.Name) else updateText("Error occurred!") warn("Objects not found") end end) end any feedbacks is greatly appreciated ~!!!
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138234654
has title: How do i change the text in a text label when a player is changing teams and interacting a proximity prompt (LUA)
has comment: http://stackoverflow.com/comment/138235717
score: 0

http://stackoverflow.com/comment/138078048
score: 0
type: QuestionComment
has text: The pattern itself should be valid and correct (`print(('}_'):match('([%a%d}])_')) -- '}'`). How are you using it?
type: Comment
comment on: http://stackoverflow.com/q/78319200

http://stackoverflow.com/comment/138262342
has text: 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).
comment on: http://stackoverflow.com/a/78424253
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/78322705
tagged with: lua
accepted answer: http://stackoverflow.com/a/78323044
type: Question
tagged with: roblox
tagged with: roblox-studio
has answer: http://stackoverflow.com/a/78323044
tagged with: client-side
has body: So I'm trying to use the default Roblox "Animate" client side script on an NPC and when I try it, none of the animations load at all 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
has title: Roblox default animate script not working on NPC
answer count: 1
score: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/138154822
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78363120
has text: @DmitryMeyer Other folders which then contain html/css/js. For example: /startpage/foo/index.html /startpage/bar/index.html /html/document1/index.html /html/document2/index.html And so on.
type: Comment

http://stackoverflow.com/comment/138235717
comment on: http://stackoverflow.com/q/78407718
type: Comment
has text: The script is local and is under the textlabel that updates it accordingly.
type: QuestionComment
score: 0

computational-geometry
type: Tag
tags question: http://stackoverflow.com/q/78356582
tag name: computational-geometry

http://stackoverflow.com/comment/138182346
type: QuestionComment
score: 1
has text: 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!
type: Comment
comment on: http://stackoverflow.com/q/78361215

http://stackoverflow.com/q/78378851
upvote count: 1
accepted answer: http://stackoverflow.com/a/78378904
favorite count: 0
has title: I can't understand the error and how to fix it. Lua version 5.1
type: AnsweredQuestion
answer count: 1
has body: 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? Runtime Error at line: -1: d:\gameobject.lua:36: attempt to call method 'position' (a table value) Vector3f = {} Vector3f.__index = Vector3f function Vector3f:new(x, y, z) local vector = {x = x or 0, y = y or 0, z = z or 0} setmetatable(vector, self) return vector end Transform = {} Transform.__index = Transform function Transform:new(position, rotation, scale) local transform = { position = position or Vector3f:new(0, 0, 0), rotation = rotation or Vector3f:new(0, 0, 0), scale = scale or Vector3f:new(0, 0, 0) } setmetatable(transform, self) return transform end function Transform:position(x, y, z) self.position.x = x or self.position.x self.position.y = y or self.position.y self.position.z = z or self.position.z end local pos = Vector3f:new(1, 2, 3) local rot = Vector3f:new(4, 5, 6) local sca = Vector3f:new(7, 8, 9) local transform = Transform:new(pos, rot, sca) print("X: " .. transform.position.x .. " Y: " .. transform.position.y .. " Z: " .. transform.position.z) print("X: " .. transform.rotation.x .. " Y: " .. transform.rotation.y .. " Z: " .. transform.rotation.z) print("X: " .. transform.scale.x .. " Y: " .. transform.scale.y .. " Z: " .. transform.scale.z) transform:position(10, 20, 30) print("X: " .. transform.position.x .. " Y: " .. transform.position.y .. " Z: " .. transform.position.z)
type: Question
downvote count: 0
tagged with: lua
score: 1
has answer: http://stackoverflow.com/a/78378904

http://stackoverflow.com/comment/138177431
type: QuestionComment
score: 0
has text: How do you install the plugin in your docker ?
type: Comment
comment on: http://stackoverflow.com/q/78373365

http://stackoverflow.com/comment/138226801
type: Comment
score: 0
type: QuestionComment
has text: I am writing in notepad, Full code is in the text Please wait a moment. My question lacks information. I'll write again in the comments
comment on: http://stackoverflow.com/q/78405312

http://stackoverflow.com/comment/138285215
score: 0
comment on: http://stackoverflow.com/q/78438152
type: QuestionComment
has text: I might end up parsing it twice, but I'm still holding out hope for something a bit more principled.
type: Comment

http://stackoverflow.com/comment/138286051
score: 0
comment on: http://stackoverflow.com/a/78435133
type: AnswerComment
has text: @RyanLuu i disagree because accessories / tools shouldnt be part of the hitbox ;)
type: Comment

nlua
type: Tag
tags question: http://stackoverflow.com/q/78411075
tag name: nlua
tags question: http://stackoverflow.com/q/79413710

hpc
tag name: hpc
type: Tag
tags question: http://stackoverflow.com/q/78407863

http://stackoverflow.com/comment/138240281
type: Comment
type: QuestionComment
score: 0
has text: Maybe try to use the `io.popen()` function
comment on: http://stackoverflow.com/q/78407863

http://stackoverflow.com/comment/138217640
type: QuestionComment
comment on: http://stackoverflow.com/q/78400404
score: 1
type: Comment
has text: Yes it's safe, this happens all the time. Think about all of the STL functions that accept Lua callbacks.

http://stackoverflow.com/a/78320009
has body: local checkpoints=workspace.Checkpoints local TOTAL_STAGES_IN_GAME=#checkpoints:children() local function tp(player,x) local val=Instance.new"DoubleConstrainedValue" val.MaxValue=TOTAL_STAGES_IN_GAME-(checkpoints:FindFirstChild"0"and 1 or 0) val.MinValue=checkpoints:FindFirstChild"0"and 0 or 1 local stage=player.leaderstats.Stage val.Value=stage.Value val.Value+=x stage.Value=val.Value local char=player.Character char=char and char:move(checkpoints[stage.Value].Position) --player.TeleportedStage=stage.Value end return { up=function(player) tp(player,1) end, up2=function(player) tp(player,10) end, down2=function(player) tp(player,-10) end }
answers question: http://stackoverflow.com/q/78317719
score: 0
has comment: http://stackoverflow.com/comment/138082398
has comment: http://stackoverflow.com/comment/138079895
type: Answer
has comment: http://stackoverflow.com/comment/138077968

http://stackoverflow.com/q/78337661
tagged with: windows-terminal
tagged with: powershell
type: Question
answer count: 0
tagged with: lua
has body: --test.lua local s = io.read() for i=1, utf8.len(s) do local cp = utf8.codepoint(s,i) print(cp) print(utf8.char(cp)) end Run in a PowerShell terminal through the Terminal app: C:\&gt;chcp 65001 Active code page: 65001 C:\&gt;lua test.lua abæ 97 a 98 b 230 æ C:\&gt; Notice the nonascii 'æ' gets printed and with it's codepoint value of 230 If I do the same from a regular PowerShell window (i.e. not through the Terminal app): C:\&gt;chcp 65001 Active code page: 65001 C:\&gt;lua test.lua abæ 97 a 98 b 0 C:\&gt; Now the 'æ' is not correctly interpreted. 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? Edit: As per JosefZ's request is here the output of ([console]::InputEncoding, [console]::OutputEncoding, $OutputEncoding) | Select-Object -Property EncodingName, WindowsCodePage, Codepage: EncodingName WindowsCodePage CodePage ------------ --------------- -------- Unicode (UTF-8) 1200 65001 OEM United States 1252 437 US-ASCII 1252 20127 It's the same for both (PowerShell alone and PowerShell in Terminal) I use Lua 5.4
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138111926
has comment: http://stackoverflow.com/comment/138109068
has title: Cannot read unicode from stdin from regular PS and CMD windows
has comment: http://stackoverflow.com/comment/138109822
tagged with: unicode
has comment: http://stackoverflow.com/comment/138109512
score: 0

http://stackoverflow.com/comment/138177915
type: QuestionComment
score: 0
has text: Have you check this https://docs.konghq.com/gateway/latest/plugin-development/distribution/#via-a-dockerfile-or-docker-run-install-and-load ?
comment on: http://stackoverflow.com/q/78373365
type: Comment

http://stackoverflow.com/comment/138148147
type: QuestionComment
score: 1
type: Comment
has text: Is your `proxy` just always empty table?
comment on: http://stackoverflow.com/q/78360664

http
tag name: http
type: Tag
tags question: http://stackoverflow.com/q/78432428
tags question: http://stackoverflow.com/q/78562731
tags question: http://stackoverflow.com/q/78978616

http://stackoverflow.com/q/78366974
type: AnsweredQuestion
answer count: 1
accepted answer: http://stackoverflow.com/a/78369077
type: Question
has answer: http://stackoverflow.com/a/78369077
tagged with: lua
tagged with: kubernetes
has body: I would like to use a Lua script with ingress-nginx to block traffic to the specific path. I created the below config, but it doesn't work as expected. apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: example-ingress annotations: nginx.ingress.kubernetes.io/rewrite-target: /$1 nginx.ingress.kubernetes.io/server-snippet: | location /app-2 { rewrite_by_lua_block { ngx.status = 403; ngx.exit(ngx.HTTP_FORBIDDEN); } } spec: rules: - http: paths: - path: /app-1 pathType: Prefix backend: service: name: app-1 port: number: 80 - path: /app-2 pathType: Prefix backend: service: name: app-2 port: number: 80 ~ curl http://A.B.C.D/app-2 It works!
score: 0
tagged with: nginx-ingress
has title: How to use Lua script with ingress-nginx

http://stackoverflow.com/comment/138126878
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/78317719
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138279319
has text: 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.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78434058
type: Comment

http://stackoverflow.com/comment/138181748
comment on: http://stackoverflow.com/q/78361215
type: Comment
score: 1
type: QuestionComment
has text: 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.

http://stackoverflow.com/comment/138154948
comment on: http://stackoverflow.com/q/78363120
has text: 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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78405110
score: 2
downvote count: 0
has body: Assuming your Lua source file is UTF-8 encoded, "слово" will be equivalent to "\209\129\208\187\208\190\208\178\208\190" (you can confirm this via ("слово"):gsub(".", function(c) return ("\\%d"):format(c:byte()) end)). 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 209. a is the string consisting of just the first byte, so "\209". Hence, the answer to your question of I just want to know which symbol would work for the if statement is just "\209". 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. The other conditions you tried didn't work because: "?" is just the ASCII question mark, equivalent to "\63". Obviously, "\63" is not the same string as "\209", since the byte is different. The question mark isn't special in any way. "�" is just the Unicode replacement character. This is what terminals often render when you give them an invalid codepoint. It is not the "real codepoint". Under the hood, it is encoded as "\239\191\189", which is not byte equal to "\209". "" is just the empty string. Being shorter than the one-byte string "\209", it can't be equal. nil won't compare equal to any string, being of a different type. In general, keep in mind that Lua strings are just byte strings, not strings of "codepoints" or "grapheme clusters". If you substring, you're indexing bytes. If you want to index codepoints instead, use the utf8 library, and ensure that your strings are UTF-8 encoded.
answers question: http://stackoverflow.com/q/78404978
upvote count: 2
type: Answer

symbols
tag name: symbols
tags question: http://stackoverflow.com/q/78404978
type: Tag

http://stackoverflow.com/comment/138195977
type: Comment
type: QuestionComment
score: 0
has text: 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?
comment on: http://stackoverflow.com/q/78386191

http://stackoverflow.com/comment/138062159
type: QuestionComment
comment on: http://stackoverflow.com/q/78308549
type: Comment
score: 0
has text: its been years since I've touched java, but don't you have to provide a classpath when you run java file?

http://stackoverflow.com/comment/138242291
score: 0
has text: Did you see the plan B and C?
type: QuestionComment
comment on: http://stackoverflow.com/q/78414522
type: Comment

http://stackoverflow.com/q/78363204
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78367839
tagged with: lua
answer count: 1
has body: I want to make it so when the proximityprompt is in range of the player, the part with the proxprompt gets a highlight. I put a script in the part, the script was this: local proximityPrompt = script.Parent local part = script.Parent.Parent if proximityPrompt.PromptShown == true then Instance.new(Highlight, part) end I'm a new programmer so I couldn't think of another way to do it.
tagged with: roblox-studio
score: 0
type: Question
has title: 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?

network-programming
tags question: http://stackoverflow.com/q/78349390
tag name: network-programming
type: Tag
tags question: http://stackoverflow.com/q/78729670

raycasting
tag name: raycasting
type: Tag
tags question: http://stackoverflow.com/q/78337673
tags question: http://stackoverflow.com/q/79112338

http://stackoverflow.com/a/78484296
answers question: http://stackoverflow.com/q/78361215
score: 0
has body: It turns out, the problem was being on an old version of mason-lspconfig. This was causing the issue: require('mason-lspconfig').setup { handlers = { function(server_name) local server = servers[server_name] or {} server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) require('lspconfig')[server_name].setup(server) end, }, The way to pass in the handlers was different in an older version. Updating it solved the problem.
type: Answer

http://stackoverflow.com/comment/138156662
type: Comment
has text: The error message lists several "no file" entries. You should put your file at one of these locations to make require() find it.
score: 0
comment on: http://stackoverflow.com/q/78362205
type: QuestionComment

http://stackoverflow.com/comment/138064972
comment on: http://stackoverflow.com/q/78309427
score: 0
type: Comment
has text: @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.
type: QuestionComment

http://stackoverflow.com/comment/138282631
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78430148
score: 0
type: QuestionComment

http://stackoverflow.com/a/78335032
score: 2
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: The function: function deepApply (default, new) for key, value in pairs (new) do if type (value) == "table" then if not default[key] then default[key] = {} print ('created table ['..key..']') end local def2 = default[key] local new2 = new[key] deepApply (def2, new2) elseif default[key] ~= new[key] then print ('updated ['..key..'] from ['..tostring(default[key])..'] to ['..tostring(new[key])..']') default[key] = new[key] end end end Example: local globalDefault = { ["LastPlayed"] = "", ["Grades"] = { ["Grade"] = 1, ["Level"] = 1 }, ["Challenge"] = { ["History"] = {} }, ["Settings"] = { ["ScrollFrameHitbox"] = false } } local globalData = { ["Settings"] = { ["ScrollFrameHitbox"] = true }, ["NewSettings"] = { ["IsFun"] = true }, } deepApply (globalDefault, globalData) serpent = require ('serpent') print (serpent.block (globalDefault)) Result: created table [NewSettings] updated [IsFun] from [nil] to [true] updated [ScrollFrameHitbox] from [false] to [true] { Settings = { ScrollFrameHitbox = true }, Challenge = { History = {} }, NewSettings = { IsFun = true }, LastPlayed = "", Grades = { Level = 1, Grade = 1 } }
accepted answer of: http://stackoverflow.com/q/78334699
answers question: http://stackoverflow.com/q/78334699

http://stackoverflow.com/q/78317635
tagged with: lua
tagged with: list
has answer: http://stackoverflow.com/a/78318537
type: UnansweredQuestion
has body: 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. How can I solve this problem? Sample list : GAMES = { ["777_Thimble"] = { ["game_name"] = "777 Thimble", ["game_thumbnail"] = "img/777thimble_logo.svg", ["1x_multiplier"] = 2.88, ["2x_multiplier"] = 1.44, ["first_bet"] = 50, ["second_bet"] = 100, ["third_bet"] = 250, ["four_bet"] = 1000, ["five_bet"] = 5000, ["min_attributable_bet_value"] = 5, ["max_attributable_bet_value"] = 10000, }, ["777e_Thimble"] = { ["game_name"] = "777 Thimble", ["game_thumbnail"] = "img/game_bg.svg", ["1x_multiplier"] = 2.88, ["2x_multiplier"] = 1.44, ["first_bet"] = 50, ["second_bet"] = 100, ["third_bet"] = 250, ["four_bet"] = 1000, ["five_bet"] = 5000, ["min_attributable_bet_value"] = 5, ["max_attributable_bet_value"] = 10000, }, ["777_Thimblet"] = { ["game_name"] = "777 Thimble", ["game_thumbnail"] = "img/game_bg.svg", ["1x_multiplier"] = 2.88, ["2x_multiplier"] = 1.44, ["first_bet"] = 50, ["second_bet"] = 100, ["third_bet"] = 250, ["four_bet"] = 1000, ["five_bet"] = 5000, ["min_attributable_bet_value"] = 5, ["max_attributable_bet_value"] = 10000, }, ["777e_Thimbrle"] = { ["game_name"] = "777 Thimble", ["game_thumbnail"] = "img/game_bg.svg", ["1x_multiplier"] = 2.88, ["2x_multiplier"] = 1.44, ["first_bet"] = 50, ["second_bet"] = 100, ["third_bet"] = 250, ["four_bet"] = 1000, ["five_bet"] = 5000, ["min_attributable_bet_value"] = 5, ["max_attributable_bet_value"] = 10000, }, ["777_Thimbgle"] = { ["game_name"] = "777 Thimble", ["game_thumbnail"] = "img/game_bg.svg", ["1x_multiplier"] = 2.88, ["2x_multiplier"] = 1.44, ["first_bet"] = 50, ["second_bet"] = 100, ["third_bet"] = 250, ["four_bet"] = 1000, ["five_bet"] = 5000, ["min_attributable_bet_value"] = 5, ["max_attributable_…
tagged with: encode
has title: How can I use lua language json.encode without breaking the order of the list?
tagged with: http://stackoverflow.com/tag/json
answer count: 1
tagged with: javascript
score: 0
type: Question

http://stackoverflow.com/q/78317719
type: Question
has title: Making a multiple stage selector in Roblox Studio
has comment: http://stackoverflow.com/comment/138076858
has comment: http://stackoverflow.com/comment/138126878
tagged with: luau
has comment: http://stackoverflow.com/comment/138143493
has answer: http://stackoverflow.com/a/78320009
tagged with: lua
tagged with: scripting
tagged with: roblox
tagged with: roblox-studio
score: 0
type: UnansweredQuestion
has body: I'm making a stage selector that you can go forward and back a stage in my Roblox Game, but it didn't work, here's the code: local trasferHandler = {} local TOTAL_STAGES_IN_GAME = 10 for _, stage in pairs(workspace.Checkpoints:GetChildren()) do if tonumber(stage.Name) > TOTAL_STAGES_IN_GAME then TOTAL_STAGES_IN_GAME = tonumber(stage.Name) end end function trasferHandler.up(plr, direction) local tpStage = plr.TeleportedStage if tpStage.Value < plr.leaderstats.Stage.Value then tpStage.Value += 1 plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[plr.TeleportedStage.Value].CFrame + Vector3.new(0,3.25,0) elseif tpStage.Value == plr.leaderstats.Stage.Value then tpStage.Value = 0 plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints["0"].CFrame + Vector3.new(0,3.25,0) end end function trasferHandler.up2(plr, direction) local tpStage = plr.TeleportedStage if tpStage.Value < plr.leaderstats.Stage.Value then tpStage.Value += 10 plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[plr.TeleportedStage.Value].CFrame + Vector3.new(0,3.25,0) elseif tpStage.Value == plr.leaderstats.Stage.Value then tpStage.Value = 0 plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints["0"].CFrame + Vector3.new(0,3.25,0) end end function trasferHandler.down2(plr, direction) local tpStage = plr.TeleportedStage if tpStage.Value > 10 then tpStage.Value -= 10 plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[tpStage.Value].CFrame + Vector3.new(0,3.25,0) elseif tpStage.Value == 0 then tpStage.Value = plr.leaderstats.Stage.Value plr.Character.HumanoidRootPart.CFrame = workspace.Checkpoints[plr.leaderstats.Stage.Value].CFrame + Vector3.new(0,3.25,0) end end return trasferHandler i was expecting it to change the stage i was at, and somehow, it also broke the ability for me to go backwards.
answer count: 1

http://stackoverflow.com/comment/138212366
type: Comment
score: 0
has text: hey there, just tried what you suggested and still the same issue.
type: AnswerComment
comment on: http://stackoverflow.com/a/78396898

anti-cheat
type: Tag
tag name: anti-cheat
tags question: http://stackoverflow.com/q/78386134

ouya
type: Tag
tag name: ouya
tags question: http://stackoverflow.com/q/78325013

http://stackoverflow.com/comment/138246615
score: 0
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/78407863
type: Comment

http://stackoverflow.com/comment/138287710
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78434058
has text: @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.

reveal.js
type: Tag
tag name: reveal.js
tags question: http://stackoverflow.com/q/78343371

http://stackoverflow.com/comment/138280376
type: AnswerComment
has text: this could false on a npc
comment on: http://stackoverflow.com/a/78435108
score: 1
type: Comment

http://stackoverflow.com/q/78375359
downvote count: 0
has title: Set max limit for async fs operations? (EMFILE: too many open files)
score: 1
tagged with: neovim-plugin
type: UnansweredQuestion
tagged with: neovim
favorite count: 0
has body: 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 >1000. Function that reads file is local uv = vim.loop function utils.read_file(path, callback) uv.fs_open(path, "r", 438, function(err, fd) assert(not err, err) assert(fd, fd) uv.fs_fstat(fd, function(s_err, stat) assert(not s_err, s_err) assert(stat, stat) uv.fs_read(fd, stat.size, 0, function(r_err, data) assert(not r_err, r_err) uv.fs_close(fd, function(c_err) assert(not c_err, c_err) callback(data) end) end) end) end) end and it is called from loop like for _, path in ipairs(paths) do utils.read_file(path, some_process_func) end I faced with error ... EMFILE: too many open files: ... when size of paths was too big. So question is how to deal with this situation? I tried to make kinda semaphore which looks like local sema = 10 for _, path in ipairs(paths) do while sema == 0 do end sema = sema - 1 utils.read_file(path, function() sema = sema + 1 --... end) end 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.
answer count: 0
tagged with: lua
tagged with: luvit
tagged with: libuv
type: Question
upvote count: 1

http://stackoverflow.com/a/79102801
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/78414522
has body: Here's the way for choosing "B. From latest release" from github. Download the .gz file that meets your architecture. I'd like to put the files to ~/.local/share/lua-lang-server. You can choose other place for them. mkdir -p ~/.local/share/lua-lang-server && \ tar --extract --file <YOUR .gz FILE> -av -C ~/.local/share/lua-lang-server Create a symbolic link in ~/.local/bin to the executable. ln -s ~/.local/share/lua-lang-server/bin/lua-language-server ~/.local/bin/lua-language-server Test if it works by executing lua-language-server. (Optional) If step 4 fails since bash cannot find the executable lua-language-server, then you have to append ~/.local/bin to the environment variable PATH. export PATH=$PATH:~/.local/bin
type: Answer
score: 3

http://stackoverflow.com/a/78367517
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/78360664
downvote count: 0
has body: You did not create a proxy as it is described in Tracking table accesses you may want to go back an revisit that section. you did not produce "A variation of the dual representation" you just reproduced the same code but with balance renamed to proxyToAccount which I feel misses the point of the exercise. You are intended to solve the problem using a proxy because it should produce a different result, then you can compare those results. 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. local Account = {} Account.__index = Account function Account:withdraw (v) self.balance = self.balance - v end function Account:deposit (v) self.balance = self.balance + v end function Account:new() local protected = setmetatable({balance = 0}, Account) local proxy = { deposit = function(self, v) protected:deposit(v) end, withdraw = function(self, v) protected:withdraw(v) end, } local meta = { __index = protected, __newindex = function (t,k,v) print("this table is read-only") end, } setmetatable(proxy, meta) return proxy end Then you make these calls with both implementations: account = Account:new() account:deposit(100) print(account.balance) what are the differences, how many indexes are done, what is the memory foot print, which is more secure, etc...
type: Answer

http://stackoverflow.com/comment/138393772
score: 0
has text: @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?
type: AnswerComment
comment on: http://stackoverflow.com/a/78496044
type: Comment

http://stackoverflow.com/comment/138192621
type: Comment
comment on: http://stackoverflow.com/q/78386134
has text: Heyo, an important piece of information for us is "why doesn't your script work well?" Did you test it by noclipping, and your script simply didn't catch it? What part of the script is failing?
type: QuestionComment
score: 2

http://stackoverflow.com/a/78432189
upvote count: 1
downvote count: 0
score: 1
type: Answer
has body: It is impossible to invoke a double free for automatically managed memory in LuaJIT (that is, created with ffi.new). But you can do it for manually managed memory: local ffi = require"ffi" ffi.cdef[[ typedef struct { int x; } my_struct; void* malloc(size_t); void free(void*); ]] local function my_free(o) print(123) ffi.C.free(o) end local obj = ffi.gc( ffi.cast("my_struct*", ffi.C.malloc(ffi.sizeof("my_struct"))), my_free ) obj.x = 10 -- first free my_free(obj) -- second free obj = nil collectgarbage("collect") collectgarbage("collect") P.S. BTW, huge blocks of memory are recommended to allocate as manually managed (instead of using ffi.new)
answers question: http://stackoverflow.com/q/78430344

http://stackoverflow.com/comment/138094709
comment on: http://stackoverflow.com/a/78330276
score: 1
type: Comment
has text: 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
type: AnswerComment

http://stackoverflow.com/comment/138317062
has text: 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
comment on: http://stackoverflow.com/a/78369605
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/79464484
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/78433138
has body: As mentioned above, you can just add comma, but if you still want to disable it: According to https://zigtools.org/zls/editors/vim/nvim-lspconfig/ , you can use this global option: -- disable format-on-save from `ziglang/zig.vim` vim.g.zig_fmt_autosave = 0 To disable "fix all" you can try this, but I didn't tried myself: vim.api.nvim_create_autocmd('BufWritePre',{ pattern = {"*.zig", "*.zon"}, callback = function(ev) vim.lsp.buf.code_action({ -- Try to make that *only* array-like table empty -- original lines: -- context = { only = { "source.fixAll" } }, -- apply = true, context = { only = {} }, apply = false, }) end }) P.S. Also it should be zls instead of Lua for ZLS config of nvim-lspconfig in your code example (Lua is for Lua LS*): local lspconfig = require('lspconfig') lspconfig.zls.setup { -- Server-specific settings. See `:help lspconfig-setup` -- omit the following line if `zls` is in your PATH -- === IMO you can use PATH btw ^ === cmd = { '/path/to/zls_executable' }, -- There are two ways to set config options: -- - edit your `zls.json` that applies to any editor that uses ZLS -- - set in-editor config options with the `settings` field below. -- -- Further information on how to configure ZLS: -- https://zigtools.org/zls/configure/ settings = { zls = { -- Example from link above: -- Neovim already provides basic syntax highlighting semantic_tokens = "partial", -- omit the following line if `zig` is in your PATH zig_exe_path = '/path/to/zig_executable' } } }
downvote count: 0
score: 1

http://stackoverflow.com/a/78377386
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/78374652
answers question: http://stackoverflow.com/q/78374652
has comment: http://stackoverflow.com/comment/138179953
downvote count: 0
has body: 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 shoould work.

http://stackoverflow.com/comment/138275747
score: 1
type: Comment
type: QuestionComment
has text: You're missing a comma after the last field. See [this](https://github.com/ziglang/zig/issues/3057) for an explanation.
comment on: http://stackoverflow.com/q/78433138

http://stackoverflow.com/comment/138179639
comment on: http://stackoverflow.com/a/78378904
has text: You are super mega handsome, long life) Thank you for your help!
score: 0
type: Comment
type: AnswerComment

compiler-optimization
tags question: http://stackoverflow.com/q/78392555
tag name: compiler-optimization
type: Tag

http://stackoverflow.com/comment/138271157
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78430344

http://stackoverflow.com/comment/138195083
score: 0
type: AnswerComment
has text: @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.
comment on: http://stackoverflow.com/a/78369605
type: Comment

http://stackoverflow.com/comment/138263097
comment on: http://stackoverflow.com/q/78424147
has text: `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.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/138285166
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78435108
has text: @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)
type: Comment

http://stackoverflow.com/a/78405022
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: 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.
answers question: http://stackoverflow.com/q/78404978

http://stackoverflow.com/comment/138109512
score: 0
has text: My issue is the other way round. I don't see the issue in the terminal apps.
type: Comment
comment on: http://stackoverflow.com/q/78337661
type: QuestionComment

http://stackoverflow.com/comment/138394150
type: AnswerComment
comment on: http://stackoverflow.com/a/78496044
type: Comment
score: 0
has text: @wurli the syntax doesn't work in my neovim could you send me what version of neovim you using this is mine ` NVIM v0.9.5 Build type: Release LuaJIT 2.1.1692716794 system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim" Run :checkhealth for more info `

overloading
type: Tag
tag name: overloading
tags question: http://stackoverflow.com/q/78386191

http://stackoverflow.com/comment/138196883
type: QuestionComment
has text: 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.
score: 0
comment on: http://stackoverflow.com/q/78386191
type: Comment

http://stackoverflow.com/comment/138109822
type: Comment
has text: The terminal apps I'm referring are cmd.exe and powershell.exe
comment on: http://stackoverflow.com/q/78337661
type: QuestionComment
score: 0

http://stackoverflow.com/comment/138279669
type: AnswerComment
comment on: http://stackoverflow.com/a/78432412
score: 0
has text: I don't really know what is that tho
type: Comment

http://stackoverflow.com/comment/138212578
type: AnswerComment
has text: 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.
score: 0
comment on: http://stackoverflow.com/a/78396898
type: Comment

http://stackoverflow.com/a/78397758
score: 1
has comment: http://stackoverflow.com/comment/138226016
upvote count: 1
has body: This has nothing to do with <const>, you can use an old version of Lua (<= 5.1.4) to test the code below: function bar() if false then print("Hello World!") end end And you will see an optimized result: JMP 3 ;jump to return GETGLOBAL 0 -1 LOADK 1 -2 CALL 0 2 1 RETURN 0 1 Very good, right? But an issue is hidden here. As is well known, the logical operators in Lua (and, or) are quite unique. In fact, they share the same logic as some statements such as if-else, and jumping up directly causes such a bug: -- version <= 5.1.4: nil print(((nil and nil) or false) and true) Due to the fact that the left expression ((nil and nil) or false) of the last and 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. 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.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78392555
answers question: http://stackoverflow.com/q/78392555
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/138227949
type: Answer

http://stackoverflow.com/a/78432436
has body: 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 Player.CharacterAdded:Connect(function(Character) local Tool -- Creating a variable but not setting its value yet if Character:WaitForChild("OrangeJuiceTool"):IsA("Tool") then -- waiting for the child "OrangeJuiceTool" and also checking if that's a tool Tool = Character:WaitForChild("OrangeJuiceTool") -- if that's the tool, set the variable to it Tool.Activated:Connect(IncrementSips) -- finally connecting the function when the tool is activated end end) Note that this is only one part of the code, make changes so that it matches your own code
answers question: http://stackoverflow.com/q/78396506
score: 0
type: Answer

http://stackoverflow.com/comment/138226785
has text: i change to title and deleted it, leaving only the one question I wanted the most. setpeslltraining is a name, can change it to any name. I've never learned lua I just copied it after seeing someone else load the information like this. This is just code written in the game's init.txt file Nothing is written other than the content of the code.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78405312
type: QuestionComment

http://stackoverflow.com/comment/138120450
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78330687
has text: Yes, manually renaming to what it could have been, or asking the original author
type: Comment

http://stackoverflow.com/a/78405115
type: Answer
downvote count: 0
score: 1
has body: с is made of 2 bytes whose values are 209 and 129 so a = string.sub("слово", 1,1) will get the first of those 2 bytes, that means the character you should be checking the of value 209 and you can do this in lua by putting an escape and then entering the value in a string literal. a = string.sub("слово", 1,1) if a == '\209' then print('Do stuff') end
answers question: http://stackoverflow.com/q/78404978
upvote count: 1

url-rewriting
tag name: url-rewriting
type: Tag
tags question: http://stackoverflow.com/q/78363120

http://stackoverflow.com/a/78310929
upvote count: 2
score: 2
has body: 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. So the way to do this is with something called a higher-order function. We are going to use a function to create a function. And we will pass the result to the Touched connection. local createOnTouchedFunction = function(originalObject) return function(otherObject) wait(3) originalObject.BrickColor = BrickColor.Random() end end local blocks = workspace.test:GetChildren() for indx, obj in pairs(blocks) do obj.Touched:Connect(createOnTouchedFunction(obj)) end Alternatively, you could connect the object inside the function : local function changeColorOnTouch(obj) obj.Touched:Connect(function(otherObject) wait(3) obj.BrickColor = BrickColor.Random() end) end local blocks = workspace.test:GetChildren() for indx, obj in pairs(blocks) do changeColorOnTouch(obj) end
answers question: http://stackoverflow.com/q/78310793
type: Answer
downvote count: 0

http://stackoverflow.com/comment/138148657
score: 0
comment on: http://stackoverflow.com/q/78356582
type: QuestionComment
has text: 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).
type: Comment

http://stackoverflow.com/a/78323044
answers question: http://stackoverflow.com/q/78322705
has comment: http://stackoverflow.com/comment/138084686
score: 1
has body: LocalScripts run only in certain locations: https://create.roblox.com/docs/projects/data-model#client You can replace the Animate LocalScript with a ServerScript or a ServerScript with RunContext set to Client.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78322705
type: Answer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/138426808
type: Comment
has text: Is that why you are downvoting? Instead could you suggest a change?
score: 1
comment on: http://stackoverflow.com/a/78369077
type: AnswerComment

logic-error
tags question: http://stackoverflow.com/q/78374652
type: Tag
tag name: logic-error

ide
type: Tag
tags question: http://stackoverflow.com/q/78318964
tag name: ide

http://stackoverflow.com/comment/138275785
type: Comment
comment on: http://stackoverflow.com/a/78369605
type: AnswerComment
score: 0
has text: 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

http://stackoverflow.com/comment/138155331
type: QuestionComment
score: 0
has text: 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.
comment on: http://stackoverflow.com/q/78363120
type: Comment

http://stackoverflow.com/comment/138385240
has text: 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
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78496044
type: AnswerComment

http://stackoverflow.com/comment/138275811
comment on: http://stackoverflow.com/q/78433138
has text: 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.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/138226792
type: Comment
has text: 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?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78405312

http://stackoverflow.com/comment/138206514
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78392555
score: 0
has text: 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 Both methods have low-hanging fruits of optimizations, but the false case has the `JMP` and the true case does not

http://stackoverflow.com/a/78368130
has body: It is impossible. GHub 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. Use some mouse button instead of F
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78330950

http://stackoverflow.com/a/78367839
answers question: http://stackoverflow.com/q/78363204
type: Answer
upvote count: 1
downvote count: 0
score: 1
has body: if you wanna highlight the parent of the proximity prompt when the proximity prompt becomes visible you could use the PromptShown and PromptHidden events inside the ProximityPromptService and add / remove the highlight inside this event. this should apply to all prompts in your game. the following script should be placed inside a LocalScript inside the StarterPlayerScripts folder. local ProximityPromptService = game:GetService("ProximityPromptService"); ProximityPromptService.PromptShown:Connect(function(Prompt) local highlight = Instance.new("Highlight", Prompt); highlight.Adornee = Prompt.Parent; -- the part to highlight highlight.OutlineColor = Color3.fromRGB(255, 0, 0); -- red outline highlight.FillColor = Color3.fromRGB(255, 0, 0); -- red fill color highlight.FillTransparency = 0.7; -- transparency of the fill color end) ProximityPromptService.PromptHidden:Connect(function(Prompt) for _, child in pairs(Prompt:GetChildren()) do if child:IsA("Highlight") then child:Destroy(); -- destroys all existing highlights end end end)

http://stackoverflow.com/comment/138141586
comment on: http://stackoverflow.com/q/78356582
type: Comment
has text: [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.
type: QuestionComment
score: 1

http://stackoverflow.com/comment/138276172
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78369605
type: Comment
has text: @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.

http://stackoverflow.com/comment/138284583
type: Comment
comment on: http://stackoverflow.com/q/78438152
score: 4
type: QuestionComment
has text: Is the simple trick of "try loading as a chunk, if that fails, prepend `return ` and try again" not sufficient?

http://stackoverflow.com/q/78400232
tagged with: lua
type: UnansweredQuestion
tagged with: minecraft
has body: 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. function UTOptions(opt) local FR = 0 local max = 14 local w,h = term.getSize() local check = {} while true do for i,v in ipairs(opt) do if(string.len(v)>max) then error("Option is too long.") end if (FR == 0) then check[i] = 0 end term.setCursorPos(w-15,i+2) if (check[i]== 1) then term.setTextColor(colors.red) write("*") term.setTextColor(colors.white) write(v) else write("*"..v) end end local event, side, mx, my = os.pullEvent("monitor_touch") if (check[my-2] == 0) then check[my-2] = 1 for i,v in ipairs(check) do if (v ~= my-2) then check[i] = 0 end end elseif (check[my-2]==1) then return my-2 end FR = 1 end end I've tried to change the values in local event, side, mx, my = os.pullEvent("monitor_touch") if (check[my-2] == 0) then... such 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: for i,v in ipairs(check) do if (v ~= my-2) then check[i] = 0 end end I can't find a better way to update all the un-selected options to 0.
tagged with: computercraft
answer count: 1
has answer: http://stackoverflow.com/a/78404295
score: 0
type: Question
has title: Why does only one selection work when checking against a table in lua?

http://stackoverflow.com/comment/138078321
comment on: http://stackoverflow.com/q/78319200
type: Comment
has text: 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: `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)`, Sorry. The block codeblock in a comment looked hideous. This is actually better.
score: 0
type: QuestionComment

runtime
tag name: runtime
tags question: http://stackoverflow.com/q/78361071
type: Tag

http://stackoverflow.com/a/78344510
score: 0
type: AcceptedAnswer
type: Answer
has body: You can check the RaycastResult's ancestor for a Humanoid to determine if your Raycast has hit a Player. Since every player's Character is a Model and has a Humanoid child, if your raycast hits a model with a Humanoid we can safely assume that we've hit the player's character. From there you can use Players:GetPlayerFromCharacter to get the Player from its Character. if raycastResult and raycastResult.Instance then raycastResult.Instance.Color = Color3.new(1, 0, 0) -- The instance hit will be a child of a character model -- If a humanoid is found in the model then it's likely a player's character local characterModel = raycastResult.Instance:FindFirstAncestorOfClass("Model") if characterModel then local humanoid = characterModel:FindFirstChild("Humanoid") if humanoid then print("Detected " .. characterModel.Name) end end end The above code will check if the Raycast has an ancestor that is a Model and then if that model has a Humanoid. If we do then, in this case, print that we detect the player along with the player's name.
accepted answer of: http://stackoverflow.com/q/78337673
answers question: http://stackoverflow.com/q/78337673

http://stackoverflow.com/comment/138163140
score: 1
type: Comment
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/78369116

cjk
type: Tag
tag name: cjk
tags question: http://stackoverflow.com/q/78309427

http://stackoverflow.com/comment/138207272
type: Comment
comment on: http://stackoverflow.com/a/78391747
score: 0
type: AnswerComment
has text: @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.

http://stackoverflow.com/comment/138077968
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78320009
has text: didn't work, no output either
type: AnswerComment

private
type: Tag
tag name: private
tags question: http://stackoverflow.com/q/78360664
tags question: http://stackoverflow.com/q/78539500

http://stackoverflow.com/a/78393025
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/78386134
has body: The problem is that you gave the wrong parameters the :Raycast() method. the function needs an Orgin and Direction not a Start And End you can calculate the Direction between these 2 vectors by doing CurrPos - LastPos. note that this could possible false flag because of lag or ping since its serversided. local exclude = {} local function CheckNoclip(LastPos: Vector3, CurrPos: Vector3, Player: Player) if CurrPos == LastPos then return; end local Orgin = LastPos; local Direction = CurrPos - LastPos; local Params = RaycastParams.new(); Params.FilterDescendantsInstances = exclude; Params.FilterType = Enum.RaycastFilterType.Exclude; local Result = workspace:Raycast(Orgin, Direction, Params); if not Result then return; end if not Result.Instance.CanCollide then return; end local Character = Player.Character; local Root = Character:FindFirstChild("HumanoidRootPart"); Root.CFrame = CFrame.new(LastPos); warn("No-Clip Found"); print("---------------------------------"); end game:GetService("Players").PlayerAdded:Connect(function(Player: Player) Player.CharacterAdded:Connect(function(Character) table.insert(exclude, Character); local Humanoid = Character:WaitForChild("Humanoid"); local Root = Character:WaitForChild("HumanoidRootPart"); local CurrPos = Root.Position; local LastPos = CurrPos; task.spawn(function() -- create loop in new thread repeat LastPos = CurrPos; CurrPos = Root.Position; CheckNoclip(LastPos, CurrPos, Player); task.wait(); until Humanoid.Health <= 0 end) end); Player.CharacterRemoving:Connect(function(Character) table.remove(exclude, table.find(exclude, Character)); end); end)
type: AcceptedAnswer
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78386134

http://stackoverflow.com/comment/138128601
has text: This is not really a programming issue, maybe it is better place your Neovim specific issue at: https://github.com/neovim/neovim/issues
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78349259

bytecode
tag name: bytecode
type: Tag
tags question: http://stackoverflow.com/q/78444284
tags question: http://stackoverflow.com/q/78392555

http://stackoverflow.com/a/79530562
has body: 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] --lazy.nvim -- Setup lazy.nvim require("lazy").setup({ spec = { { "folke/tokyonight.nvim", lazy = false, -- Load immediately priority = 1000, -- Load before other plugins config = function() require("tokyonight").setup({ style = "storm", -- Options: "storm", "moon", "night", "day" transparent = false, terminal_colors = true, }) vim.cmd("colorscheme tokyonight") end, }, {import = "plugins"}, -- there all plugins are loaded and also mason.nvim }, }) --lsp.lua return { { "neovim/nvim-lspconfig", config = function() require'lspconfig'.lua_ls.setup {} end } } --my file tree /home/sharif/.config/nvim ├── example.lua ├── init.lua ├── lazy-lock.json └── lua ├── config │ ├── autocmds.lua │ ├── keymaps.lua │ ├── lazy.lua │ └── options.lua └── plugins ├── lsp.lua ├── mason.nvim.lua ├── mini.lua └── treesitter.lua --mason.nvim.lua return { 'williamboman/mason.nvim', config = function() require('mason').setup({ -- Optional configuration options ensure_installed = { "lua-language-server" },-- add more lsp server if you want more language automatic_installation = true, }) end }
answers question: http://stackoverflow.com/q/78414522
score: 0
type: Answer

http://stackoverflow.com/comment/138111926
score: 1
type: Comment
has text: Please [edit] your question to improve your [mcve]. In particular, share (PowerShel) `([console]::InputEncoding, [console]::OutputEncoding, $OutputEncoding) | Select-Object -Property EncodingName, WindowsCodePage, Codepage`
comment on: http://stackoverflow.com/q/78337661
type: QuestionComment

c#
tag name: c#
type: Tag
tags question: http://stackoverflow.com/q/78411075
tags question: http://stackoverflow.com/q/79080682
tags question: http://stackoverflow.com/q/79203398
tags question: http://stackoverflow.com/q/79413710

vscode-debugger
type: Tag
tag name: vscode-debugger
tags question: http://stackoverflow.com/q/78367547

http://stackoverflow.com/comment/138173454
type: Comment
has text: 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!
score: 1
comment on: http://stackoverflow.com/a/78374465
type: AnswerComment

zig
tag name: zig
tags question: http://stackoverflow.com/q/78433138
type: Tag

ftplugin
tag name: ftplugin
tags question: http://stackoverflow.com/q/78370029
type: Tag

http://stackoverflow.com/comment/138065445
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78309427
has text: @Luatic I want a full match, which means `^%s?[\u{4e00}-\u{9FFF}]+$`. Sorry for the ambiguity.

powerdns
tag name: powerdns
tags question: http://stackoverflow.com/q/78430148
type: Tag

nginx-ingress
tag name: nginx-ingress
tags question: http://stackoverflow.com/q/78366974
type: Tag

http://stackoverflow.com/a/78435508
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78407863
has body: I have managed to do it with this function. execute{cmd="source /apps/spack/share/spack/setup-env.sh", modeA={"load"}} Basically it does the source as expected after the module load and it works perfectly. Just for the record: 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. source_sh("bash", "/apps/spack/share/spack/spack/setup-env.sh") And the error: ==> Error: spack load requires Spack's shell support. To set up shell support, run the command below for your shell. For bash/zsh/sh: . /apps/spack/share/spack/ Thanks for all the help provided from everyone :)
accepted answer of: http://stackoverflow.com/q/78407863
type: AcceptedAnswer

none-ls
tag name: none-ls
type: Tag
tags question: http://stackoverflow.com/q/78427362

bezier
tag name: bezier
tags question: http://stackoverflow.com/q/78356582
type: Tag

solar2d
tags question: http://stackoverflow.com/q/78408798
type: Tag
tag name: solar2d
tags question: http://stackoverflow.com/q/78562440
tags question: http://stackoverflow.com/q/78661251

time
tags question: http://stackoverflow.com/q/78329768
type: Tag
tag name: time

http://stackoverflow.com/q/78562731
has title: Is there a way to use/a workaround for http requests in a localscript in Roblox?
score: 0
type: Question
has answer: http://stackoverflow.com/a/78563709
tagged with: http
tagged with: lua
tagged with: request
tagged with: roblox
tagged with: roblox-studio
has body: 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). here's some code to illustrate where I am atm: (here's the modulescript contents: local gearManagement = {} function gearManagement.GetGears(player) local HttpService = game:GetService("HttpService") local Table = "https://inventory.roproxy.com/v2/users/"..player.UserId.."/inventory?assetTypes=Gear&limit=100&sortOrder=Asc" local GearResponse = HttpService:RequestAsync({ Url = Table, Method = "GET" }); if GearResponse.Success then local TableBody = HttpService:JSONDecode(GearResponse.Body) for i, v in pairs(TableBody) do return v end end end function gearManagement.CheckForViewableInventory(player) local HttpService = game:GetService("HttpService") local CanSeeInventory = "https://inventory.roproxy.com/v1/users/"..player.UserId.."/can-view-inventory" local Response = HttpService:RequestAsync({ Url = CanSeeInventory, Method = "GET" }); end return gearManagement (and here's the localscript) local HttpService = game:GetService("HttpService") local players = game:GetService("Players") local player = players.LocalPlayer local serverStorage = game:GetService("ServerStorage") -- WHY THE HELL DOES THIS NOT WORK???????????? ITS RIGHT THERE GAME, THE UI FOLDER IS RIGHT THERE, WHY ARENT YOU SEEING IT -- ^i have found out how, local scripts can't interact w/ server stuff local gearCardBase = script.Parent.Parent.Parent.gearCard local gearManagement = require(script.Parent.gearManagement) local Response = gea…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138503970
answer count: 2
has answer: http://stackoverflow.com/a/78567634

http://stackoverflow.com/a/78581029
upvote count: 1
has comment: http://stackoverflow.com/comment/138536917
downvote count: 0
has body: 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. return { pandoc.Para {pandoc.Image({}, "image.png")}, pandoc.Plain "This follows right after the image." }
type: Answer
score: 1
answers question: http://stackoverflow.com/q/78567123
has comment: http://stackoverflow.com/comment/138536975

http://stackoverflow.com/a/78481932
upvote count: 1
downvote count: 0
has body: Actually, I think that if I reverse the order in which I call the filters, then this information is contained in the table caption: pandoc input.md --output=output.tex --from markdown+pipe_tables --to latex --lua-filter=table.lua --filter pandoc-crossref So I can now run the following table.lua filter, which solves my problem: function Table(tbl) local simpleTable = pandoc.utils.to_simple_table(tbl) local blocks = pandoc.Blocks{} -- Function to create a LaTeX row local function create_latex_row(cells) local latex_row = "" for i, cell in ipairs(cells) do for _, content in ipairs(cell) do latex_row = latex_row .. pandoc.write(pandoc.Pandoc({content}), "latex") end if i < #cells then latex_row = latex_row .. " & " end end return latex_row .. " \\\\" end -- Determine the number of columns (using header or first row) local num_cols = 0 if simpleTable.header and #simpleTable.header > 0 then num_cols = #simpleTable.header elseif #simpleTable.rows > 0 then num_cols = #simpleTable.rows[1] end -- Assume all columns are left-aligned for simplicity local col_alignment = string.rep("l", num_cols) -- Begin table environment blocks:insert(pandoc.RawBlock("latex", "\\begin{table}[tbp]")) blocks:insert(pandoc.RawBlock("latex", "\\centering")) -- Process caption and label if tbl.caption and #tbl.caption.long > 0 then local caption_str = pandoc.utils.stringify(tbl.caption.long) local caption_text, label = caption_str:match("^(.*) {#(.-)}$") if caption_text and label then blocks:insert(pandoc.RawBlock("latex", "\\caption{" .. caption_text .. "}")) blocks:insert(pandoc.RawBlock("latex", "\\label{" .. label .. "}")) else blocks:insert(pandoc.RawBlock("latex", "\\caption{" .. caption_str .. "}")) end end blocks:insert(pandoc.RawBlock("latex", "\\begin{tabular}{" .. col_alignment .. "}")) -- Process header if simpleTable.header and #simpleTable.header > 0 then local header_row = create_latex_row(simpleTable.header) blocks:insert(pandoc.RawBlock("latex", header_row)) blocks:insert(pandoc.Ra…
score: 1
type: Answer
answers question: http://stackoverflow.com/q/78481889

key-generator
tags question: http://stackoverflow.com/q/78581627
type: Tag
tag name: key-generator

http://stackoverflow.com/comment/138568280
type: Comment
comment on: http://stackoverflow.com/a/78579921
score: 0
type: AnswerComment
has text: Answer 1 is the only one that seems feasible because of a few main reasons. #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 #3 was attempted, but didn't reduce lag and #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) I will experiment and respond with results

http://stackoverflow.com/a/78564793
answers question: http://stackoverflow.com/q/78563491
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/78563491
has comment: http://stackoverflow.com/comment/138519606
type: AcceptedAnswer
type: Answer
has body: 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 pandoc.Para. And then later, we drop the Div whose first content is pandoc.Para. local str = pandoc.utils.stringify local function lang_checker(target_lang) -- Check for the code blocks with different language other than `target_lang` -- and if it is something other than `target_lang`, then return `pandoc.Para` -- instead of CodeBlock. return { CodeBlock = function(cb) if cb.classes:includes('cell-code') and (not cb.classes:includes(target_lang)) then return pandoc.Para("") else return cb end end } end local function remove_div_with_para(target_lang) -- Now remove the Div whose first content is pandoc.Para return { Div = function(el) if el.classes:includes('cell') then local check_lang = el:walk(lang_checker(target_lang)) if check_lang.content[1].t == "Para" then return pandoc.Null() else return el end end end } end function Pandoc(doc) local target_lang = doc.meta.target_lang and str(doc.meta.target_lang) or nil if target_lang then return doc:walk(remove_div_with_para(target_lang)) end return doc end
has comment: http://stackoverflow.com/comment/138519232
downvote count: 0

http://stackoverflow.com/q/78563491
upvote count: 2
type: Question
tagged with: pandoc
favorite count: 0
has title: Filter CodeBlocks for target language in Quarto to ipynb conversion
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/78564793
tagged with: lua
linked to: http://stackoverflow.com/q/78563147
tagged with: quarto
has answer: http://stackoverflow.com/a/78564793
answer count: 1
has comment: http://stackoverflow.com/comment/138506937
type: AnsweredQuestion
has body: 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 from another answer: function Pandoc (doc) if doc.meta.target_lang then local target_lang = pandoc.utils.stringify(doc.meta.target_lang) print("target lang is " .. target_lang) return doc:walk { CodeBlock = function (cb) if cb.classes[1] ~= target_lang then return {} end end } end return doc end However, this one returns an empty codeblock, which is annoying when rendering to ipynbb: { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [], "id": "c0eaebc8-2af1-42bc-840a-dda2e54fddbb" } This is the original document: --- title: Some title author: Some author date: last-modified format: ipynb: toc: false filters: - langsplit.lua target_lang: "python" --- Here is some text. ```{python test-py} print("some python code") ``` ```{r test-r} print("some R code") ```

http://stackoverflow.com/a/78590619
score: 1
type: Answer
downvote count: 0
has body: An IntValue can only store values up to 263-1 or around 9.2 quintillion which is the limit you are reaching. Since you are going over that limit, you are causing an integer overflow which restarts your value at zero. 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. — https://create.roblox.com/docs/reference/engine/classes/IntValue They are two ways around this, one is to use a library like BigInteger or BigNum or to store values as a string if you are willing to lose precision. Storing Numbers as a String If you are willing to sacrifice precision can store numbers as a string to bypass the 9.2 quintillion limit and then use tonumber to convert that string into an number whenever we want to use an arithmetic operation. In the below example, have Money and ExpensiveItemCost. The Money we have is above the IntValue maximum so we use a StringValue. When we are subtracting ExpensiveItemCost from Money we make sure to use tonumber to convert the Money which is a string into a number we can use local ExpensiveItemCost = 1e+105 -- Use StringValue instead of IntValue local Money = Instance.new(“StringValue”, workspace) Money.Value = '9e+105' -- Above that maximum IntValue can handle -- Use tonumber because Money.Value is a string Money.Value = tonumber(Money.Value) - ExpensiveItemCost print(Money.Value) -- 8e+105 From https://devforum.roblox.com/t/1344993 Using a Library for Large Numbers 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. For this example, I will be using BigInteger but you can choose any library you like …
upvote count: 1
answers question: http://stackoverflow.com/q/78588093

http://stackoverflow.com/q/78535770
tagged with: makefile
type: Question
tagged with: http://stackoverflow.com/tag/c
tagged with: lua
tagged with: premake
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78536190
has comment: http://stackoverflow.com/comment/138454907
answer count: 1
has comment: http://stackoverflow.com/comment/138455237
favorite count: 0
score: -1
has body: I'm writing a game using Raylib with the help of Premake5. I used a template to get started, specifically this one; https://github.com/raylib-extras/game-premake. I can't seem to figure out how to just link a set .lib. 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 premake5.lua and everything builds as expected. I used the template library premake5.lua, just edited to try 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: baseName = path.getbasename(os.getcwd()); project (baseName) kind "StaticLib" location "../_build/%{os.target()}" targetdir "../_bin/%{os.target()}/%{cfg.buildcfg}" links { "%{os.getcwd()}/build/%{os.target()}/lua51" } -- also tried luajit -- and also tried the following: libdirs { "%{os.getcwd()}/build/%{os.target()}" } links { "lua51" --or "luajit" } Though this seems to make the project to be treated as though it has source files. I attempted to circumvent Premake entirely via adding linkoptions { "../../lua/build/%{os.target()}/lua51.lib" } 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; ifeq ($(config),debug_x64) TARGETDIR = ../../_bin/windows/Debug TARGET = $(TARGETDIR)/project_unbound.exe OBJDIR = obj/x64/Debug/project_unbound DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_WIN32 -DGRAPHICS_API_OPENGL_43 ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g -std=c99 ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g -std=c++17 LIBS += ../../_bin/windows/Debug/raylib.lib ../../_bin/windows/Debug/sqlite3.lib ../../_bin/windows/Debug/flecs.lib -lwinmm -lkernel32 -lopengl32 -lgdi32 LDDEPS += ../../_bin/windows/Debug/raylib.lib ../../_bin/windows/Debug/sqlite3…
tagged with: raylib
downvote count: 1
linked to: http://stackoverflow.com/q/55039294
has comment: http://stackoverflow.com/comment/138455339
upvote count: 0
has title: Linking LuaJIT or other prebuilt static C libraries with Premake5

http://stackoverflow.com/a/78449697
downvote count: 0
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78448609
answers question: http://stackoverflow.com/q/78448609
type: AcceptedAnswer
type: Answer
has body: Use sound:Play() and sound:Stop() instead of using sound.Playing. sound:Stop() resets the sound to the beginning of the track instead of wherever it currently is. You can use :Resume() and :Pause() respectively to start and stop at the current position. Documentation for the Sound class

http://stackoverflow.com/comment/138429134
score: 0
comment on: http://stackoverflow.com/a/78491796
has text: 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
type: Comment
type: AnswerComment

http://stackoverflow.com/q/78495314
favorite count: 0
type: AnsweredQuestion
tagged with: pandoc
score: 1
tagged with: latex
tagged with: markdown
type: Question
downvote count: 0
has title: Removing captions in some images using Pandoc markdown to LaTeX conversion while keeping them centered
tagged with: lua
has answer: http://stackoverflow.com/a/78496354
answer count: 1
accepted answer: http://stackoverflow.com/a/78496354
upvote count: 1
has body: 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 Figure X: text after it. My main problem is that figures stick to the left when they don't have a caption. I have tried adding a class to the image: ![](./image.png){ .center width=200px } Then using a Lua filter to check for specific classes as in: if FORMAT:match 'latex' then function Image (elem) if elem.className == "center" then return { pandoc.RawInline('latex', '\\hfill\\break{\\centering'), elem, pandoc.RawInline('latex', '\\par}') } end end end And then applying the filter on the Pandoc call: pandoc --lua-filter=center.lua <myfile>.md -o <myfile>.pdf But this won't work. Other threads have suggested removing the markdown-implicit_figures, but it does it for every image in the document, and I don't want that. Anyone can help?

http://stackoverflow.com/comment/138424438
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78514915
has text: 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.

http://stackoverflow.com/q/78469058
answer count: 1
upvote count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/138337915
type: Question
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/78469187
has title: Do lua sequence values before index 1 use more memory?
has body: I've read you can start an "array" at any index in Lua, but "ipairs" seems to only work if it starts at 1 [EDIT: was 0]. > function printIpairs(a) >> for i, v in ipairs(a) do >> print(i .. '=' .. v) >> end >> end > printIpairs({4,5,6}) 1=4 2=5 3=6 > s = {} > s[0] = 4 > s[1] = 5 > s[2] = 6 > printIpairs(s) 1=5 2=6 > t = {} > t[4] = 4 > t[5] = 5 > t[6] = 6 > printIpairs(t) > So my question is, do s and t use "3 words" to store the 3 values internally as a sequence, or more(4/6), bc part/whole is stored as a "mapping" instead? And if they do use only 3 words, how do you find the "starting index" of the "sequence part", if ipairs won't give it to me?
tagged with: lua
tagged with: sequence
accepted answer: http://stackoverflow.com/a/78469187
type: AnsweredQuestion

http://stackoverflow.com/comment/138376964
comment on: http://stackoverflow.com/q/78490741
score: 0
has text: `%[sometext%]` is a correct Lua patten to match `[sometext]` text. How can we repro the issue?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/138475834
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78520786
has text: I can and do see people think of it as both.
type: Comment

http://stackoverflow.com/q/78539500
score: 0
type: Question
has answer: http://stackoverflow.com/a/78539631
has comment: http://stackoverflow.com/comment/138466786
has body: 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 "local" keyword. for example: -- field cannot be access in other Lua files local privateVal = 0 -- field can be read or write outside publicVal = 1 However, I hardly see the defination below: -- define a named function as local, so that it cannot be use outside local calc = function(item) return item.a + item.b end -- use it locally result = calc(myitem) Why this style hardly use in Lua programming? I think maybe it is difficult to transmit the parameter "self", or there are some performance loss in function creation prograss. Are there any other more critical reasons?
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138462068
has title: Why we don't use named local function to create "private function" in Lua？
has comment: http://stackoverflow.com/comment/138466884
answer count: 1
tagged with: private
tagged with: public
tagged with: protected
has comment: http://stackoverflow.com/comment/138461285

http://stackoverflow.com/comment/138468931
type: QuestionComment
comment on: http://stackoverflow.com/q/78543461
type: Comment
score: 0
has text: 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

http://stackoverflow.com/comment/138377059
has text: It doesn't work, unfortunately. I just installed imapfilter on an Ubuntu Server and it should work. We use Zimbra as our mail server.
comment on: http://stackoverflow.com/q/78490741
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/78557695
has body: string.find("MOZ-MAIL-1-1","MOZ-MAIL-") string.find("MOZ-MAIL-1-1","OZ-MAIL-") Given the above, why do those return false, but the following succeeds? string.find("MOZ-MAIL-1-1","Z-MAIL-")
score: 7
tagged with: string
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78557710
answer count: 1
favorite count: 0
type: Question
has title: Why does this string.find fail?
upvote count: 7
downvote count: 0
tagged with: lua
accepted answer: http://stackoverflow.com/a/78557710

http://stackoverflow.com/a/78557710
score: 12
accepted answer of: http://stackoverflow.com/q/78557695
answers question: http://stackoverflow.com/q/78557695
has body: string.find uses a pattern by default. - is a special character in a pattern: It is interpreted as "zero or more of the preceding character (class), match lazily". To make Lua interpret - as literal - in a pattern, escape it using %: string.find("MOZ-MAIL-1-1","MOZ%-MAIL%-") works. An alternative - which is especially convenient if your "needle" 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 plain = true: string.find("MOZ-MAIL-1-1","MOZ-MAIL-", 1, true) also works. string.find("MOZ-MAIL-1-1","Z-MAIL-") succeeds due to a coincidence: It matches MAI in this context: The Z- matches zero Zs, the L- matches zero Ls.
has comment: http://stackoverflow.com/comment/138540336
type: AcceptedAnswer
upvote count: 12
type: Answer
downvote count: 0

http://stackoverflow.com/q/78448609
answer count: 1
tagged with: roblox-studio
has body: 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. I have done something like this: local button = script.Parent local ServerScript = game:GetService("ServerScriptService") local ScreenGui = game:GetService("StarterGui").ScreenGui local function onButtonActivated() for _, sound in ipairs(workspace.Sounds:GetChildren()) do if sound:IsA("Sound") and sound.Playing then sound.Playing = false end end for _, scripts in ipairs(ServerScript.Sounds:GetChildren()) do if scripts.Enabled then scripts.Enabled = false end end end button.MouseButton1Click:Connect(onButtonActivated) 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?
type: Question
upvote count: 1
has title: Refreshing script in roblox
favorite count: 0
accepted answer: http://stackoverflow.com/a/78449697
has answer: http://stackoverflow.com/a/78449697
tagged with: roblox
downvote count: 0
score: 1
tagged with: lua
type: AnsweredQuestion

http://stackoverflow.com/q/78463165
upvote count: 1
answer count: 1
type: UnansweredQuestion
favorite count: 0
tagged with: expansion
downvote count: 1
has title: In Lua, is it possible to do delayed expansion like you can in batch script?
has comment: http://stackoverflow.com/comment/138327790
has comment: http://stackoverflow.com/comment/138327760
score: 0
type: Question
has body: Lets say I have multiple arrays: arr1 = {1,2} arr2 = {3,4,5} arr3 = {6,7,8,9} and I want to use something like this to randomly pick something from one of them: local randomPick = 1 if #array &gt; 1 then repeat randomPick = RNG:NextInteger(1, #array) until randomPick ~= lastPick lastPick = randomPick end would it be possible for me to replace the #array 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. Thanks in advance!
tagged with: lua
tagged with: delay
has answer: http://stackoverflow.com/a/78463269
has comment: http://stackoverflow.com/comment/138334664

greatest-common-divisor
tag name: greatest-common-divisor
tags question: http://stackoverflow.com/q/78578434
type: Tag

http://stackoverflow.com/comment/138367696
comment on: http://stackoverflow.com/a/78483612
type: AnswerComment
has text: As far as I know, not with FFM. But you could with JNI.
type: Comment
score: 0

http://stackoverflow.com/q/78563147
type: AnsweredQuestion
has body: 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: taget_lang = nil function Meta(m) if m.taget_lang then taget_lang = pandoc.utils.stringify(m.taget_lang) end print("In Meta, taget lang is " .. taget_lang) return m end function CodeBlock(el) print("In CodeBlock, taget lang is " .. taget_lang) if taget_lang then if el.attr.classes[1] ~= taget_lang then return {} end return el end end And this is an example markdown (or rather Quarto) document: --- title: Some title author: Some author date: last-modified format: ipynb: toc: false filters: - langsplit.lua taget_lang: "python" --- Here is some text. ```{python test-py} print("some python code") ``` ```{r test-r} print("some R code") ``` When I use quarto render test.qmd, I get this print output: nil nil nil nil In Meta, taget lang is python 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 documentation. Any clues? (I'm also unhappy with return {}, which returns an empty code block instead of nothing, but that's a separate issue)
tagged with: pandoc
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/78563491
tagged with: lua
tagged with: quarto
accepted answer: http://stackoverflow.com/a/78563234
has title: Quarto/pandoc filter using meta variable
has answer: http://stackoverflow.com/a/78563234
upvote count: 1
answer count: 1
score: 1
favorite count: 0

http://stackoverflow.com/comment/138536917
type: Comment
comment on: http://stackoverflow.com/a/78581029
score: 0
type: AnswerComment
has text: P.S. do you know a way to automatically center both pictures and text inside .docx file?

http://stackoverflow.com/comment/138542621
comment on: http://stackoverflow.com/a/78581428
type: AnswerComment
has text: 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)
type: Comment
score: 0

http://stackoverflow.com/a/78553062
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78552455
score: 1
has body: This was a documentation bug: pandoc used to expect a compiled template as the Template parameter, but that was changed for various reasons. The documentation was updated to reflect this 5 days ago. It will be online after the next pandoc release. Long story short, the below should work: Template = pandoc.template.default 'tba.lua'
answers question: http://stackoverflow.com/q/78552455
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/138535578
type: Comment
type: QuestionComment
score: 0
has text: What do you want to do with `k`? What is the expected output of `camichael(n)`?
comment on: http://stackoverflow.com/q/78578434

http://stackoverflow.com/comment/138637710
type: QuestionComment
has text: @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
comment on: http://stackoverflow.com/q/78587137
type: Comment
score: 0

http://stackoverflow.com/comment/138334664
comment on: http://stackoverflow.com/q/78463165
has text: 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?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/78514915
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/138424438
type: AcceptedAnswer
has body: you can use set_rundir to set lua script directory, then use xmake run to run it. target("Elevated") set_kind("binary") add_packages("lua") add_files("src/*.c") set_rundir("scripts") then put your lua scripts to scripts directory. scripts/engine/main.lua run your program. xmake run If you want to distribute your program, you can use add_installfiles, set_installdir to configure all installed lua script files. then run xmake install -o outputdir
score: 1
answers question: http://stackoverflow.com/q/78513980
accepted answer of: http://stackoverflow.com/q/78513980
upvote count: 1

http://stackoverflow.com/a/78481625
score: 1
type: Answer
upvote count: 1
has body: Since both proxy_pass and content_by_lua_block belong to the content phase, they are mutually exclusive: https://github.com/openresty/lua-nginx-module?tab=readme-ov-file#content_by_lua_block content_by_lua_block [...] 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. In order to process the upstream body you have to proxy using Lua cosocket API. There is a library for this job: lua-resty-http. If the response fits into memory, you can use Single-shot request, otherwise you have to stream it chunk by chunk — Streamed request — but it makes processing a lot more challenging.
downvote count: 0
answers question: http://stackoverflow.com/q/78480464

http://stackoverflow.com/comment/138512952
comment on: http://stackoverflow.com/a/78567907
type: AnswerComment
has text: @Luatic A point well made. I've tried to clarify.
score: 2
type: Comment

http://stackoverflow.com/a/78483612
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78481795
answers question: http://stackoverflow.com/q/78481795
score: 5
has comment: http://stackoverflow.com/comment/138367696
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/138364938
type: Answer
has body: Basics Note the java.lang.foreign 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 java.lang.invoke API as well. That said, the Foreign Function & Memory (FFM) API provides the StructLayout interface for interacting with native structs. Make sure your StructLayout matches the memory layout of the native struct exactly. This includes any padding, as well as using the correct byte alignment and byte order. For a simple example, if you have the following C struct: #include <stdint.h> typedef struct Point { int32_t x; int32_t y; } Point; Then you would want to create a StructLayout like so: StructLayout pointLayout = MemoryLayout.structLayout( ValueLayout.JAVA_INT.withName("x"), ValueLayout.JAVA_INT.withName("y"), ).withName("Point"); The MemoryLayout#structLayout(MemoryLayout...) takes a series of MemoryLayout. This means you can create an arbitrarily complex struct layout, including nested structs. Note calling withName 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 VarHandle to a region of memory. Once you have the StructLayout you can use a SegmentAllocator to allocate native memory for the struct from Java. This will give you a MemorySegment. // 'Arena' is a subtype of 'SegmentAllocator' try (Arena arena = Arena.ofConfined()) { MemorySegment pointSegment = arena.allocate(pointLayout); // use 'pointSegment'... } // 'arena' is closed, releasing any memory it allocated You can call the appropriate get and set methods of MemorySegment with the appropriate arguments to get and set the values of the struct's data members. You would pass this MemorySegment to any downcall MethodHandle (created via a Linker) that invokes a native function which accepts a Point struct. Sim…
upvote count: 5

http://stackoverflow.com/q/78567852
has answer: http://stackoverflow.com/a/78567907
has body: function foo() end if foo() then end I saw some code that did this and wondered: What is being evaluated by the if statement when foo() does not return anything. Tried it in an interpreter and it evaluates to false, but is that a guarantee? Is it evaluating the last thing returned somewhere else?
upvote count: 2
score: 2
answer count: 1
has title: Evaluating a function that returns nothing
favorite count: 0
type: AnsweredQuestion
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/78567907
tagged with: lua

http://stackoverflow.com/q/78527511
has title: holding shift to toggle the mouse buttons in lua?
score: 0
type: Question
has answer: http://stackoverflow.com/a/78537215
tagged with: mouse
tagged with: lua
type: UnansweredQuestion
tagged with: logitech-gaming-software
has body: 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 "mouse button 4" to "1." Any help would be greatly appreciated function OnEvent(event, arg) if IsMouseButtonPressed(2) and IsModifierPressed("lshift") then PressKey("2") OutputLogMessage("Held") end if not IsModifierPressed("lshift") then OutputLogMessage("NOT Held") end end
answer count: 1

http://stackoverflow.com/comment/138461970
score: 0
comment on: http://stackoverflow.com/a/78491796
type: Comment
has text: Anyways I ended up doing like you said, filtering the search results on the client side.
type: AnswerComment

http://stackoverflow.com/a/78491796
has comment: http://stackoverflow.com/comment/138458069
has comment: http://stackoverflow.com/comment/138459646
has comment: http://stackoverflow.com/comment/138477020
has comment: http://stackoverflow.com/comment/138429134
has body: 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. 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. (A common example of this is that if you search for "answers", the server may include a message that mentions "answer", because its search engine works on word stems rather than exactly.)
upvote count: 1
has comment: http://stackoverflow.com/comment/138430556
has comment: http://stackoverflow.com/comment/138461854
has comment: http://stackoverflow.com/comment/138477281
has comment: http://stackoverflow.com/comment/138459524
answers question: http://stackoverflow.com/q/78490741
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/138461895
has comment: http://stackoverflow.com/comment/138461970
has comment: http://stackoverflow.com/comment/138462108
score: 1
has comment: http://stackoverflow.com/comment/138430506

http://stackoverflow.com/a/78575870
score: 0
type: Answer
has body: As @River said:every time the 'Fall.OnServerEvent' function is triggered,the "Shot.OnServerEvent" will be connect again.So, there are several Shot.OnServerEvent functions being triggered where you can't see them. I can provide you with two ways to write： script.Parent.Fall.OnServerEvent:Connect(function(plr,guy) local shotConnectEvent = script.Parent.Shot.OnServerEvent:Connect(function(plr,target) --you code shotConnectEvent:disconnect() end end script.Parent.Fall.OnServerEvent:Connect(function(plr,guy) script.Parent.Shot.OnServerEvent:Once(function(plr,target) --you code end end Of course, I haven't verified the feasibility of these two writing methods, I hope it can help you.
answers question: http://stackoverflow.com/q/78464672

http://stackoverflow.com/comment/138501799
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78561649
has text: 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
type: QuestionComment

http://stackoverflow.com/comment/138511990
score: 0
has text: 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?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78567123

http://stackoverflow.com/a/78539631
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/78539500
downvote count: 0
has body: Why this style hardly use in Lua programming? On Github, searching for /local [\w_]+? = function/ language:Lua returns 181k files, searching for "local function" language:Lua returns 631k files. I think this style should be quite common.

http://stackoverflow.com/q/78567807
has body: 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. I'm looking for functionality similar to python's exec(), which executes the string provided to it. A possible "entry" point to the interpreter, such as an internal console. I've looked at luaL_dostring, though it does not seem present in the executable of the game.
has comment: http://stackoverflow.com/comment/138512674
tagged with: lua
type: UnansweredQuestion
tagged with: reverse-engineering
has title: Passing Lua expression to interpreter from C++
tagged with: c++
has comment: http://stackoverflow.com/comment/138515844
score: 0
type: Question
answer count: 0

http://stackoverflow.com/comment/138537054
type: QuestionComment
has text: 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
type: Comment
comment on: http://stackoverflow.com/q/78578434
score: 0

http://stackoverflow.com/comment/138332130
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78463269
has text: 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)
type: Comment

http://stackoverflow.com/q/78464672
tagged with: lua
type: UnansweredQuestion
tagged with: roblox-studio
answer count: 2
has answer: http://stackoverflow.com/a/78575870
score: 0
type: Question
has comment: http://stackoverflow.com/comment/138335694
has body: 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. This script is named "server" and is a normal script script.Parent.Fall.OnServerEvent:Connect(function(plr,guy) script.Parent.Shot.OnServerEvent:Connect(function(plr,target) for _, player in pairs((game.Players:GetPlayers())) do local character = workspace:WaitForChild(guy) local part = target local partPosition = part.Position if not character then continue end local humanoidRootPart = character:WaitForChild("HumanoidRootPart") if not humanoidRootPart then continue end local humanoidRootPartPosition = humanoidRootPart.Position local distanceBetweenPlayerAndPart = (humanoidRootPartPosition - partPosition).Magnitude print(distanceBetweenPlayerAndPart) local damage = 100 - 1.5 * distanceBetweenPlayerAndPart if target:IsDescendantOf(plr.Character) then print("Cant KYS") else if target.Parent:FindFirstChild("Humanoid") then if damage > 0 then target.Parent.Humanoid.Health -= damage print(target.Parent, "Got shot for", damage, "Health") else print("Too far away to hit, try a gun with longer range") end else end end end end) end) this is a assosiated local script named "local" local mouse = game.Players.LocalPlayer:GetMouse() local guy = game.Players.LocalPlayer.Name mouse.Button1Down:Connect(function() script.Parent.Shot:FireServer(mouse.Target) script.Parent.Fall:FireServer(guy) end) both scripts as well as their remote events are children of a tool which is a child of the starterpack From my testing the further away part of the script does not seem to affect the weird damage mechanic. When you hit a damageable rig the damage does not reset but keeps increasing 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…
has title: Every mouse click makes the damage script play one additional more time
has answer: http://stackoverflow.com/a/78575707

http://stackoverflow.com/comment/138536975
comment on: http://stackoverflow.com/a/78581029
type: AnswerComment
has text: 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.
type: Comment
score: 0

http://stackoverflow.com/a/78575716
score: 3
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78575579
answers question: http://stackoverflow.com/q/78575579
has body: usedist is local to within the if block where you defined it. Declare it in front of it in order to be able to access it later, like this. local usedist if units == meters then usedist = distance elseif units == kilometers then usedist = distance * hundred else
upvote count: 3

http://stackoverflow.com/q/78578434
type: AnsweredQuestion
has body: For any number, the Carmichael function returns 0 no matter what the input n is. function gcd(a, b) if b == 0 then return a else return (gcd(b,a%b)) end end function carmichael(n) coprimes = {} for i = 1,n-1 do if gcd(i,n) == 1 then table.insert(coprimes,i) end end k = 0 while true do for counter = 1,#coprimes do coprime = coprimes[counter] if (coprime^k)%n ~= 1 then break else return k end k = k+1 end end end input = io.read() print(carmichael(tonumber(input)))
linked to: http://stackoverflow.com/q/47761383
has comment: http://stackoverflow.com/comment/138536577
downvote count: 1
type: Question
tagged with: math
favorite count: 0
has comment: http://stackoverflow.com/comment/138535611
has comment: http://stackoverflow.com/comment/138537519
has answer: http://stackoverflow.com/a/78581428
accepted answer: http://stackoverflow.com/a/78581428
upvote count: 0
has comment: http://stackoverflow.com/comment/138537054
score: -1
has comment: http://stackoverflow.com/comment/138535525
has comment: http://stackoverflow.com/comment/138535566
tagged with: greatest-common-divisor
answer count: 1
has title: Carmichael function not incrementing k
has comment: http://stackoverflow.com/comment/138535578
tagged with: lua

http://stackoverflow.com/a/78563709
score: 1
has body: To get the exact functionality you want, you could use RemoteEvents and RemoteFunctions to send and reiceve data from the server. Try something like this. Create a RemoteFunction in ReplicatedStorage called "Action" In a script, use local Response = game.ReplicatedStorage.Action:InvokeServer() to ask the server to send you information On the server, use the lines game.ReplicatedStorage.Action.OnServerInvoke = function() return gearManagement.CheckForViewableInventory(player) end This will get the information on the server and send it to the client.
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/78562731

terminal
tags question: http://stackoverflow.com/q/78575307
tag name: terminal
type: Tag
tags question: http://stackoverflow.com/q/78828662
tags question: http://stackoverflow.com/q/79059064
tags question: http://stackoverflow.com/q/79417967
tags question: http://stackoverflow.com/q/79484591

http://stackoverflow.com/a/78496354
accepted answer of: http://stackoverflow.com/q/78495314
score: 1
upvote count: 1
has body: The implicit_figures 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: ![](./image.png){ .center width=200px } Also note that the Lua code to check for a class should be updated: function Image (elem) if elem.classes:includes "center" then return { pandoc.RawInline('latex', '\\hfill\\break{\\centering'), elem, pandoc.RawInline('latex', '\\par}') } end end
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/78495314
type: Answer
downvote count: 0

http://stackoverflow.com/comment/138501854
comment on: http://stackoverflow.com/q/78561649
type: QuestionComment
has text: 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.
type: Comment
score: 1

http://stackoverflow.com/q/78481795
score: 2
linked to: http://stackoverflow.com/q/78587689
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78483612
downvote count: 1
linked to: http://stackoverflow.com/q/2164827
answer count: 1
has comment: http://stackoverflow.com/comment/138360623
favorite count: 0
has title: Java FFM, how to link a java object with a C struct?
has body: I'd like to know how I can "link" a C struct to an object in Java with the FFM library. I 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 "Player" 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. I'd like for the player to remain accessible as long as it hasn't been explicitly freed 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
tagged with: http://stackoverflow.com/tag/c
tagged with: lua
upvote count: 3
type: Question
accepted answer: http://stackoverflow.com/a/78483612
tagged with: java-ffm
tagged with: java

http://stackoverflow.com/q/78561649
downvote count: 1
tagged with: luau
has comment: http://stackoverflow.com/comment/138501849
upvote count: 3
has comment: http://stackoverflow.com/comment/138501844
tagged with: roblox
type: Question
has comment: http://stackoverflow.com/comment/138501854
has comment: http://stackoverflow.com/comment/138505142
tagged with: lua
has title: Roblox Physics Calculation Lag
has comment: http://stackoverflow.com/comment/138502333
tagged with: physics
has body: 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. 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? Code that causes parts to be flung: part:BreakJoints() part:ApplyImpulse(((part.Position - explosion.Position).Unit * BLAST_FORCE.Value * part:GetMass()))
tagged with: lag
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/78579921
score: 2
has comment: http://stackoverflow.com/comment/138501799
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/78579921

http://stackoverflow.com/q/78575468
tagged with: latex
tagged with: lua
has body: Premise: I know the pandoc-eqnos 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. Having said that, the objective of this filter is to extract the equation 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. All MWE stuffs: .tex file \documentclass{article} \usepackage{amsmath} \usepackage{mathtools} \usepackage{blindtext} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{siunitx} \usepackage{graphicx} \usepackage{stix2} \usepackage{microtype} \usepackage{pifont} \title{Sections and Chapters} \author{Overleaf} \date{\today} \begin{document} \maketitle \tableofcontents \section{Introduction} This is the first section. \begin{equation} \underset{\mathrm{Einstein}}{E} = mc^2 \end{equation} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent imperdiet mi nec ante. Donec ullamcorper, felis non sodales commodo, lectus velit ultrices augue, a dignissim nibh lectus placerat pede. Vivamus nunc nunc, molestie ut, ultricies vel, semper in, velit. Ut porttitor. Praesent in sapien. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis fringilla tristique neque. Sed interdum libero ut metus. Pellentesque placerat. Nam rutrum augue a leo. Morbi sed elit sit amet ante lobortis sollicitudin. Praesent blandit blandit mauris. Praesent lectus tellus, aliquet aliquam, luctus a, egestas a, turpis. Mauris lacinia lorem sit amet ipsum. Nunc quis urna dictum turpis accumsan semper. \end{document} Lua filter: local file = "C:/Logs/test.tex" function all_trim(s) return s:match("^%s*(.-)%s*$") end function file_exists(name) local f = io.open(name, "r") if f ~= nil then io.close(f) return true else return false end end function get_line(filename, line_number) local i = 0 …
type: UnansweredQuestion
tagged with: math
has title: pandoc and LaTeX: importing equation labels
has answer: http://stackoverflow.com/a/78577130
tagged with: pandoc
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/docx
type: Question

http://stackoverflow.com/q/78588093
tagged with: roblox
tagged with: roblox-studio
has title: Getting over the roblox leaderstats intvalue limit
has answer: http://stackoverflow.com/a/78590619
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138550524
score: 0
has body: 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 "100k" 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.
tagged with: lua
type: Question

http://stackoverflow.com/comment/138501844
score: 1
type: Comment
has text: 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?
type: QuestionComment
comment on: http://stackoverflow.com/q/78561649

http://stackoverflow.com/q/78472564
has comment: http://stackoverflow.com/comment/138343969
answer count: 1
accepted answer: http://stackoverflow.com/a/78472844
favorite count: 0
has body: 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. This is the kind of table I'm talking about – the string currently looks something like this: { Item1 = InstanceInput { Name = "Name", SourceOp = "SourceOp", }, Item2 = InstanceInput { Name = "Name", SourceOp = "SourceOp", } } 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 "userdata" and I tried that, but it returned it as nil. I have tried to use the pretty.read() function. But I cannot use utils due to the way Davinci Resolve handles require.
type: AnsweredQuestion
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/78472844
tagged with: lua
tagged with: lua-table
type: Question
has title: How can I convert a String that is formatted like a table, into a table?
score: 2
tagged with: string
upvote count: 2

http://stackoverflow.com/q/78539465
tagged with: roblox-studio
type: UnansweredQuestion
has body: 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 Place Unit, 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: -- Get unit model from ReplicatedStorage local unit_name = "Noob" local unit = game:GetService("ReplicatedStorage")["Unit Models"][unit_name]:Clone() unit.Parent = game:GetService("Workspace") local offset = 5 current_position = CFrame.new() script.Parent.MouseButton1Click:Connect(function() local Mouse = game:GetService("Players").LocalPlayer:GetMouse() local lastMousePosition = Mouse.Hit.Position -- Update position function local function updateTowerPosition() local ray = Ray.new(Mouse.UnitRay.Origin, Mouse.UnitRay.Direction * 1000) local hitPart, hitPosition = game.Workspace:FindPartOnRay(ray, game.Workspace.Terrain, false, true) if hitPosition then current_position = CFrame.new(hitPosition) * CFrame.new(0, offset, 0) unit:SetPrimaryPartCFrame(current_position) end end -- Initial tower placement updateTowerPosition() local render_event render_event = game:GetService("RunService").RenderStepped:Connect(function() local currentMousePosition = Mouse.Hit.Position if currentMousePosition ~= lastMousePosition then updateTowerPosition() lastMousePosition = currentMousePosition end end) Mouse.Button1Down:Once(function() render_event:Disconnect() unit:Destroy() game.ReplicatedStorage.Place:FireServer(uni…
tagged with: game-development
score: 0
type: Question
tagged with: luau
answer count: 0
tagged with: lua
has title: Roblox Tower Placement System Causes Towers to Jump and Float
tagged with: roblox

http://stackoverflow.com/comment/138444546
comment on: http://stackoverflow.com/q/78527999
type: Comment
score: 2
has text: Also, use a table instead of a chain of ifs.
type: QuestionComment

http://stackoverflow.com/comment/138455339
has text: 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
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78535770
type: QuestionComment

http://stackoverflow.com/q/78566604
tagged with: luaj
has answer: http://stackoverflow.com/a/78568480
tagged with: java
has title: Input from user in Luaj
score: 3
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0
has body: How can I get user input for io.read()? As I saw on GitHub, in Globals.java there is this code: public InputStream STDIN = null; So I tried: Globals globals = JsePlatform.standardGlobals(); globals.STDIN = System.in; globals.load(new JseBaseLib()); globals.load(new PackageLib()); globals.load(new OsLib()); LuaValue chunk = globals.load("a=io.read(); print(a)"); chunk.call(); But it did not work.
accepted answer: http://stackoverflow.com/a/78568480
tagged with: lua
upvote count: 3
type: Question

http://stackoverflow.com/a/78614779
score: 0
type: Answer
has body: Ivo is correct. Here are some tools for you. FYI, you can use luacheck to find the error: $ luacheck so-1.lua so-1.lua:10:7: variable hundred is never set so-1.lua:13:11: unused variable usedist so-1.lua:15:11: unused variable usedist so-1.lua:20:7: accessing undefined variable usedist so-1.lua:21:20: accessing undefined variable usedist You can also use Penlight strict to find the error: $ lua -l pl.strict so-1.lua enter speed(m/s):12 enter distance needed:34 specify((m) or(km)):m lua: so-1.lua:20: variable 'usedist' is not declared stack traceback: [C]: in function 'error' /home/anonymous/.luarocks/share/lua/5.3/pl/strict.lua:96: in metamethod 'index' so-1.lua:20: in main chunk [C]: in ?
answers question: http://stackoverflow.com/q/78575579

http://stackoverflow.com/comment/138462068
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78539500
has text: 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.
type: QuestionComment

http://stackoverflow.com/comment/138344569
type: AnswerComment
comment on: http://stackoverflow.com/a/78472844
type: Comment
has text: @AsherRoland would you mind updating the question with the full snippet of code just so I can see what you mean?
score: 0

http://stackoverflow.com/q/78567813
type: Question
favorite count: 0
upvote count: 4
has comment: http://stackoverflow.com/comment/138645226
has body: I am making a building system for my game, for which I need to make a clamping function. 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. 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. I am thinking about: getting the hit position relative to the baseplate clamping that position along x and z so that the max value is (baseplateSize-(partSize/2)) This would work, but only if the part couldn´t rotate, and even so could work on only most sides. My current progress: function clamp(hit,obj:Model) local part = obj.PrimaryPart local partSize = part.Size/2 local partFront = part.CFrame.LookVector local partBack = -partFront local partRight = part.CFrame.RightVector local partLeft = -partRight local plateFront = platePart.CFrame.LookVector local plateBack = -plateFront local plateRight = platePart.CFrame.RightVector local plateLeft = -plateRight return CFrame.new() end (I really don´t know how to write proper StackOverflow questions, please ask me for more context/information if needed)
has comment: http://stackoverflow.com/comment/138534323
has title: Clamp a part within bounds (Roblox)
tagged with: roblox
downvote count: 0
has answer: http://stackoverflow.com/a/78639633
accepted answer: http://stackoverflow.com/a/78639633
tagged with: lua
type: AnsweredQuestion
answer count: 1
score: 4

http://stackoverflow.com/comment/138525238
score: 0
has text: 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.
comment on: http://stackoverflow.com/q/78567841
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/138454607
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78532917
type: Comment
has text: Why has it passed a pointer?

http://stackoverflow.com/q/78572397
answer count: 0
has comment: http://stackoverflow.com/comment/138525874
downvote count: 0
tagged with: haproxy
tagged with: oauth
tagged with: lua
has body: I need to support CORS between a react js application on http://localhost:3000 and an 'api gateway" proxy server(HAProxy here) on ex: http://localhost:8081. I'm able to successfully configure CORS on HAProxy, using the latest cloned lua library at: https://github.com/haproxytech/haproxy-lua-cors by following the configuration in the HAProxy CORS blog post: https://www.haproxy.com/blog/enabling-cors-in-haproxy The preflight OPTIONS request appears to be successful. I would also like for my HAProxy config file to support JWT validation. I followed the configuration to validate JWT's using the HAProxy-provided syntax(without lua) by following the blog post: https://www.haproxy.com/blog/verify-oauth-jwt-tokens-with-haproxy 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 "Access-Control-Allow-Origin" header is not included in that 403 error response, and so the browser displays a CORS origin error: 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..... This is happening after a successful preflight OPTIONS request. I tried to set the Access-Control-Allow-Origin header on the response - in a separate server block as directed below: https://serverfault.com/questions/1136690/adding-custom-headers-on-error-responses-from-haproxy The header did not come through however in the response. Is there a way to support JWT validation and CORS together - with HAProxy?
type: UnansweredQuestion
score: 1
upvote count: 1
has title: Can HAProxy support JWT validation and CORS together?
favorite count: 0
tagged with: cors
type: Question
tagged with: jwt

http://stackoverflow.com/a/78567907
accepted answer of: http://stackoverflow.com/q/78567852
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/138512952
has body: If control reaches the end of a function without encountering a return statement, the function implicitly returns nothing. As the syntax for if requires a single expression, the zero-length multires expression of nothing is adjusted to a single nil value. In a control structure (if, while, repeat), a condition expression equal to nil tests false (conversely, not nil is true). See Lua 5.4: 2.1 – Values and Types 3.3.4 – Control Structures 3.4.11 – Function Definitions 3.4.12 – Lists of expressions, multiple results, and adjustment
answers question: http://stackoverflow.com/q/78567852
has comment: http://stackoverflow.com/comment/138512813
score: 6

http://stackoverflow.com/a/78469187
downvote count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/138342249
accepted answer of: http://stackoverflow.com/q/78469058
answers question: http://stackoverflow.com/q/78469058
has body: Semantics I've read you can start an "array" at any index in Lua Yes, Lua tables are associative arrays. Almost any key is fine; only not-a-number and nil are not allowed as keys. So {[-1] = 1, [-2] = 2, [-3] = 3} is as valid a Lua table as {[1.5] = 1, [2.5] = 2, [3.5] = 3}. How you "number" 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. but "ipairs" seems to only work if it starts at 0. At 1. But it's easy to write a version of ipairs which starts at 42 (or 0): local function inext42(t, i) i = i + 1 local v = t[i] if v == nil then return end return i, v end function ipairs42(t) return inext42, t, 41 end for i, v in ipairs42({[42] = 1, [43] = 2, [44] = 3}) do print(i, v) end (you could even override the built-in ipairs, but that's almost always a bad idea, since it will break third-party code) Similarly, you could implement variants for other standard library functions adhering to your indexing conventions, often in terms of the original functions. Memory usage So my question is, do s and t use "3 words" to store the 3 values internally as a sequence, or more(4/6), bc part/whole is stored as a "mapping" instead? This question is, strictly speaking, not a "Lua" 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. Yes, PUC Lua, and LuaJIT, separately store a "list" ("sequence") part and a "hash" ("mapping") part. This is necessary to make lists fast and memory-efficient. (Beware: The "list" part does not need to store a sequence. It may have holes, for example; only at some point, …
score: 3
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/138477020
comment on: http://stackoverflow.com/a/78491796
type: AnswerComment
type: Comment
has text: 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.
score: 0

sysbench
tags question: http://stackoverflow.com/q/78504603
tag name: sysbench
type: Tag

http://stackoverflow.com/q/78527612
upvote count: 0
linked to: http://stackoverflow.com/q/73765388
tagged with: roblox
tagged with: lua
type: UnansweredQuestion
favorite count: 0
has title: How do I turn Part's CanCollide off for only one player(specific player)?
has body: 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 "Clicks" in leaderstats, and when you have a certain amount of clicks, you get should be able to get access through the wall
answer count: 1
has answer: http://stackoverflow.com/a/78606774
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/138443989
type: Question
has comment: http://stackoverflow.com/comment/138442542

http://stackoverflow.com/a/78465144
answers question: http://stackoverflow.com/q/78464991
score: 1
upvote count: 1
has body: By default, LocalScripts will not run under workspace (unless in the character), to resolve this problem you can either: Move the LocalScript into StarterPlayerScripts Convert the LocalScript into a Script and change the RunContext to Client See: https://devforum.roblox.com/t/live-script-runcontext/1938784
accepted answer of: http://stackoverflow.com/q/78464991
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/78543461
tagged with: roblox-studio
score: 0
type: Question
has body: The error: ReplicatedStorage.Modules.Drops:35: attempt to index nil with 'Position' The line: if (Character.PrimaryPart.Position - Drop.PrimaryPart.Position).Magnitude &lt; 10 and Drop.CanCollect.Value == true then so this is the problem and since there is 2 positions i do not know with witch one is the issue. 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.
has title: Attempt to index nil with position drops
has answer: http://stackoverflow.com/a/78547772
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138472805
tagged with: lua
answer count: 1
has comment: http://stackoverflow.com/comment/138468931

http://stackoverflow.com/comment/138472944
has text: I cannot follow. Could some client-side (JS) code solve your problem?
type: Comment
comment on: http://stackoverflow.com/q/78531833
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138430506
type: AnswerComment
has text: Or [RFC 9051 section 6.4.4](https://datatracker.ietf.org/doc/html/rfc9051#section-6.4.4-15.12).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78491796

http://stackoverflow.com/q/78585507
type: Question
downvote count: 0
score: 3
tagged with: lua
has answer: http://stackoverflow.com/a/78585569
accepted answer: http://stackoverflow.com/a/78585569
upvote count: 3
has title: Lua non-greedy version of +
tagged with: lua-patterns
type: AnsweredQuestion
has body: I have to match /home/user/file.lib both in bibliography: /home/user/file.lib as well as bibliography: "/home/user/file.lib" in Lua. The best I came up with is: > s1 = "bibliography: /home/user/file.lib" > s2 = 'bibliography: "/home/user/file.lib"' > string.match(s1, 'bibliography: "?(%g+)"?') /home/user/file.lib > string.match(s2, 'bibliography: "?(%g+)"?') /home/user/file.lib" But the last match contain a trailing ". It looks like I need a non-greedy version of the + operator, and it looks like Lua doesn't have it. How can I achieve my purpose?
answer count: 1
favorite count: 0

http://stackoverflow.com/q/78506536
has body: The following scripts return the same error "Invalid spell slot in GetSpellCooldown" /script print(GetSpellCooldown(10335, "spell")) The id '20216' is the id of 'Holy Strike' in turtle wow: https://database.turtle-wow.org/?spell=10335 The above scriptlet works if I use the id for 'Divine Shield': /script print(GetSpellCooldown(1020, "spell")) I must be missing something obvious: https://wowwiki-archive.fandom.com/wiki/API_GetSpellCooldown
type: Question
accepted answer: http://stackoverflow.com/a/78506634
tagged with: lua
answer count: 1
has answer: http://stackoverflow.com/a/78506634
has title: Warcraft Lua 1.12 (Turtle Wow) GetSpellCooldown doesn't work
type: AnsweredQuestion
score: 0

http://stackoverflow.com/q/78513980
has answer: http://stackoverflow.com/a/78514915
has body: 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: add_rules("mode.debug", "mode.release") add_requires("lua") target("Elevated") set_kind("binary") add_packages("lua") add_files("src/*.c") and in my /src I have main.c file while .lua scripts are in, let's say /engine dir. Build succeeds with this main.c: #include <lauxlib.h> #include <lua.h> #include <lualib.h> #include <stdio.h> #include <stdlib.h> int main(void) { lua_State *L = luaL_newstate(); luaL_openlibs(L); luaL_dofile(L, "engine/main.lua"); return 0; } 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.
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
score: 2
tagged with: lua
upvote count: 2
type: AnsweredQuestion
has title: xmake setup for a simple app with lua scripting
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/78514915
type: Question
tagged with: xmake

http://stackoverflow.com/comment/138428235
has text: Why do you add `.so` (Linux) file type extension to `package.cpath` on Windows?
comment on: http://stackoverflow.com/q/78520444
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/138568321
has text: Adaptive Timesteping definitely improved things! A structure that used to take around 2 minutes to fall is now falling in around 10-30 seconds!
type: AnswerComment
comment on: http://stackoverflow.com/a/78579921
type: Comment
score: 0

http://stackoverflow.com/a/78537534
downvote count: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78529693
upvote count: 2
accepted answer of: http://stackoverflow.com/q/78529693
score: 2
has body: The TextMate Language Pack provides syntax highlighting for Lua (see here) and for other languages and formats. It can be installed via Help &gt; Install New Software... working with the update site https://download.eclipse.org/tm4e/releases/latest/. Please note that the Lua Development Tools (LDT) which provides better support for Lua is currently looking for new contributors/committers. Otherwise it is likely to be archived soon.

http://stackoverflow.com/comment/138462108
comment on: http://stackoverflow.com/a/78491796
type: Comment
score: 0
type: AnswerComment
has text: "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.

http://stackoverflow.com/comment/138539888
comment on: http://stackoverflow.com/q/78582469
type: QuestionComment
has text: 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.
score: 1
type: Comment

http://stackoverflow.com/comment/138526806
comment on: http://stackoverflow.com/q/78575579
type: Comment
score: 0
has text: It still doesn't work
type: QuestionComment

http://stackoverflow.com/comment/138456743
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78529693
has text: Worked... thanks. Don´t you want to create a answer so I can accept it ?
type: Comment

http://stackoverflow.com/q/78470963
type: UnansweredQuestion
tagged with: nix
tagged with: neovim
has title: debugging configuration of dap in nvim for typescipt projects
score: 0
answer count: 0
tagged with: lua
type: Question
has body: I am currently unable to find a debbugging configuration for ndap that works for my setup. The typescript setup is straight forward. tsc transpiles to the /dist folder and the entry point is the dist/index.js file 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 <-> debugger connection works without a problem. However if I try typescript the application just runs through without hitting any breakpoints. My 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) -- ... local js_based_languages = { "typescript", "javascript", "vue" }; dap_vscode_js.setup({ adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' } }) -- DEBUG CONFIG for _, language in ipairs(js_based_languages) do dap.configurations[language] = { { type = "pwa-node", request = "launch", name = "new launch", program = "index.js", cwd = "''${workspaceFolder}/dist", }, -- ... } end -- ... I also worked with program being *dist/index.js" 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.
has comment: http://stackoverflow.com/comment/138351380
tagged with: debugging

http://stackoverflow.com/q/78532534
type: Question
has body: This is my module script: local phases = {} local function getRoleAssignments(playersToAssignRoles, roles) --Assigns a random player to each role then removes player from list so player can't get two roles. --Not every role will be assigned if not enough players for role, _ in pairs(roles) do local player = nil if 0 &lt; #playersToAssignRoles then player = playersToAssignRoles[math.random(1,#playersToAssignRoles)] end roles[role] = player table.remove(playersToAssignRoles,table.find(playersToAssignRoles,player)) end return roles end function phases.loadGame(players, roles) local map = getRandomMap() print(players) --Prints a full table (just one player because just me testing) local roleAssignments = getRoleAssignments(players, roles) print(players) --Prints an empty table end This is how I've implemented it in my main script. local playersPlaying = Players:GetPlayers() roles = Phases.loadGame(playersPlaying, roles) The players table became empty after calling getRoleAssignments(players, roles) 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 players table is empty after I called the function shown by the print statement when ran. I expect the players table to retain its data. I've tried to making sure the identifiers are not the same which did not work. I've tired storing the players table in a separate local variable and passing that into the function instead, it did not work. Not calling the function does result in the players table retain its data though.
tagged with: lua
has answer: http://stackoverflow.com/a/78532917
type: AnsweredQuestion
tagged with: lua-table
has title: Roblox Studio Lua: Variable changing without being referenced
answer count: 1
accepted answer: http://stackoverflow.com/a/78532917
tagged with: roblox-studio
score: 0

public
type: Tag
tags question: http://stackoverflow.com/q/78539500
tag name: public

http://stackoverflow.com/a/78568480
downvote count: 0
answers question: http://stackoverflow.com/q/78566604
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78566604
score: 1
has body: 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: Globals globals = JsePlatform.standardGlobals(); LuaValue chunk = globals.load("a=io.read(); print(a)"); chunk.call(); The reason it's not working for you is that there was a bug in LuaJ 3.0.2, fixed by commit 14745ba76a10 ("Fix call io.read, file:read without params."). 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 pull request #113), or work around the problem by doing io.read('*l') instead of io.read().
upvote count: 1

http://stackoverflow.com/comment/138430556
score: 0
type: AnswerComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/78491796

http://stackoverflow.com/a/78520786
upvote count: 0
has comment: http://stackoverflow.com/comment/138457549
answers question: http://stackoverflow.com/q/78520444
has comment: http://stackoverflow.com/comment/138429041
has comment: http://stackoverflow.com/comment/138446467
has body: When it says "index a nil value", 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, thing["index"] and thing.index. I highly suspect that you are running into an unused global variable somewhere, which default to nil. It might not be in the code you posted, I can't find any issue with globals directly. The only globals you use here are package and require. Maybe your Lua runtime is missing one of those. Try to print(package, require) and see if you see the word nil printed anywhere then you are missing one of those. The other option is that npairs or cond is nil. This would be a problem with the nvim-autopairs library. Either way you should check for things being nil whenever you get this error.
score: -1
type: Answer
has comment: http://stackoverflow.com/comment/138475834
has comment: http://stackoverflow.com/comment/138476147
downvote count: 1

http://stackoverflow.com/comment/138390287
score: 0
comment on: http://stackoverflow.com/q/78498658
type: QuestionComment
type: Comment
has text: What is the error you are getting?

http://stackoverflow.com/a/78563234
accepted answer of: http://stackoverflow.com/q/78563147
has comment: http://stackoverflow.com/comment/138541249
answers question: http://stackoverflow.com/q/78563147
upvote count: 2
has comment: http://stackoverflow.com/comment/138504845
has comment: http://stackoverflow.com/comment/138504826
downvote count: 0
has comment: http://stackoverflow.com/comment/138511896
type: AcceptedAnswer
type: Answer
has body: The docs specify that metadata is process after blocks have been filtered, so target_lang is set only after the CodeBlock elements have been processed. There are two ways to deal with this. One method is to filter the main Pandoc element, which gives more control: function Pandoc (doc) local target_lang = doc.meta.target_lang return doc:walk { CodeBlock = function (cb) if cb.classes[1] ~= target_lang then return {} -- delete block end end } end The alternative is to control the execution order of the filters by explicitly returning a sequence of filters, like so: return { { Meta = Meta}, { CodeBlock = CodeBlock }, }
has comment: http://stackoverflow.com/comment/138519231
score: 2

http://stackoverflow.com/comment/138519606
has text: @JBGruber, wow, nice! Happy to help :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78564793
type: Comment

http://stackoverflow.com/q/78575579
possible better answer: http://stackoverflow.com/a/78614779
upvote count: 0
has answer: http://stackoverflow.com/a/78575716
has title: If statement returns nil
has answer: http://stackoverflow.com/a/78614779
score: -1
tagged with: lua
downvote count: 1
favorite count: 0
has body: 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. io.write("enter speed(m/s):") local speed = io.read() io.write("enter distance needed:") local distance = io.read() io.write("specify((m) or(km)):") local units = io.read() local meters = "m" local kilometers = "km" local hundred if units == meters then local usedist = distance elseif units == kilometers then local usedist = distance * hundred else io.write("you did not enter a valid character, please restart the program by pressing 'enter'") io.read() end print(usedist) local timeneeded = usedist / speed local timeneededh = timeneeded / 3600 os.execute("cls") io.write("it will need "..timeneeded.." seconds or "..timeneededh.." hours") io.write("\n") io.write("press the 'enter' key to continue") io.read() I was expecting a value of time in seconds but I got this enter speed(m/s):5 enter distance needed:9 specify((m) or(km)):km C:\Lua\lua54.exe: object-time-calc.lua:15: attempt to mul a 'string' with a 'nil' stack traceback: [C]: in metamethod 'mul' object-time-calc.lua:15: in main chunk [C]: in ?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138526806
answer count: 2
accepted answer: http://stackoverflow.com/a/78575716
tagged with: physics
has comment: http://stackoverflow.com/comment/138526705
type: Question

postgresql
tag name: postgresql
tags question: http://stackoverflow.com/q/78587137
type: Tag

http://stackoverflow.com/a/78579921
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/138568321
upvote count: 1
has body: 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. 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. One way you can improve the performance of physics is to use Adaptive Timestepping which improves performance of physics by changing the physics frequency of specific physics calculations. 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 "solver islands" by varying their simulation timestep, with an emphasis on 60 Hz for best performance. However, parts that are "harder" to solve will use a faster timestep like 240 Hz to ensure physical stability. It is also important to note that adaptive timestepping isn't always suitable if you want accuracy on your explosions or physics. 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: Experiences that require highly accurate simulations and stability, such as racing games, "destruction" simulations, or games featuring complex mechanisms like tanks. Another optimization you can perform is to set the FallenPartsDestroyHeight 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. 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 …
accepted answer of: http://stackoverflow.com/q/78561649
downvote count: 0
answers question: http://stackoverflow.com/q/78561649
score: 1
has comment: http://stackoverflow.com/comment/138568280

http://stackoverflow.com/q/78466371
tagged with: torch
has body: 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. The way I use it location / { content_by_lua_block { require 'torch' } } Error 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' stack traceback: coroutine 0: [C]: in function 'require' content_by_lua(/etc/nginx/conf.d/default.conf:23):2: in main chunk, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "127.0.0.1" 127.0.0.1 - - [10/May/2024:17:10:42 +0000] "GET / HTTP/1.1" 500 128571 "-" "curl/7.81.0" Installation via luarocks git clone https://github.com/torch/cwrap.git cd cwrap luarocks make rocks/cwrap-scm-1.rockspec luarocks install --server=https://luarocks.org/dev torch Manual installation ('./install.sh' is omitted) FROM openresty/openresty:jammy RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y git sudo software-properties-common python3-pip RUN pip3 install ipython RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ubuntuhandbook1/ppa && \ DEBIAN_FRONTEND=noninteractive apt-get update && \ apt-get install -y qt4-dev-tools libqt4-dev libqtcore4 libqtgui4 RUN git clone https://github.com/torch/distro.git ~/torch --recursive WORKDIR root/torch RUN sed -i 's/python-software-properties/software-properties-common/g' install-deps RUN sed -i 's/unzip gnuplot gnuplot-x11 ipython/unzip gnuplot gnuplot-x11/g' ./install-deps RUN ["/bin/bash", "install-deps"]
score: 0
type: Question
answer count: 0
tagged with: lua
has title: Openresty + Torch. Is it even possible?
tagged with: openresty
type: UnansweredQuestion

http://stackoverflow.com/q/78504603
type: UnansweredQuestion
has title: Sysbench Fails with mysql_stmt_execute Error Despite Successful Manual Query Execution via Mycat()
tagged with: sysbench
score: 0
type: Question
tagged with: mysql
answer count: 0
tagged with: lua
has body: I am attempting to run a read-only Sysbench benchmark against a Mycat instance (acting as a distributed database middleware), using the command: 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 when I debug with Mycat, it goes well and got the Result Set successfully. But sysbench went wrong, print error info: Threads started! FATAL: mysql_stmt_execute() returned error 0 () for query 'SELECT c FROM sbtest3 WHERE id BETWEEN ? AND ?' FATAL: `thread_run' function failed: ./oltp_common.lua:432: SQL error, errno = 0, state = '00000': ** Curiously, the reported SQL error state ('00000') usually denotes a successful operation in MySQL context, adding to the confusion. so I replace MyCat with a real MySql server, and everthing went well and I got the sysbench stats; what's wrong ? Environment Details: Sysbench Version: [1.0.20] Mycat Version: [1.6.7.6] 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. thanks

http://stackoverflow.com/q/78581627
tagged with: cryptography
has title: Why is my key size generated from rsaKeygen() always 19?
type: AnsweredQuestion
tagged with: pkcs
type: Question
tagged with: padding
tagged with: lua
has body: When running the rsaKeygen() function, the key it makes is always length 19, and increasing the size of the p and q generation ranges causes the program to hang. Code: function rsaKeygen() p = math.random(50000,100000) while not isprime(p) do p = math.random(1,1000) end q = math.random(1,1000) while not isprime(q) do q = math.random(50000,100000) end local n = p*q totientN = carmichael(n) e = 2^16+1 local d = 1%totientN/e p,q,totientN = nil,nil,nil return e,d,n end I have tried to increase the ranges for p and q, however that causes the program to hang, and in my pkcs1_v1_5_pad(message,key_size) function, 19 is not a long enough key to work for any reasonable-sized plaintext. pkcs function: function pkcs1_v1_5_pad(message,key_size) print(key_size) local block_size = key_size/8 local message_length = #message local padding_length = block_size - message_length - 3 if padding_length < 0 then error("Message is too long for the given key size") end local padding = string.rep("\x00",padding_length) local padded_message = string.char(0x00)..string.char(0x02)..padding..string.char(0x00)..message return padded_message end
tagged with: key-generator
score: 0
has answer: http://stackoverflow.com/a/78581915
answer count: 1
accepted answer: http://stackoverflow.com/a/78581915

http://stackoverflow.com/comment/138305340
score: 0
type: Comment
has text: Thank you very much, it works perfect. This is a good start point to continue with my project
comment on: http://stackoverflow.com/a/78449356
type: AnswerComment

http://stackoverflow.com/comment/138537519
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78578434
has text: @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

http://stackoverflow.com/q/78531655
tagged with: roblox
has comment: http://stackoverflow.com/comment/138451848
tagged with: roblox-studio
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138479420
score: 0
has title: UI Tween incorrect Positioning, Luau Roblox Studio Ui
tagged with: user-interface
has body: 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. Here's my entire code of this part of the issue. local SGUI = game.StarterGui local frame = SGUI.ScreenGui.Background.OutlineFrame.InnerFrame local theDock = frame.Parent.Parent.PlayerDock local thePawn = theDock.Player1 local currentBoxOfPawn = thePawn.CurrentBox.Value local ts = game:GetService("TweenService") local isMoving = thePawn.Moving if isMoving.Value then return end if currentBoxOfPawn == "000" then currentBoxOfPawn = "001" local oldPos = thePawn.Position local oldSize = thePawn.Size isMoving.Value = true thePawn.Visible = false local newPawn = thePawn:Clone() newPawn.Visible = true newPawn.Parent = frame.Parent.Parent -- Set to frame.Parent to keep it visible local function getAbsolutePositionAndSize(guiObject) local absPos = guiObject.AbsolutePosition local absSize = guiObject.AbsoluteSize return UDim2.new(0, absPos.X, 0, absPos.Y), UDim2.new(0, absSize.X, 0, absSize.Y) end local oldAbsPos, oldAbsSize = getAbsolutePositionAndSize(thePawn) newPawn.Position = oldAbsPos newPawn.Size = oldAbsSize -- Ensure thePawn is parented to the correct frame local newParent = frame:FindFirstChild(currentBoxOfPawn) if newParent then thePawn.Parent = newParent else isMoving.Value = false return end local newAbsPos, newAbsSize = getAbsolutePositionAndSize(thePawn) local movement = ts:Create(newPawn, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), { Position = newAbsPos, Size = newAbsSize }) movement:Play() movement.Completed:Connect(function() isMoving.Value = false thePawn.Visible = true newPawn:Destroy() end) end To explain, the Checkered is consistent of boxes for each white or black box, aka a frame, and the frame has a UIGridLayout to…
type: Question
tagged with: luau
answer count: 0
tagged with: lua

http://stackoverflow.com/q/78522027
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/57393261
score: 0
has title: Pandoc Lua filter to output only image captions with specific paragraph style
has body: I prepare documents in Markdown to convert via Pandoc to HTML and ICML (InDesign). Exporting Images to InDesign proved to be unpractical. The goal was to write a lua-filter which only returns the caption of the image while preserving the ParagraphStyleRange "Caption". 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 "text-flow". Given a Markdown file with the content ![Caption [(Image: Source)]{custom-style="ImageSource"}](image.jpg) The following lua snippet actually returns only the caption. It also preserves the CharacterStyleRange "ImageSource", but it does not export the ParagraphStyleRange "Caption". function Image(bild) if FORMAT:match 'icml' then -- Only export to icml -- Check if caption is empty if #bild.caption > 0 then return bild.caption end end end This ist what ends up in the ICML-Export. It seems to me that these correspond to two paragraphs, which I do not understand ... Caption (Image: Source) Caption (Image: Source) I tried to put just the line function Image () return {} end in the filter, which should just delete the Image (as I understood from How can I strip figures and table during a pandoc LaTeX to Word conversion?). But still in icml-export I get two ParagraphStyleRange the first of which is now empty. I am confused.
answer count: 0
tagged with: pandoc
tagged with: markdown
type: Question
has comment: http://stackoverflow.com/comment/138460330
tagged with: adobe-indesign
tagged with: lua

http://stackoverflow.com/q/78527999
has comment: http://stackoverflow.com/comment/138440886
has answer: http://stackoverflow.com/a/78535281
type: Question
has title: Lua - "malformed number near"
tagged with: lua
has comment: http://stackoverflow.com/comment/138440922
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138444546
has body: I have the following Lua script and it works fine until I add two decimal points. It errors with "malformed number near '10.7.5'" if event.user_tag2 == "Team1" then event.sid = 10.1 elseif event.user_tag2 == "Team2" then event.sid = 10.4 elseif event.user_tag2 == "Team3" then event.sid = 10.6 elseif event.user_tag2 == "Team4" then event.sid = 10.7 elseif event.user_tag2 == "Team5" then event.sid = 10.7.5 elseif event.user_tag2 == "Team6" then event.sid = 10.3 elseif event.user_tag2 == "Team7" then event.sid = 10.2 elseif event.user_tag2 == "Team8" then event.sid = 10.5 elseif event.user_tag2 == "Team9" then event.sid = 10.9 elseif event.user_tag2 == "Team10" then event.sid = 11.2 elseif event.user_tag2 == "Team11" then event.sid = 10.8 else event.sid = 10.4 end return event Does anyone have any ideas why this is happening? Thanks in advance!
score: 0
answer count: 1

http://stackoverflow.com/comment/138344646
has text: @AsherRoland updated the answer to remove the InstanceInput from the string
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78472844
type: Comment

http://stackoverflow.com/q/78529693
tagged with: lua
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/78537534
has comment: http://stackoverflow.com/comment/138456743
has title: How do I enable syntax highlighting for Lua in Eclipse recent versions (2024-03)?
has body: I´m not being able to find any lua syntax plugins for Eclipse. The only known one is discontinued (LDT - Lua Development Tools). Some people were able to install it using the process described in this page. The problem is DLTK plugin that isn't installed in newer eclipse versions. So some people installed a former version and it worked. When I tried this Eclipse refused installation saying I already had a newer version installed, probably because I'm using WWD that uses it. 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. Anyone knows an Eclipse plugin that has Lua syntax support besides LDT or how can I install LDT in newer Eclipses ?
answer count: 1
has answer: http://stackoverflow.com/a/78537534
tagged with: eclipse-plugin
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138448531
score: 0
type: Question

http://stackoverflow.com/comment/138461285
has text: 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.
score: 2
comment on: http://stackoverflow.com/q/78539500
type: Comment
type: QuestionComment

http://stackoverflow.com/q/78448742
has title: Lua - count multiple occurrences in a string
has body: 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): € [ \ ] ^ { | } ~ E.g. given string: abc€|€]/{def The number I need is 6 With a single char I used: local _, c = addr:gsub(&quot;€&quot;,&quot;&quot;) So that c = 2 And it works perfect. Could someone drive me to implement the count of multiple occurrences in the string?
type: Question
tagged with: lua
has answer: http://stackoverflow.com/a/78449356
accepted answer: http://stackoverflow.com/a/78449356
score: 1
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/138459646
type: AnswerComment
has text: 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'.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78491796

http://stackoverflow.com/comment/138458069
type: AnswerComment
score: 0
has text: ```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.```
type: Comment
comment on: http://stackoverflow.com/a/78491796

http://stackoverflow.com/comment/138466786
type: Comment
comment on: http://stackoverflow.com/q/78539500
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138455754
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78526965
has text: 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
type: Comment

http://stackoverflow.com/comment/138333245
score: 0
comment on: http://stackoverflow.com/a/78463269
type: AnswerComment
has text: 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.
type: Comment

http://stackoverflow.com/comment/138505142
has text: Does setting collision groups fix anything? I thought it just changed the collision properties of the object, not their physics calculations
score: 0
comment on: http://stackoverflow.com/q/78561649
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/138344478
comment on: http://stackoverflow.com/a/78472844
type: Comment
has text: @shingo Yes, but not in davinci https://onecompiler.com/lua/42d4adv3e
score: 0
type: AnswerComment

http://stackoverflow.com/comment/138365985
type: Comment
type: QuestionComment
has text: 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.
score: 0
comment on: http://stackoverflow.com/q/78483956

http://stackoverflow.com/a/78537215
answers question: http://stackoverflow.com/q/78527511
has body: I want mouse button 4 to go from "mouse button 4" to "1." 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. local with_shift function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then with_shift = IsModifierPressed("lshift") if with_shift then PressKey("1") OutputLogMessage("Held\n") else PressMouseButton(4) OutputLogMessage("NOT Held\n") end elseif event == "MOUSE_BUTTON_RELEASED" and arg == 4 then if with_shift then ReleaseKey("1") else ReleaseMouseButton(4) end end end
score: 0
type: Answer

http://stackoverflow.com/comment/138533585
has text: @TheLemon27 i edited my answer, it should be correct now.
type: Comment
comment on: http://stackoverflow.com/a/78567634
type: AnswerComment
score: 0

http://stackoverflow.com/comment/138489425
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/78553437
has text: 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."
score: 1

http://stackoverflow.com/comment/138541791
type: Comment
has text: bigint library, remember?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78582469

http://stackoverflow.com/comment/138477281
score: 0
comment on: http://stackoverflow.com/a/78491796
type: AnswerComment
has text: 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.
type: Comment

http://stackoverflow.com/comment/138519232
type: AnswerComment
has text: I made this into a Quarto extension: https://github.com/JBGruber/quarto-targetlang Thanks again for the help!
comment on: http://stackoverflow.com/a/78564793
score: 1
type: Comment

http://stackoverflow.com/comment/138515844
has text: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78567807

http://stackoverflow.com/q/78481889
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138364297
answer count: 2
tagged with: pandoc
has title: Lua filter for pandoc (with crossref) that extracts a table's label
favorite count: 0
has answer: http://stackoverflow.com/a/78481932
type: Question
upvote count: 1
has body: 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. 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): | First Header | Second Header | |:-------------|:--------------| | Content Cell | Content Cell | | Content Cell | Content Cell | : Table example {#tbl:table1} Secondly, here's my minimal Lua-filter (table.lua) that attempts to extract this label (tbl:table1) from this markdown document: function Table(elem) local id = elem.attr.identifier or '' if id ~= '' then print("Table label: " .. id) else print("Table does not have a label") end end return { { Table = Table } } Thirdly, when I run pandoc from the command prompt, I expect this Lua filter to print "Table label: tbl:table1" in the command prompt window, but instead it prints "Table does not have a label". Here's my command line in the command prompt: pandoc input.md --output=output.tex --from markdown+pipe_tables --to latex --filter pandoc-crossref --lua-filter=table.lua Any help greatly appreciated! By the way, here is my wider Lua filter that (almost successfully) outputs a table rather than a longtable: function Table(tbl) local simpleTable = pandoc.utils.to_simple_table(tbl) local blocks = pandoc.Blocks{} -- Function to create a LaTeX row local function create_latex_row(cells) local latex_row = "" for i, cell in ipairs(cells) do for _, content in ipairs(cell) do latex_row = latex_row .. pandoc.write(pandoc.Pandoc({content}), "latex") end if i < #cells then l…
tagged with: latex
tagged with: lua
score: 1
has answer: http://stackoverflow.com/a/78483927

http://stackoverflow.com/comment/138476147
has text: That doesn't make it a correct statement ;-) You cannot index without an index, end of discussion.
type: Comment
comment on: http://stackoverflow.com/a/78520786
type: AnswerComment
score: 0

http://stackoverflow.com/comment/138344614
score: 0
type: Comment
has text: 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
comment on: http://stackoverflow.com/a/78472844
type: AnswerComment

http://stackoverflow.com/a/78639633
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78567813
has body: I found an easier way to do this. function clamp(obj:Model,cf:CFrame) local part = obj.PrimaryPart local partSize = part.Size/2 local plateSize = platePart.Size/2 local localCf = platePart.CFrame:ToObjectSpace(cf) local _,ry,_ = cf:ToOrientation() local Y = math.deg(ry)+180 if math.round(Y/90)%2 == 0 then maxX = plateSize.X-partSize.X maxZ = plateSize.Z-partSize.Z else maxX = plateSize.Z-partSize.Z maxZ = plateSize.X-partSize.X end local x = math.clamp(localCf.X,-maxX,maxX) local z = math.clamp(localCf.Z,-maxZ,maxZ) local newCf = platePart.CFrame:ToWorldSpace(CFrame.new(x,0.5+partSize.Y,z)) * cf.Rotation return newCf end 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. 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.
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/78567813
upvote count: 2

http://stackoverflow.com/q/78501561
tagged with: roblox-studio
tagged with: game-development
type: UnansweredQuestion
score: 0
has title: Why does my Roblox Ui text label sometimes randomly say "100.00M" instead for the correct variable?
has body: 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 "17" (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.
answer count: 0
tagged with: lua
tagged with: scripting
type: Question

http://stackoverflow.com/q/78567123
answer count: 1
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/78581029
tagged with: pandoc
tagged with: latex
has comment: http://stackoverflow.com/comment/138511990
type: Question
has title: Returning multiple pandoc action in lua filters
tagged with: http://stackoverflow.com/tag/docx
has body: 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. The image, as you know, can be inserted into the .docx file using the pandoc.Para 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 My Minimal Working Example: function RawBlock(el) if string.find(el.text,"\\begin{tikzpicture}") then io.output("C:/Logs/output.tex") io.write("\\documentclass{standalone}", "\n") io.write("\\usepackage{tikz}", "\n") io.write("\\usepackage{pgfplots}", "\n") io.write("\\pgfplotsset{compat=newest}", "\n") io.write("\\usepackage{siunitx}", "\n") io.write("\\begin{document}", "\n") io.write(el.text, "\n") io.write("\\end{document}", "\n") io.close() os.execute("cd C:/Logs & pdflatex output.tex & convert -density 288 output.pdf -alpha off -resize 35% output.png") print(el.content) return pandoc.Para({pandoc.Image({},"C:/Logs/output.png")}) end end
tagged with: lua
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/138511739

raylib
tags question: http://stackoverflow.com/q/78535770
tag name: raylib
type: Tag

http://stackoverflow.com/a/78449356
has comment: http://stackoverflow.com/comment/138305340
upvote count: 3
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/78448742
answers question: http://stackoverflow.com/q/78448742
has body: local _, c = addr:gsub("€","") will give that c = 2 but if we create a group [€] it gives c = 6 because € 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 € to \226\130\172 in both examples. to get an accurate count of the characters as you described it you can to do 2 separate gsub with 2 difference patterns one for chars with 3 bytes and one for single bytes: local str = "abc€|€]/{def" local tripleByteCharPattern = "€" local singleByteCharpattern = "[%[%]/^{|}~]" local count = select(2, str:gsub(singleByteCharpattern, "")) count = count + select(2, str:gsub(tripleByteCharPattern, "")) print(count) 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.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/78567841
has body: I'm trying to script a Roblox game. The aim for now is when I click the "AttractButton" the Object should attract towards player's location and stop 4 studs away. On the other hand, clicking the "RepelButton" 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? This script is in the StarterGui: local Players = game:GetService("Players") local TweenService = game:GetService("TweenService") local CollectionService = game:GetService("CollectionService") local RunService = game:GetService("RunService") local player = Players.LocalPlayer local mouse = player:GetMouse() local controlGui = player:WaitForChild("PlayerGui"):WaitForChild("ControlGui") local attractButton = controlGui:WaitForChild("AttractButton") local repelButton = controlGui:WaitForChild("RepelButton") local attractMode = false local repelMode = false local cooldownTime = 2 local lastInteractionTime = {} local velocity = 10 -- studs per second -- Function to handle the attract button click local function onAttractButtonClick() attractMode = true repelMode = false print("Attract mode enabled") -- Visual feedback for button click attractButton.BackgroundColor3 = Color3.fromRGB(200, 200, 200) -- Change to a different color wait(0.1) -- Wait for a short delay attractButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) -- Revert to original color end -- Function to handle the repel button click local function onRepelButtonClick() attractMode = false repelMode = true print("Repel mode enabled") -- Visual feedback for button click repelButton.BackgroundColor3 = Color3.fromRGB(200, 200, 200) -- Change to a different color wait(0.1) -- Wait for a short delay repelButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255) -- Revert to original color end attractButton.Mou…
type: Question
has title: How do I destroy a part when it touches another part?
tagged with: lua
tagged with: scripting
tagged with: roblox
has answer: http://stackoverflow.com/a/78836847
tagged with: roblox-studio
tagged with: destroy
has comment: http://stackoverflow.com/comment/138525238
answer count: 1
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/138534323
type: QuestionComment
has text: 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).
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78567813

adobe-indesign
tag name: adobe-indesign
tags question: http://stackoverflow.com/q/78522027
type: Tag

http://stackoverflow.com/comment/138489900
type: AnswerComment
has text: Whereas premake prepend configuration for `objdir`, it doesn't for `targetdir` (which is identical for Release/Debug in your case :/)
comment on: http://stackoverflow.com/a/78538204
score: 1
type: Comment

http://stackoverflow.com/a/78553437
has comment: http://stackoverflow.com/comment/138489425
answers question: http://stackoverflow.com/q/78551106
score: 1
has comment: http://stackoverflow.com/comment/138489571
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: There is a few things wrong with your script: its looks to be a server sided script, GUI should be edited in a client sided script. read more about this here you're editing the StarterGui instead of PlayerGui. the client just simply clones the version inside the StarterGui to the PlayerGui i would also be better to use WaitForChild on the humanoid. you updated it to a fixed version of character.Humanoid.Health What i recommend doing is create a LocalScript inside the game.StarterGui.HealthBar.Health.Bar. inside this script i would put the following code: -- // Services \\ -- local Players = game:GetService("Players"); -- // Variables \\ -- local Bar = script.Parent; local client = Players.LocalPlayer; -- // Events \\ -- client.CharacterAdded:Connect(function(Character) local Humanoid = Character:WaitForChild("Humanoid"); Humanoid.HealthChanged:Connect(function(Health) Bar.Text = Health; end); end);
accepted answer of: http://stackoverflow.com/q/78551106
has comment: http://stackoverflow.com/comment/138492007
upvote count: 1

http://stackoverflow.com/q/78582469
answer count: 0
score: 0
type: Question
tagged with: encryption
tagged with: lua
has comment: http://stackoverflow.com/comment/138539888
has body: 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 gcd(a,b) function and the carmichael(n) functions are working correctly, as is plainToNum(msg), so the issue must lie in either the rsaEncrypt(e,n,msg), the rsaDecrypt(d,n,msg), or the rsaKeygen() functions. Source Code: function rsaKeygen() p = math.random(50000,100000) while not isprime(p) do p = math.random(1,1000) end q = math.random(1,1000) while not isprime(q) do q = math.random(50000,100000) end local n = p*q totientN = carmichael(n) e = 2^16+1 local d = 1%totientN/e p,q,totientN = nil,nil,nil return e,d,n end function encryptRSA(e,n,msg) local msg = plainToNum(msg) return msg^e%n end function decryptRSA(d,n,msg) local dec = msg^d%n return dec end 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). As a set of test data, the result of plainToNum for the string "testing" is 1.16e+20, the encrypted num is 4566895.0, and the decrypted string is 165.910
tagged with: cryptography
has title: Why does the decryptRSA function return seemingly random output?
linked to: http://stackoverflow.com/q/78581627
downvote count: 1
upvote count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138541791
tagged with: math
tagged with: rsa
favorite count: 0
has comment: http://stackoverflow.com/comment/138539840

http://stackoverflow.com/comment/138453950
type: AnswerComment
has text: Hi, Thanks with this but this script is causing this error I would be very grateful if you or anyone else could help me solve it. `CoreGui.Execution.22567:0 attept to index nil with 'Settings' CoreGui.Execution.18415:0 attept to index nil with 'Settings' CoreGui.Execution.8007:0 attept to index nil with 'Data'` The first and second errors were caused by the code: `game:GetService(“Players”):FindFirstChild(PlayerName).Settings.Data.Ability.Value`. And the third error was caused by the code: `game:GetService(“Players”):FindFirstChild(PlayerName).Data.Ability.Value`.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78526965

http://stackoverflow.com/comment/138535611
comment on: http://stackoverflow.com/q/78578434
score: 0
type: QuestionComment
has text: 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)
type: Comment

http://stackoverflow.com/q/78581431
type: Question
has body: I want to use a neovim plugin that is written in lua (epwalsh/obsidian.nvim for instance). But my whole config is written in vimscript, and I use the vim-plug package manager. The problem is that this plugin requires the call of a lua setup function. Lua package manager (like lazy.nvim) do it fine, but vim-plug doesn't. How can I properly load the plugin from my vimscript config ? I tried to execute the file with lua path/to/plugin/init.vim, and to use lua require("plugin-name").setup(), but none of these work. The plugin I'm trying to load is epwalsh/obsidian.nvim.
favorite count: 0
score: 2
downvote count: 0
tagged with: lua
type: UnansweredQuestion
has title: How to load a lua plugin from vimscript (how to call the setup function)
tagged with: neovim-plugin
tagged with: neovim
answer count: 0
upvote count: 2

http://stackoverflow.com/a/78567634
type: Answer
answers question: http://stackoverflow.com/q/78562731
has comment: http://stackoverflow.com/comment/138562154
has comment: http://stackoverflow.com/comment/138559840
score: 0
has body: Roblox does not recommend using their web api inside your game. a great (client sided) solution for this would be using AvatarEditorService here you can do the following: local AvatarEditor = game:GetService("AvatarEditorService"); AvatarEditor.PromptAllowInventoryReadAccessCompleted:Connect(function(Result) if (Result == Enum.AvatarPromptResult.Success) then local Page = AvatarEditor:GetInventory({Enum.AvatarAssetType.Gear}); Items = {}; while (not Page.IsFinished) do local pageItems = Page:GetCurrentPage(); for _, v in pairs(pageItems) do table.insert(Items, v); end end -- all gears inside "Items" variable else -- player denied permission end end) AvatarEditor:PromptAllowInventoryReadAccess();
has comment: http://stackoverflow.com/comment/138533585
has comment: http://stackoverflow.com/comment/138529954

lag
type: Tag
tags question: http://stackoverflow.com/q/78561649
tag name: lag

http://stackoverflow.com/q/78520444
answer count: 1
has body: 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!: 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' package.cpath = package.cpath .. ';C:/Users/xyz/AppData/Roaming/luarocks/lib/lua/5.4/?.so' -- Require the modules using their module names local npairs = require('nvim-autopairs') local Rule = require('nvim-autopairs.rule') local cond = require('nvim-autopairs.conds') -- Setup nvim-autopairs npairs.setup({}) -- Add custom rules npairs.add_rules({ Rule("$", "$", "tex") :with_move(cond.after_text("$")) :with_move(cond.before_text("$")), Rule("$$", "$$", "tex") :with_move(cond.after_text("$$")) :with_move(cond.before_text("$$")) })
favorite count: 0
type: Question
has title: Lua attempt to index a nil value vs code
has answer: http://stackoverflow.com/a/78520786
tagged with: lua
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/138428235
type: UnansweredQuestion
score: -1

http://stackoverflow.com/a/78575707
has body: You connect your function handling the shot again every time script.Parent.Fall is fired. Move script.Parent.Shot.OnServerEvent:Connect() outside of script.Parent.Fall.OnServerEvent:Connect().
answers question: http://stackoverflow.com/q/78464672
type: Answer
score: 0

http://stackoverflow.com/comment/138364938
has text: 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. Is it possible to do something like this without extensively modifying the class?
type: Comment
comment on: http://stackoverflow.com/a/78483612
score: 0
type: AnswerComment

http://stackoverflow.com/comment/138399980
type: QuestionComment
comment on: http://stackoverflow.com/q/78498658
has text: You've shared the code that sets the value, but where is the code that prints it out?
type: Comment
score: 1

http://stackoverflow.com/q/78531833
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138472944
tagged with: pandoc
has title: How do I create a quarto filter which can update the description of a post listing?
answer count: 0
has comment: http://stackoverflow.com/comment/138459995
score: 0
type: Question
has body: From my tests (and from code), it appears that the message of a listing post cannot be updated on runtime (when quarto is rendering the HTML). A want a lua filter that overrides this functionality and instead generates a custom description will be used by the listing page.
tagged with: lua
tagged with: quarto

http://stackoverflow.com/q/78587137
tagged with: lua
tagged with: kong-plugin
type: UnansweredQuestion
tagged with: postgresql
has comment: http://stackoverflow.com/comment/138637710
tagged with: kong
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/78660284
favorite count: 0
downvote count: 0
has body: 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. We have an requirement to update the postgres to community edition (15.x) and it needs to be supported immediately. 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 https://github.com/leafo/pgmoon/pull/101. and I cannot change anything in Postgres with this regard. 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.
has title: How to override/update kong-rockspec file to change version of a dependency?
score: 1
has comment: http://stackoverflow.com/comment/138634003
type: Question

http://stackoverflow.com/a/78463269
has comment: http://stackoverflow.com/comment/138333495
has comment: http://stackoverflow.com/comment/138333245
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78463165
has comment: http://stackoverflow.com/comment/138332875
has comment: http://stackoverflow.com/comment/138332130
has comment: http://stackoverflow.com/comment/138333505
has body: You are just getting the random item number, but want the value. You're missing the [] operator. Also, read my comment regarding # 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. This is what you're probably looking for: local math = require "math" arr1 = {1, 2} arr2 = {3, 4, 5} arr3 = {6, 7, 8, 9} function randomize(array) return array[math.random(1, #array)] end print(randomize(arr1)) print(randomize(arr2)) print(randomize(arr3)) There is no NextInteger function or a default RNG library, so you're probably using roblox. In that case, use the random library from roblox instead of LUA's default math in my example. The params are the same: min and max. As for the lastPick, 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: local math = require "math" local arr1 = {1, 2} local arr2 = {3, 4, 5} local arr3 = {6, 7, 8, 9} local lastPickArr1 = {} local lastPickArr2 = {} local lastPickArr3 = {} function randomize(array, lastPick) local randomPick repeat randomPick = array[math.random(1, #array)] until randomPick ~= lastPick[0] lastPick[0] = randomPick return randomPick end print(randomize(arr1, lastPickArr1)) print("last: " .. lastPickArr1[0]) print(randomize(arr2, lastPickArr2)) print( lastPickArr2[0]) print(randomize(arr3, lastPickArr3)) print( lastPickArr3[0]) print(randomize(arr1, lastPickArr1)) print("last: " .. lastPickArr1[0]) print(randomize(arr1, lastPickArr1)) print("last: " .. lastPickArr1[0]) print(randomize(arr1, lastPickArr1)) print("last: " .. lastPickArr1[0]) print(randomize(arr1, lastPickArr1)) print("last: " .. lastPickArr1[0]) print(randomize(arr1, lastPickArr1)) print("last: " .. lastPickArr1[0]) print(randomize(arr1, lastPickArr1)) print("last: " .. last…

http://stackoverflow.com/comment/138634003
type: QuestionComment
score: 0
type: Comment
has text: 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"`
comment on: http://stackoverflow.com/q/78587137

http://stackoverflow.com/q/78552455
tagged with: lua
has body: I'm trying to recover, before trying to rewrite, a "classic" pandoc custom writer called tba.lua. Thus far, I've managed to make it work by adding the prescribed patch in the form function Writer (doc, opts) PANDOC_DOCUMENT = doc PANDOC_WRITER_OPTIONS = opts loadfile(PANDOC_SCRIPT_FILE)() return pandoc.write_classic(doc, opts) end as stated in the documentation. But then, I need to add always a --template option to load the default template, as the writer with the --standalone option complains about No template defined in tba.lua While seeing another example in the documentation, I tried to define the template in the writer by adding function Template () local template = pandoc.template return template.compile(template.default 'tba.lua') end Pandoc can now find the template default.tba.lua in the --data-dir directory, but now it complains saying Error running Lua: string expected, got pandoc Template I thought that template.compile would return the string and feed it to Pandoc, so I don't know what went wrong.
accepted answer: http://stackoverflow.com/a/78553062
score: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78553062
tagged with: writer
has title: pandoc classic filter's template setting
upvote count: 1
answer count: 1
favorite count: 0
tagged with: pandoc
type: Question
downvote count: 0

http://stackoverflow.com/comment/138446467
has text: 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.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78520786

http://stackoverflow.com/q/78453790
has body: 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/ *noted s3 is not public but I sign it using lua script below is my nginx: open_file_cache max=1000 inactive=5m; open_file_cache_valid 2m; open_file_cache_min_uses 1; open_file_cache_errors on; vod_mode mapped; vod_metadata_cache metadata_cache 256m; vod_response_cache response_cache 256m; location /s3/ { internal; # access_by_lua_file /usr/local/nginx/conf/sign.lua; proxy_pass ${PROXY_S3_END_POINT}; } location /json/ { internal; # access_by_lua_file /usr/local/nginx/conf/sign.lua; proxy_pass ${PROXY_S3_JSON_END_POINT}; } location /hls/ { vod hls; access_by_lua_file /usr/local/nginx/conf/sign.lua; vod_remote_upstream_location /s3; vod_upstream_location /json; # alias /etc/nginx/json/; gzip on; gzip_types application/x-mpegURL; add_header Access-Control-Allow-Origin &quot;*&quot;; }
type: Question
answer count: 0
tagged with: lua
tagged with: kaltura
score: 0
tagged with: amazon-s3
type: UnansweredQuestion
has title: kaltura/nginx-vod-module access to remote to json manifest file in s3
tagged with: nginx

http://stackoverflow.com/a/78472844
downvote count: 0
has comment: http://stackoverflow.com/comment/138344646
score: 1
accepted answer of: http://stackoverflow.com/q/78472564
has comment: http://stackoverflow.com/comment/138344478
has comment: http://stackoverflow.com/comment/138344600
has comment: http://stackoverflow.com/comment/138344614
upvote count: 1
has comment: http://stackoverflow.com/comment/138344569
answers question: http://stackoverflow.com/q/78472564
has comment: http://stackoverflow.com/comment/138344532
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/138344577
has body: If you have access to the load function you can turn the string into a table (assuming the string will always be valid Lua syntax) local importedTable = load("return " .. tableToImport:gsub("InstanceInput", ""))() print(importedTable["Item1"].Name) --> "Name" 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 return so that when called it returns the Lua table.

http://stackoverflow.com/comment/138364403
has text: Maybe `object.Name` is `nil`, so `string.sub` raises an error and exits the loop?
score: 0
comment on: http://stackoverflow.com/q/78483956
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/138492007
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78553437
has text: Thanks for the help :) it turns out that it was necessary to make a handler via if)

http://stackoverflow.com/q/78498658
answer count: 1
score: 0
tagged with: roblox
has comment: http://stackoverflow.com/comment/138399980
has comment: http://stackoverflow.com/comment/138390287
type: Question
has answer: http://stackoverflow.com/a/78505213
has comment: http://stackoverflow.com/comment/138395481
has body: Hi I have a module script with a variable "Worker" 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 ModuleScript: local workModule = { ["Worker"] = nil } return workModule Set script: local button = script.Parent local house = workspace.House local moduleTable = require(workspace.Part.ModuleScript) local remoteEvent = game.ReplicatedStorage.RemoteEvent local buttonModule = require(game.ReplicatedStorage.ButtonModule) local workersGUI = game.ReplicatedStorage.WorkersGUI button.Touched:Connect(function(plr) if (plr.Parent:WaitForChild("Humanoid")) then local player = plr.Parent moduleTable.Worker = player workersGUI:FireAllClients() buttonModule.SwitchOn(button) buttonModule.Player = player end end) 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
tagged with: lua
has comment: http://stackoverflow.com/comment/138391563
has title: Module script variable returning as nil
type: UnansweredQuestion

http://stackoverflow.com/q/78525851
has answer: http://stackoverflow.com/a/78526965
answer count: 1
type: UnansweredQuestion
score: 0
type: Question
has body: When the script tries to find out information on the path "game:GetService(“Workspace”).NameValue.Value". it recognizes it, but if this information is used in the path "game.Players.PlayerName.Settings.Data.Ability.Value" then roblox gives the error “PlayerName is not a valid member of Players ‘Players’” can you help me how to fix this error? Script: local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/Robojini/Tuturial_UI_Library/main/UI_Template_1"))() local Window = Library.CreateLib("Player infomation", "RJTheme3") local PlayerName = game:GetService("Workspace").NameValue.Value local Tab = Window:NewTab("Stand") local Section = Tab:NewSection("") local stand = game.Players.PlayerName.Settings.Data.Ability.Value Section:NewLabel(stand) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ local Tab = Window:NewTab("Cash") local Section = Tab:NewSection("") local cash = game.Players.PlayerName.Settings.Data.Cash.Value Section:NewLabel(cash) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ local Tab = Window:NewTab("Stand in storage") local Section = Tab:NewSection("") local StandInStorage1 = game.Players.PlayerName.Data["Ability Storage"].Ability_Slot1.Value local StandInStorage2 = game.Players.PlayerName.Data["Ability Storage"].Ability_Slot2.Value local StandInStorage3 = game.Players.PlayerName.Data["Ability Storage"].Ability_Slot3.Value local StandInStorage4 = game.Players.PlayerName.Data["Ability Storage"].Ability_Slot4.Value local StandInStorage5 = game.Players.PlayerName.Data["Ability Storage"].Ability_Slot5.Value local StandInStorage6 = game.Players.PlayerName.Data["Ability Storage"].Ability_Slot6.Value Section:NewLabel(StandInStorage1) Section:NewLabel(StandInStorage2) Section:NewLabel(StandIn…
tagged with: lua
tagged with: roblox
has title: Problem with not finding the player on the path

request
tags question: http://stackoverflow.com/q/78562731
type: Tag
tag name: request

http://stackoverflow.com/comment/138525874
type: QuestionComment
comment on: http://stackoverflow.com/q/78572397
score: 0
type: Comment
has text: Bear in mind that CORS-preflight requests do not carry any credentials. Make sure that JWT validation occurs _+after_ (not before) CORS is handled.

http://stackoverflow.com/comment/138454907
has text: 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" }
comment on: http://stackoverflow.com/q/78535770
type: QuestionComment
score: 1
type: Comment

http://stackoverflow.com/comment/138440922
comment on: http://stackoverflow.com/q/78527999
type: Comment
has text: Thank you, I'll amend it and mark as solution
type: QuestionComment
score: 0

http://stackoverflow.com/comment/138459524
type: AnswerComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/78491796
score: 0

http://stackoverflow.com/q/78575307
type: UnansweredQuestion
tagged with: lua
has body: How to change the cursor thickness on Insert and Replace modes vertically and horizontally, respectively in Vim? The init.lua has vim.opt.guicursor='n-v-sm-i-ci-ve:block,i:ver41,r:hor41,a:blinkoff400-blinkon250-Cursor/lCursor' which fails to set thickness Please sincerely guide to correct path up to solve it
answer count: 0
score: 0
tagged with: neovim
type: Question
has title: How to change the cursor thickness on Insert modes in Vim?
tagged with: terminal

http://stackoverflow.com/q/78480464
tagged with: nginx
has title: How To Post Process Nginx Reverse Proxy Response
upvote count: 1
answer count: 1
type: UnansweredQuestion
has body: How do I intercept and modify the response HTML from a request running through a reverse proxy and proxy_pass? 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? I know you can use the Lua module, but im not certian how to do that in conjunction with proxy_pass. So for the example: server { listen 80; server_name www.website.com; location /device1 { proxy_pass http://1.1.1.1:8080; --&gt;also post process to some Lua script or something. } }
favorite count: 0
downvote count: 0
score: 1
tagged with: lua
type: Question
has answer: http://stackoverflow.com/a/78481625

http://stackoverflow.com/q/78468822
answer count: 0
score: 0
type: Question
has title: 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?
tagged with: lua
tagged with: fivem
has body: 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. weapons.meta <?xml version="1.0" encoding="UTF - 8"?> <OrderNumber value="420"/> SLOT_WEAPON_TREESHARIFLE WEAPON_TREESHARIFLE w_ar_treesharifle AUDIO_ITEM_CARBINERIFLE SLOT_WEAPON_TREESHARIFLE BULLET DONTCARE DONTCARE DONTCARE DONTCARE DONTCARE DONTCARE INSTANT_HIT WHEEL_RIFLE GROUP_RIFLE <AmmoInfo ref="AMMO_RIFLE"/> <AimingInfo ref="RIFLE_LO_BASE_STRAFE"/> <ClipSize value="60"/> <AccuracySpread value="3.000000"/> <AccurateModeAccuracyModifier value="0.500000"/> <RunAndGunAccuracyModifier value="2.000000"/> <RunAndGunAccuracyMaxModifier value="1.000000"/> <RecoilAccuracyMax value="0.500000"/> <RecoilErrorTime value="3.000000"/> <RecoilRecoveryRate value="1.000000"/> <RecoilAccuracyToAllowHeadShotAI value="1000.000000"/> <MinHeadShotDistanceAI value="1000.000000"/> <MaxHeadShotDistanceAI value="1000.000000"/> <HeadShotDamageModifierAI value="1000.000000"/> <RecoilAccuracyToAllowHeadShotPlayer value="0.175000"/> <MinHeadShotDistancePlayer value="5.000000"/> <MaxHeadShotDistancePlayer value="40.000000"/> <HeadShotDamageModifierPlayer value="18.000000"/> <Damage value="32.000000"/> <DamageTime value="0.000000"/> <DamageTimeInVehicle value="0.000000"/> <DamageTimeInVehicleHeadShot value="0.000000"/> <HitLimbsDamageModifier value="0.500000"/> <NetworkHitLimbsDamageModifier value="0.800000"/> <LightlyArmouredDamageModifier value="0.750000"/> <Force value="75.000000"/> <ForceHitPed value="140.000000"/> <ForceHitVehicle value="1200.000000"/> <ForceHitFlyingHeli value="1250.000000"/> BONETAG_HEAD <ForceFront value="80.000000"/> <ForceBack value="50.000000"/> BONETAG_NECK <ForceFront value="60.000000"/> <ForceBack value="90.000000"/> BONETAG_L_THIGH <ForceFront …
type: UnansweredQuestion

http://stackoverflow.com/comment/138327790
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78463165
type: Comment
has text: As for using a variable to "reuse" a table, yes, it's possible, just pass it as a parameter.

http://stackoverflow.com/q/78558884
score: 0
type: Question
tagged with: lua
has title: HumanoidRootPart not a valid member of Character RBLX
tagged with: roblox
tagged with: roblox-studio
has body: It's a simple local script where I clone the local player's character and place it into my viewport frame However, when trying to access the member "HumanoidRootPart" (which is usually there in all scenarios), it returns an error saying that it is not a valid member like the title above. Said code is below: local LocalPlayer = game.Players.LocalPlayer local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait() local ViewCharacter = script.Parent Character.Archivable = true local VCChar = Character:Clone() VCChar.Parent = ViewCharacter Character.Archivable = false local HumanoidRootPart: Part = VCChar.HumanoidRootPart or VCChar:WaitForChild('HumanoidRootPart') -- error here HumanoidRootPart.Anchored = true HumanoidRootPart.Position = Vector3.zero local VCCam = Instance.new("Camera") VCCam.CFrame = CFrame.new(HumanoidRootPart.Position + (HumanoidRootPart.CFrame.LookVector * 3), VCChar.Head.Position) VCCam.Parent = ViewCharacter ViewCharacter.CurrentCamera = VCCam and the Hierarchy is as below: StarterGui - CharacterView (ScreenGUI) -- ViewCharacter (my viewport frame) --- LoadChar (my local script with the code above) I have just tried using local HumanoidRootPart = VCChar:WaitForChild('HumanoidRootPart') but now the error is: Infinite yield possible on 'Players.blahblahblah.PlayerGui.CharacterView.ViewCharacter.blahblahblah:WaitForChild("HumanoidRootPart")' (blahblahblah is the local player's name btw) genuinely dunno how to fix this, please help
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78558960

http://stackoverflow.com/q/78490741
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/78491796
tagged with: imap
type: Question
has title: How to match brackets in imapfilter Subject search?
has comment: http://stackoverflow.com/comment/138377059
has comment: http://stackoverflow.com/comment/138376964
tagged with: lua
has body: I use imapfilter that uses a Lua script as config. I am trying to match emails subjects containing [sometext] at any position. So I tried: results = account1.INBOX:contain_subject('[sometext]') This performs a search on the server side. It generates the following IMAP command: UID SEARCH CHARSET "ISO-8859-15" ALL SUBJECT "[sometext]" But it matches sometext even without the brackets. Same thing happens for: results = account1.INBOX:match_subject('%[sometext%]') 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. What would be the correct way to match the [sometext] string in my subjects? UPDATE 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. 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. I'll let the question open in case someone finds a solution.
tagged with: lua-patterns
type: UnansweredQuestion

http://stackoverflow.com/comment/138343969
type: QuestionComment
comment on: http://stackoverflow.com/q/78472564
has text: 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.
type: Comment
score: 0

http://stackoverflow.com/comment/138344577
score: 0
type: AnswerComment
has text: There you go! :)
type: Comment
comment on: http://stackoverflow.com/a/78472844

http://stackoverflow.com/comment/138489571
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78553437
type: Comment
has text: @Kylaaa thanks for your comment. i didnt know these values were already there. guess i've learned something today too!

http://stackoverflow.com/comment/138511739
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78567123
has text: 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
type: QuestionComment

http://stackoverflow.com/comment/138501849
type: QuestionComment
comment on: http://stackoverflow.com/q/78561649
has text: Good suggestion, I'll attempt to implement that if at all possible
score: 1
type: Comment

http://stackoverflow.com/comment/138536577
comment on: http://stackoverflow.com/q/78578434
type: Comment
score: 0
has text: Read through https://stackoverflow.com/questions/47761383/proper-carmichael-function, then apply what that teaches you in a Lua context?
type: QuestionComment

http://stackoverflow.com/comment/138502333
score: 1
type: Comment
has text: Have you tried using collision groups?
comment on: http://stackoverflow.com/q/78561649
type: QuestionComment

http://stackoverflow.com/a/78505213
type: Answer
upvote count: 1
has body: This is not the intended use of ModuleScripts, you can't update variables inside of them and then access that variable from another script as far as I'm aware. What you should do is store the Worker inside a StringValue if the Worker variable needs to be accessible from both the client side and the server side you can just store the StringValue inside the ReplicatedStorage, this will retain the same value on the server and replicate it to each client.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/78498658

http://stackoverflow.com/q/78537917
tagged with: lua
tagged with: premake
answer count: 1
score: 0
type: Question
has body: I have a large project with dozens of "modules" 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. Since Premake 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. Simple project structure with root project and one sub-project per sub-folder. MyProject -Plugin1 -Plugin2 -Plugin3 -Plugin...
has answer: http://stackoverflow.com/a/78538204
has title: How to generate a project for every directory in Premake?
type: UnansweredQuestion

http://stackoverflow.com/q/78503463
tagged with: logitech-gaming-software
has answer: http://stackoverflow.com/a/78504527
has body: I'm currently using a workaround script for burst fire using the "p" 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 EVENT == "MOUSE_BUTTON_PRESSED and arg == 1 and IsMouseButtonPressed(1) 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 "p" button. I've read a suggestion to use a "fake button press" variable but i've not been able to make it work. EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) ------------------------------------------------------- OutputLogMessage("Event: "..event.." Arg: "..arg.."\n") ------------------------------------------------------- --- Autoclicker/bind "p" fire --- if IsKeyLockOn("scrolllock") then if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then repeat PressKey("p") Sleep(1) ReleaseKey("p") Sleep(75) PressKey("p") Sleep(1) ReleaseKey("p") Sleep(75) PressKey("p") Sleep(1) ReleaseKey("p") Sleep(150) until not IsMouseButtonPressed(1) -------------------------------------- OutputLogMessage("Burst fire shoot\n") -------------------------------------- end else if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then PressKey("p") elseif event == "MOUSE_BUTTON_RELEASED" and arg == 1 then ReleaseKey("p") --------------------------------------- OutputLogMessage("Normal fire shoot\n") --------------------------------------- end end 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.
type: UnansweredQuestion
answer count: 1
score: 0
type: Question
has title: Check a physical state of a mouse button?
tagged with: lua

http://stackoverflow.com/q/78562440
tagged with: solar2d
answer count: 0
score: 0
type: Question
tagged with: lua
has title: lua solar2d. player passes through obstacles and incorrect transition to another level
has body: 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. have no other ideas. local composer = require("composer") local scene = composer.newScene() local physics = require("physics") physics.start() local background = display.newRect(320, 240, 1000, 1000) background:setFillColor(0.8, 0.8, 0.8, 1) local ground = display.newRect(200, 300, 1000, 40) ground:setFillColor(1, 1, 1, 1) physics.addBody(ground, "static") local startScreen = display.newGroup() local startText = display.newText("Нажмите, чтобы начать!", 250, 150, "Helvetica", 25) startText:setFillColor(0.2, 0.2, 0.2, 1) startScreen:insert(startText) local score = 0 local currentScore = display.newText(score, -70, 20, "Helvetica", 25) local scoreText = display.newText("m / 200 m", 50, 20, "Helvetica", 25) scoreText:setFillColor(0.4, 0.4, 0.4, 1) currentScore:setFillColor(0.4, 0.4, 0.4, 1) local startX = 50 local startY = 250 local player = display.newRect(startX, startY, 20, 60) player:setFillColor(0.4, 0.4, 0.4, 0) physics.addBody(player, "dynamic") player.isJumping = false player.isDucking = false player.duckingCooldown = false player.shootingCooldown = false player.gravityScale = 0 player.isAlive = true local sheetChar = { width = 300, height = 300, numFrames = 7 } local imageSheet = graphics.newImageSheet("dino_sprite_sheet.png", sheetChar) local sequenceData = { { name = "run", start = 1, count = 4, time = 600, loopCount = 0, loopDirection = "forward" }, { name = "death", start = 5, count = 1, time = 1000, loopCount = 1 }, { name = "duck", start = 6, count = 2, time = 600, loopCount = 0, loopDirection = "forward" }, { name = "jump", start = 1, count = 1, time = 600, …
tagged with: coronasdk
type: UnansweredQuestion

http://stackoverflow.com/comment/138457549
comment on: http://stackoverflow.com/a/78520786
type: Comment
score: 0
has text: 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.
type: AnswerComment

http://stackoverflow.com/comment/138541249
type: Comment
type: AnswerComment
has text: @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.
comment on: http://stackoverflow.com/a/78563234
score: 1

http://stackoverflow.com/comment/138429041
score: 0
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/78520786
type: Comment

http://stackoverflow.com/q/78469654
favorite count: 0
has answer: http://stackoverflow.com/a/78702564
accepted answer: http://stackoverflow.com/a/78472496
upvote count: 2
type: AnsweredQuestion
answer count: 2
has body: I'm currently making a strict type checked script but can't find a way to type annotate a variable that requires a Module Script without using the type any which is bad practice. DoSomethingScript: --!strict local moduleScript: any = require(script.SomethingModule) -- How do I change the any type here? moduleScript:DoSomething() moduleScript:NotMethodAndShouldRaiseWarning() -- Using the any type doesn't give warnings for non-existant methods SomethingModule: local SomethingModule = {} function SomethingModule.DoSomething() print("Doing something") end return SomethingModule I tried looking at the Roblox Creator Hub documentation and Luau website for how to type annotate a Module Script but can't find anything about it. So how would I define the type for a Module Script?
tagged with: luau
has title: How to type annotate a Module Script in Luau?
has answer: http://stackoverflow.com/a/78472496
type: Question
tagged with: roblox
downvote count: 0
possible better answer: http://stackoverflow.com/a/78702564
score: 2
tagged with: lua
tagged with: roblox-studio

padding
tag name: padding
tags question: http://stackoverflow.com/q/78581627
type: Tag

http://stackoverflow.com/a/78532917
accepted answer of: http://stackoverflow.com/q/78532534
has comment: http://stackoverflow.com/comment/138454607
answers question: http://stackoverflow.com/q/78532534
has comment: http://stackoverflow.com/comment/138455053
has comment: http://stackoverflow.com/comment/138455179
has body: it appears that lua just gives a pointer to the table location instead of giving a copy. https://onecompiler.com/lua/42e9nrkup a way to fix this could be by copying the table yourself by doing: local copy = table.pack(table.unpack(playersToAssignRoles))
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/138504845
has text: 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
comment on: http://stackoverflow.com/a/78563234
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/138479420
comment on: http://stackoverflow.com/q/78531655
type: Comment
score: 0
type: QuestionComment
has text: 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.

http://stackoverflow.com/q/78483956
tagged with: loops
has title: Lua. Why does the for loop close on the first occurrence of if on the second line?
has comment: http://stackoverflow.com/comment/138364494
type: Question
has body: I am trying to detect all the Towns in the Street object, inside, that have child wind_. But the loop terminates after processing a single Town object, why? for _, object in ipairs(game.Workspace.Street: GetChildren()) do if object.Name == "Town" then for _, object in ipairs(object.house:children()) do if string.sub(object.Name, 1, 5) == "wind_" then object.BrickColor = BrickColor.new("Light blue") end end end end As expected, the for loop goes through all Town objects.
answer count: 0
tagged with: roblox
has comment: http://stackoverflow.com/comment/138365985
score: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/138364403
type: UnansweredQuestion

http://stackoverflow.com/comment/138489888
score: 1
type: AnswerComment
has text: I suggest to move generic stuff outside of `filter`, i.e ` files { dir .. "/**.all.c", dir .. "/**.all.h"}`
comment on: http://stackoverflow.com/a/78538204
type: Comment

http://stackoverflow.com/comment/138506937
has text: This is indeed a bit weird and seems to be a Quarto issue. I don't have a solution.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78563491
type: Comment

http://stackoverflow.com/comment/138455237
type: Comment
has text: 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". Since I just followed the luajit build instructions without too much thought, could it be a bitness problem? edit: Just checked, luajit seems to build x86 on windows by default...
score: 0
comment on: http://stackoverflow.com/q/78535770
type: QuestionComment

java-ffm
type: Tag
tag name: java-ffm
tags question: http://stackoverflow.com/q/78481795

torch
tag name: torch
tags question: http://stackoverflow.com/q/78466371
type: Tag

http://stackoverflow.com/a/78660284
score: 0
has body: This is a scrambled step by step of how I'd do this Step 1: Obtain the Kong Code Source Obtain the source code of the Kong version you are running. You can clone the Kong repository from GitHub: git clone https://github.com/Kong/kong.git Navigate to the directory housing the code source: cd kong Step 2: Find the rockspec File Locate the rockspec file for the Kong version you are running. Look for kong-0.11.0-0.rockspec file. Step 3: Modify the Dependencies Once you have located the rockspec file, you can modify the dependencies section to override the version of pgmoon. Open the rockspec file in a text editor and locate the dependencies table. Change the version of pgmoon from 1.8.0 to 1.12.0: dependencies = { -- ... leafo.pgmoon { version = "1.12.0" }, -- ... } Step 4: Now Rebuild Kong After modifying the rockspec file, you need to rebuild Kong. You can do this using LuaRocks: luarocks make This will rebuild the Kong package with the overridden dependency version. Step 5: Install the Rebuilt Kong Finally, you can install the rebuilt Kong package. If you are using a package manager like apt or yum, 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. Alternatively, 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 /usr/local: sudo cp kong-*.tar.gz /usr/local/ Then, extract the package and install Kong: sudo tar xzf /usr/local/kong-*.tar.gz -C /usr/local/ sudo ln -s /usr/local/kong/bin/kong /usr/local/bin/
type: Answer
answers question: http://stackoverflow.com/q/78587137

http://stackoverflow.com/comment/138535525
comment on: http://stackoverflow.com/q/78578434
type: Comment
has text: If `coprime = 1` then `(coprime^k)%n` is 1, so it goes to the `else` part and just `return k`
score: 0
type: QuestionComment

makefile
type: Tag
tag name: makefile
tags question: http://stackoverflow.com/q/78535770

imap
tag name: imap
type: Tag
tags question: http://stackoverflow.com/q/78490741

http://stackoverflow.com/a/78504527
type: Answer
answers question: http://stackoverflow.com/q/78503463
has body: 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. Try avoiding long sleep by using InterruptableSleep for polling LMB (instead of Sleep) and don't forget to release LMB before switching from the game to desktop. local exit local function InterruptableSleep(ms) if not exit then local tm = GetRunningTime() + ms repeat Sleep(1) exit = not IsMouseButtonPressed(1) until exit or GetRunningTime() >= tm end return exit end EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) ------------------------------------------------------- OutputLogMessage("Event: "..event.." Arg: "..arg.."\n") ------------------------------------------------------- --- Autoclicker/bind "p" fire --- if IsKeyLockOn("scrolllock") then if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then exit = false repeat PressKey("p") Sleep(1) ReleaseKey("p") if InterruptableSleep(75) then break end PressKey("p") Sleep(1) ReleaseKey("p") if InterruptableSleep(75) then break end PressKey("p") Sleep(1) ReleaseKey("p") if InterruptableSleep(150) then break end until false -------------------------------------- OutputLogMessage("Burst fire shoot\n") -------------------------------------- end else if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then PressKey("p") elseif event == "MOUSE_BUTTON_RELEASED" and arg == 1 then ReleaseKey("p") --------------------------------------- OutputLogMessage("Normal fire shoot\n") --------------------------------------- end end 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 "p" button It is impossible to both simulate PressMouseButton(1) and monitor IsMouseButtonPressed(1) at the same time. Choose one of the two.
score: 0

nix
type: Tag
tags question: http://stackoverflow.com/q/78470963
tag name: nix
tags question: http://stackoverflow.com/q/79481658

http://stackoverflow.com/comment/138364494
type: QuestionComment
has text: 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. printing the values will help you find out why your conditions are not met.
comment on: http://stackoverflow.com/q/78483956
type: Comment
score: 1

http://stackoverflow.com/comment/138504826
score: 2
comment on: http://stackoverflow.com/a/78563234
type: AnswerComment
has text: I needed `pandoc.utils.stringify(doc.meta.target_lang)` otherwise this worked perfectly!
type: Comment

http://stackoverflow.com/a/78558960
answers question: http://stackoverflow.com/q/78558884
type: Answer
has body: Adding a wait(0.1) after making the LocalPlayer variable fixes it for some reason. It might be because the model still doesn't have the children even if it has waited for the character to load.
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/138503970
type: QuestionComment
score: 0
has text: The best way of achieving this is probably using [AvatarEditorService](https://create.roblox.com/docs/reference/engine/classes/AvatarEditorService#GetInventory)
type: Comment
comment on: http://stackoverflow.com/q/78562731

xmake
tag name: xmake
tags question: http://stackoverflow.com/q/78513980
type: Tag

protected
tags question: http://stackoverflow.com/q/78539500
tag name: protected
type: Tag

http://stackoverflow.com/a/78836847
answers question: http://stackoverflow.com/q/78567841
score: 0
type: Answer
has body: In your code, you compared the object to an undefined parameter, which will return false. First check if otherpart is a part, then check if it has the same name as the orb, and then destroy object. Use a basic system like this: --server script local function onHit(otherpart) if otherpart:IsA("BasePart") then if otherpart.Name==orb.Name then object:Destroy()

http://stackoverflow.com/a/78577130
answers question: http://stackoverflow.com/q/78575468
has body: Solution: return pandoc.Inlines { pandoc.Image({},"C:/Logs/output.png") } function Math(el) if (el.mathtype == "DisplayMath") then counter = counter + 1 io.output("C:/Logs/output.tex") io.write("\\documentclass[preview]{standalone}", "\n") local i = 2 for k, v in pairs(lines) do while not string.find(lines[i], "\\begin{document}") do io.write(lines[i], "\n") -- write preamble i = i + 1 end end io.write("\\begin{document}", "\n") io.write("\\begin{equation}", "\n") io.write(el.text, "\n") io.write("\\label{"..section.."."..equation.."}", "\n") io.write("\\end{equation}", "\n") io.write("\\end{document}", "\n") io.close() os.execute("cd C:/Logs & pdflatex output.tex & convert -density 576 output.pdf -alpha off output.png") return pandoc.Inlines { pandoc.Image({},"C:/Logs/output.png") } --) end end
score: 0
type: Answer

http://stackoverflow.com/q/78464991
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/78465144
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/78465144
tagged with: lua
has title: I can't change a texture only for the local player
tagged with: roblox
has body: I am trying to change a part's texture just for the local player, but it doesn't work at all. 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. Any help is welcomed

http://stackoverflow.com/a/78581428
answers question: http://stackoverflow.com/q/78578434
has body: I fixed the code by adding a check to see if the loop was broken and modified the check to make sure that all coprimes met the condition using k, and changed the assignment value of k from 0 to 1, so that coprime^k%n does not always evaluate to 1, because all numbers to the power of 0 result in 1. Modified code: function carmichael(n) coprimes = {} for i = 1,n-1 do if gcd(i,n) == 1 then table.insert(coprimes,i) end end totient = #coprimes k = 1 while k &lt;= totient do notcarmichael = false for counter = 1,#coprimes do coprime = coprimes[counter] if (coprime^k)%n ~= 1 then notcarmichael = true break end end if not notcarmichael then return k else k = k+1 end end return totient end
has comment: http://stackoverflow.com/comment/138542621
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/78578434

eclipse
tag name: eclipse
tags question: http://stackoverflow.com/q/78529693
type: Tag

http://stackoverflow.com/comment/138442542
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/78527612
score: 1
type: Comment

http://stackoverflow.com/q/78449716
type: Question
answer count: 0
tagged with: plugins
has body: 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: string or array. And in case it's possible, I'd like to know how. Example usage (with Kubernetes Ingress Controller): with a single string: apiVersion: configuration.konghq.com/v1 kind: KongPlugin metadata: name: my-plugin-example annotations: kubernetes.io/ingress.class: kong plugin: my-plugin config: different_types: | value1 value2 value3 with an array of strings: apiVersion: configuration.konghq.com/v1 kind: KongPlugin metadata: name: my-plugin-example annotations: kubernetes.io/ingress.class: kong plugin: my-plugin config: different_types: - "value1" - "value2" - "value3" Here's what I tried (file schema.lua): local typedefs = require("kong.db.schema.typedefs") local PLUGIN_NAME = "my-plugin" return { name = PLUGIN_NAME, fields = { { consumer = typedefs.no_consumer }, { protocols = typedefs.protocols_http }, { config = { type = "record", fields = { { different_types = { description = "This is a config parameter with flexible type", one_of = { { type = "string" }, { type = "array", elements = { type = "string" },}, }, required = false, },} }, },}, }, } However, I'm getting error type = "required field missing": 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: { fields = { [2] = { type = "required field missing" } } }; different_types: missing type declaration) stack traceback: [C]: in function 'assert' /usr/local/share/lua/5.1/kong/init.lua:772: in function 'init' init_by_lua(nginx-kong.conf:54):3: in main chunk nginx: [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: { fields = { [2] = { type = "required field missing" } } }; different_types: missing type declaration) stack traceba…
tagged with: lua
tagged with: kubernetes
type: UnansweredQuestion
has title: Kong Custom Plugin Development: is it possible to have a configuration field with 2 types? How?
tagged with: kong
score: 0

http://stackoverflow.com/comment/138342249
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78469187
has text: 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.
type: Comment

http://stackoverflow.com/comment/138466884
has text: 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
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78539500
type: QuestionComment

http://stackoverflow.com/comment/138360623
has text: If you want your changes to be applied immediately, you can write a class with getters and setters that access the `MemorySegment`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78481795
score: 0

http://stackoverflow.com/a/78535281
has body: 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. t={ ["Team1"] = "10.1", ["Team2"] = "10.4", ["Team3"] = "10.6", ["Team4"] = "10.7", ["Team5"] = "10.7.5", ["Team6"] = "10.3", ["Team7"] = "10.2", ["Team8"] = "10.5", ["Team9"] = "10.9", ["Team10"] = "11.2", ["Team11"] = "10.8", } event.sid = t[event.user_tag2] or "10.4"
answers question: http://stackoverflow.com/q/78527999
downvote count: 0
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/comment/138364297
score: 0
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/78481889
type: Comment

http://stackoverflow.com/a/78538204
has comment: http://stackoverflow.com/comment/138489888
answers question: http://stackoverflow.com/q/78537917
has body: 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. workspace "MyApplication" basedir "./MyApplication" location "./MyApplication/IDE" configurations { "Debug", "Release" } project "MyApplication" basedir "./MyApplication" location "./MyApplication/IDE" kind "StaticLib" language "C" files { "./MyApplication/Includes/**Enum.h" } targetname "Plugins" targetdir "./MyApplication/Builds" objdir "./MyApplication/Builds/obj" includedirs { "./MyApplication/Includes" } filter { "system:android" } files { "./MyApplication/Plugins/**.all.c", "./MyApplication/Plugins/**.and.c" } files { "./MyApplication/Includes/**.all.h", "./MyApplication/Includes/**.and.h" } defines { "PLATFORM_AND" } filter { "system:ios" } files { "./MyApplication/Plugins/**.all.c", "./MyApplication/Plugins/**.ios.c" } files { "./MyApplication/Includes/**.all.h", "./MyApplication/Includes/**.ios.h" } defines { "PLATFORM_IOS" } filter { "system:linux" } files { "./MyApplication/Plugins/**.all.c", "./MyApplication/Plugins/**.lin.c" } files { "./MyApplication/Includes/**.all.h", "./MyApplication/Includes/**.lin.h" } defines { "PLATFORM_LIN" } filter { "system:macosx" } files { "./MyApplication/Plugins/**.all.c", "./MyApplication/Plugins/**.mac.c", "./MyApplication/Plugins/**.mac.m" } files { "./MyApplication/Includes/**.all.h", "./MyApplication/Includes/**.mac.h" } defines { "PLATFORM_MAC" } filter { "system:windows" } files { "./MyApplication/Plugins/**.all.c", "./MyApplication/Plugins/**.win.c" } files { "./MyApplication/Includes/**.all.h", "./MyApplication/Includes/**.win.h" } defines { "PLATFORM_WIN" } filter { "configurations:Debug" } defines { "DEBUG" } symbols "On" targetdir "./MyApplication/Builds/Debug/bin" objdir "./MyApplication/Builds/Debug/bin" filter { "configurations:Release" } defines { "NDEBUG" } optimize "On" targetdir "./MyApplication…
has comment: http://stackoverflow.com/comment/138489900
score: 0
type: Answer

http://stackoverflow.com/a/78702564
has body: 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.
answers question: http://stackoverflow.com/q/78469654
score: 0
type: Answer

http://stackoverflow.com/comment/138455179
type: Comment
has text: @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?
score: 0
comment on: http://stackoverflow.com/a/78532917
type: AnswerComment

http://stackoverflow.com/comment/138344532
type: AnswerComment
has text: That is doing something, but I forgot an important part of the table string. My Bad! it goes: ``` Item1 = InstanceInput {Rest of the info} ```
comment on: http://stackoverflow.com/a/78472844
type: Comment
score: 0

http://stackoverflow.com/a/78483927
score: 0
type: Answer
has body: Let's first have a look at how to debug this. Pandoc allows to print the internal document representation with --to=native. That's very useful to see what's going on. When I run pandoc --filter=pandoc-crossref --to=native on your table, this is what I get: [ Div ( "tbl:table1" , [] , [] ) [ Table ( "" , [] , [] ) -- ... ] ] That gives us the hint we need: pandoc-crossref places the table in a Div element and adds the id there! (One could also use the pandoc/logging helper to do that kind of inspection in a Lua script.) To change that, we can use an extra filter (or include it in your other filter): function Div (div) -- Check if the div contains just a single table if #div.content == 1 and div.content[1].t == 'Table' then -- move the id to the table, and unwrap the table. local tbl = div.content[1] tbl.identifier = div.identifier return tbl end end Running that filter between pandoc-crossref and your other filter should fix the issue.
answers question: http://stackoverflow.com/q/78481889

http://stackoverflow.com/comment/138459995
type: Comment
comment on: http://stackoverflow.com/q/78531833
has text: 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.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/138519231
score: 1
type: Comment
has text: I made this into a Quarto extension: https://github.com/JBGruber/quarto-targetlang Thanks again for the help!
type: AnswerComment
comment on: http://stackoverflow.com/a/78563234

http://stackoverflow.com/comment/138645226
has text: @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.
type: Comment
comment on: http://stackoverflow.com/q/78567813
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138451848
comment on: http://stackoverflow.com/q/78531655
has text: 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.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/138511896
type: Comment
has text: 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.
score: 0
comment on: http://stackoverflow.com/a/78563234
type: AnswerComment

http://stackoverflow.com/q/78544712
type: UnansweredQuestion
score: 0
has title: Setting up a Garry's mod TTT Server with the Moat Setup - Lua Errors
tagged with: mysql
answer count: 0
tagged with: server
type: Question
has body: 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 https://github.com/colemclaren/ttt 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. Installing TTT-Master Updating mysqloo to newest version installing tmysql4 in garrysmod/lua/bin (Tmysql4 was called in garrysmod/lua/dash/libraries/server/mysql.lua configuring top part of addons/moat_addons/lua/system/cfg/sql/sv_config.lua to be configured to my database 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. Here is the ones i see from the server console. 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 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 05/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/ap…
tagged with: garrys-mod
tagged with: lua

http://stackoverflow.com/comment/138550524
has text: 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`.
comment on: http://stackoverflow.com/q/78588093
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/138540336
has text: thank you.. addition because i cant simply say thank you
type: Comment
comment on: http://stackoverflow.com/a/78557710
score: 0
type: AnswerComment

expansion
tags question: http://stackoverflow.com/q/78463165
tag name: expansion
type: Tag

http://stackoverflow.com/comment/138391563
score: 0
type: QuestionComment
has text: Are you trying to make it so that other players can see what player's character model is stored in the ModuleScript?
comment on: http://stackoverflow.com/q/78498658
type: Comment

luaj
tag name: luaj
tags question: http://stackoverflow.com/q/78566604
type: Tag
tags question: http://stackoverflow.com/q/79358250

http://stackoverflow.com/comment/138559840
type: Comment
has text: Another error: "IsFinished is not a valid member of InventoryPages "Instance" " at `while (not Page:IsFinished()) do`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78567634

http://stackoverflow.com/comment/138327760
type: Comment
comment on: http://stackoverflow.com/q/78463165
score: 0
has text: 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)
type: QuestionComment

http://stackoverflow.com/a/78472496
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78469654
answers question: http://stackoverflow.com/q/78469654
type: AcceptedAnswer
type: Answer
has body: You are looking for the export type keywords. The Luau documentation has a section for 'Module Interactions' and you can pair that with the section for 'Adding types for faux object oriented programs' which you can use to describe your ModuleScript's returned table. For example, in your ModuleScript : -- define the shape of the ModuleScript's returned table export type MathUtilImpl = { add : (a: number, b: number)-> number, subtract : (a: number, b: number) -> number, } local MathUtil : MathUtilImpl = {} function MathUtil.add(a, b) return a + b end function MathUtil.subtract(a, b) return a - b end return MathUtil I'm not using --!strict in the ModuleScript because I didn't want to define everything on the local MathUtil line. But the documentation has suggestions on how to do it. Including your ModuleScript will bring the exported types with it. Then, Roblox's linter will give warnings if you are using something incorrectly. Then in your Script : --!strict local MathUtil = require(script.ModuleScript) print(MathUtil.add(1, 2)) -- returns 3 print(MathUtil.subtract("foo", "bar")) -- gives errors 'Type "string" could not be converted to number' print(MathUtil.multiply(3, 4)) -- gives error 'Key "multiply" not found on table "MathUtil"'
downvote count: 0
score: 1

http://stackoverflow.com/comment/138351380
score: 0
type: Comment
has text: 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?
comment on: http://stackoverflow.com/q/78470963
type: QuestionComment

http://stackoverflow.com/comment/138562154
type: Comment
comment on: http://stackoverflow.com/a/78567634
score: 0
type: AnswerComment
has text: @TheLemon27 yes mb i made it out of my head so it had some errors, i fixed that now!

http://stackoverflow.com/comment/138529954
type: Comment
has text: 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);`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78567634

kaltura
type: Tag
tags question: http://stackoverflow.com/q/78453790
tag name: kaltura

http://stackoverflow.com/comment/138333505
type: AnswerComment
comment on: http://stackoverflow.com/a/78463269
type: Comment
has text: 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.
score: 0

http://stackoverflow.com/comment/138333495
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78463269
type: AnswerComment
has text: 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.

http://stackoverflow.com/comment/138461854
comment on: http://stackoverflow.com/a/78491796
type: Comment
score: 0
has text: I fail to see the difference between an "if" and an "if and only if". A condition is either true or it is not.
type: AnswerComment

http://stackoverflow.com/a/78581915
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: Lua seems to generally use 64 bit numbers, way too small for something like RSA. note that 63 bits means about 19 digits. This means that you need to use a BigInt library or a cryptographic library. If you look at this RSA lib 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. 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. The other possible reason is of course that the isprime function is not efficiently implemented. This can even be slow on native systems for large enough key sizes. 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 possibly even number is prime. This is not really something that Lua has been designed for; it makes more sense to call a function within OpenSSL for RSA operations.
accepted answer of: http://stackoverflow.com/q/78581627
answers question: http://stackoverflow.com/q/78581627
score: 2
downvote count: 0

sequence
type: Tag
tag name: sequence
tags question: http://stackoverflow.com/q/78469058

http://stackoverflow.com/comment/138395481
has text: @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
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78498658
type: Comment

jwt
type: Tag
tag name: jwt
tags question: http://stackoverflow.com/q/78572397
tags question: http://stackoverflow.com/q/79383994

http://stackoverflow.com/a/78585569
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/78585507
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/78585507
has body: Since %g+ matches one or more printable chars and " is also a printable char. So, you need to match any printable characters other than ": s1 = "bibliography: /home/user/file.lib" s2 = 'bibliography: "/home/user/file.lib"' print(string.match(s1, 'bibliography: "?([^%G"]+)"?')) -- /home/user/file.lib print(string.match(s2, 'bibliography: "?([^%G"]+)"?')) -- /home/user/file.lib See the Lua demo. The [^%G"]+ pattern matches one or more characters (+) other than non-printable chars (%G) and ".
type: Answer

http://stackoverflow.com/q/78551106
answer count: 1
has answer: http://stackoverflow.com/a/78553437
score: 0
type: AnsweredQuestion
tagged with: luau
accepted answer: http://stackoverflow.com/a/78553437
has title: HealthBar in Roblox Studio
tagged with: lua
type: Question
has body: Im develop game in Roblox Studio, but my HealthBar not working. My code: local text = game.StarterGui.HealthBar.Health.Bar print("Script started") --------------------------------------------------------- game.Players.PlayerAdded:Connect(function(player) print("Player add") player.CharacterAdded:Connect(function(character) print("Character add") local healthText = character.Humanoid.Health local function updateHealth(healthText) text.Text = healthText end character.Humanoid:GetPropertyChangedSignal("Health"):Connect(function() updateHealth(healthText) end) end) end) --------------------------------------------------------- print("Script ended") It was supposed to show the health level in numbers, but it doesn't show anything. P.S: im speak English so-so.
tagged with: roblox

http://stackoverflow.com/comment/138512674
type: Comment
score: 0
has text: 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.
comment on: http://stackoverflow.com/q/78567807
type: QuestionComment

http://stackoverflow.com/comment/138461895
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78491796
has text: 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.
type: Comment

http://stackoverflow.com/comment/138512813
type: AnswerComment
comment on: http://stackoverflow.com/a/78567907
has text: 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.
score: 2
type: Comment

http://stackoverflow.com/comment/138472805
score: 1
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78543461
type: QuestionComment

http://stackoverflow.com/comment/138460330
type: Comment
comment on: http://stackoverflow.com/q/78522027
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138539840
comment on: http://stackoverflow.com/q/78582469
score: 2
type: Comment
type: QuestionComment
has text: 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.)

destroy
tag name: destroy
type: Tag
tags question: http://stackoverflow.com/q/78567841

http://stackoverflow.com/comment/138455053
type: Comment
score: 0
has text: @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.
type: AnswerComment
comment on: http://stackoverflow.com/a/78532917

http://stackoverflow.com/tag/docx
tag name: docx
type: Tag
tags question: http://stackoverflow.com/q/78567123
tags question: http://stackoverflow.com/q/78575468

oauth
tag name: oauth
type: Tag
tags question: http://stackoverflow.com/q/78572397

server
tag name: server
type: Tag
tags question: http://stackoverflow.com/q/78544712

http://stackoverflow.com/a/78547772
score: 0
type: Answer
has body: Attempt to index nil with position drops I am not sure how you get from the actual error message to this title. The error tells you that in line 35 you'r indexing a nil value with 'Position'. This means that you should look for something.Position, something:Position( or something["Position"] in that line. And you'll find that indexing of something which in your case is either Character.PrimaryPart.Position or Drop.PrimaryPart.Position. In order to find out which of both is nil, in case it is not obvious from the code you can usually just print(Character.PrimaryPart) and print(Drop.PrimaryPart). If you get a value form somewhere that can be nil you should check if it is nil befor you do anything with it.
answers question: http://stackoverflow.com/q/78543461

http://stackoverflow.com/comment/138440886
type: Comment
comment on: http://stackoverflow.com/q/78527999
score: 3
type: QuestionComment
has text: 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)

http://stackoverflow.com/comment/138448531
type: QuestionComment
has text: 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.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78529693

http://stackoverflow.com/a/78606774
has body: You can run a check on the Touched event of a BasePart and check whether a player has enough clicks and if they do, then set CanCollide off. In the below script, find how much clicks the player has in clicksStat and then if that player has enough clicks, which is stored in clicksNeeded, then wallPart's CanCollide is set to false. local Players = game:GetService("Players") local player = Players.LocalPlayer local wallPart = script.Parent -- Make this where your wall is local leaderstats = player and player:FindFirstChild("leaderstats") local clicksStat = leaderstats and leaderstats:FindFirstChild("Clicks") local clicksNeeded = 100 -- Clicks needed for CanCollide = false -- Check every time wallPart is touched if the player has enough clicks local function onTouched(otherPart) if player and clicksStat >= clicksNeeded then wallPart.CanCollide = false -- Disable collision if player has enough clicks end end wallPart.Touched:Connect(onTouched)
score: 0
answers question: http://stackoverflow.com/q/78527612
type: Answer

http://stackoverflow.com/comment/138344600
comment on: http://stackoverflow.com/a/78472844
has text: @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?
type: Comment
score: 0
type: AnswerComment

eclipse-plugin
type: Tag
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/78529693

reverse-engineering
type: Tag
tags question: http://stackoverflow.com/q/78567807
tag name: reverse-engineering

http://stackoverflow.com/comment/138332875
type: Comment
has text: @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.
score: 0
comment on: http://stackoverflow.com/a/78463269
type: AnswerComment

http://stackoverflow.com/comment/138443989
type: Comment
has text: 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)
score: 0
comment on: http://stackoverflow.com/q/78527612
type: QuestionComment

http://stackoverflow.com/comment/138335694
type: Comment
has text: 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`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78464672

http://stackoverflow.com/a/78506634
has body: Well as it turns out the correct id for 'Holy Strike' is 65. So the correct version of the scriptlet is: /script local start_time, duration, enabled = GetSpellCooldown(65, BOOKTYPE_SPELL); print(start_time); print(duration); print(enabled);
accepted answer of: http://stackoverflow.com/q/78506536
answers question: http://stackoverflow.com/q/78506536
type: AcceptedAnswer
score: 0
type: Answer

encryption
type: Tag
tag name: encryption
tags question: http://stackoverflow.com/q/78582469

delay
tag name: delay
tags question: http://stackoverflow.com/q/78463165
type: Tag

cors
type: Tag
tags question: http://stackoverflow.com/q/78572397
tag name: cors
tags question: http://stackoverflow.com/q/79053069

http://stackoverflow.com/comment/138535566
score: 0
has text: So how exactly world I modify the function so that this problem would no longer occur?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78578434

http://stackoverflow.com/comment/138526705
score: 3
comment on: http://stackoverflow.com/q/78575579
type: Comment
has text: local hundred is never initialized
type: QuestionComment

http://stackoverflow.com/comment/138337915
has text: I meant ""ipairs" seems to only work if it starts at 1", or course (facepalm)
type: Comment
comment on: http://stackoverflow.com/q/78469058
type: QuestionComment
score: 0

http://stackoverflow.com/a/78536190
upvote count: 2
type: Answer
has body: The solution was indeed to use libdirs { "path/to/lib" } and links { "libname" }, though variables in the path were causing issues. setting the path as a fixed string fixed everything.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/78535770

http://stackoverflow.com/a/78526965
answers question: http://stackoverflow.com/q/78525851
has comment: http://stackoverflow.com/comment/138453950
has comment: http://stackoverflow.com/comment/138455754
score: 0
type: Answer
has body: in lua if you wanna index with a variable you need to do the following: game.Players[PlayerName].Settings.Data.Ability.Value or game:GetService("Players"):FindFirstChild(PlayerName).Settings.Data.Ability.Value

rsa
type: Tag
tags question: http://stackoverflow.com/q/78582469
tag name: rsa

pkcs
tags question: http://stackoverflow.com/q/78581627
tag name: pkcs
type: Tag

http://stackoverflow.com/a/78640819
type: Answer
score: 4
answers question: http://stackoverflow.com/q/78638506
has body: Just capture anything that is before and after \\scalebox. local pattern = "(.*)\\scalebox(.*)" local text = "text before\\scaleboxtext after" local before, after = text:match(pattern) print(before) print(after) Please refer to the Lua manual. Square brackets define a character set. The pattern [xy] means any of ( x or y ). While ^ negates the set. So [^xy] means none of ( no x and no y ). If you want to match a specific word you need to use the actual word.
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/78693476
accepted answer of: http://stackoverflow.com/q/78693009
answers question: http://stackoverflow.com/q/78693009
type: AcceptedAnswer
type: Answer
has body: Thanks to @InSync for the suggestion :) this gave me an insight on a possible solution. One can simply use a regex engine and pcall (~try-catch) the pattern creation block. Example using lrexlib-pcre library: local rex = require("rex_pcre") local function is_valid_regex(pattern) return pcall(rex.new, pattern) end -- Test print(is_valid_regex(".*")) -- true print(is_valid_regex("[a-z]+")) -- true print(is_valid_regex("([0-9]")) -- false (unbalanced parentheses) print(is_valid_regex("*invalid")) -- false (invalid usage of *)
score: 0

http://stackoverflow.com/comment/138667544
type: AnswerComment
comment on: http://stackoverflow.com/a/78647953
type: Comment
has text: 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
score: 0

http://stackoverflow.com/comment/138712437
comment on: http://stackoverflow.com/q/78667335
has text: 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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78740475
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78736450
answers question: http://stackoverflow.com/q/78736450
has body: const 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 x is a constant variable initialized to hold a table as its value; no further assignments can be made to x. The value which x holds is a table, and that object is mutable. It is not possible in Lua to use const in the manner described in the OP question. In the posted code x is a (constant) variable to which is bound a table. In that table, a and b are not variables, but they are keys. 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 x.a is just syntactic sugar for x["a"], i.e., the table x has a slot indexed by the value "a". Lua allows the const attribute to be associated with variables, but not values, so a and b cannot be made const. 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 one 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.
score: 3
type: AcceptedAnswer
type: Answer
upvote count: 3

http://stackoverflow.com/q/78647894
accepted answer: http://stackoverflow.com/a/78647953
answer count: 2
has title: Why does roblox studio walk wrong through the table
has body: 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 Example code with the tables in table a = { ["5robux"] = { value = 10, name = "21" }, ["10robux"] = { value = 13, name = "31" }, ["15robux"] = { value = 20, name = "41" }, ["20robux"] = { value = 25, name = "64" }, ["61robux"] = { value = 25, name = "64" }, ["50robux"] = { value = 3, name = "64" } } for i, v in pairs(a) do print(i, v) end Output: 5robux ▶ {...} - Server - Script:30 50robux ▶ {...} - Server - Script:30 61robux ▶ {...} - Server - Script:30 20robux ▶ {...} - Server - Script:30 15robux ▶ {...} - Server - Script:30 10robux ▶ {...} - Server - Script:30 As you see, it firstly goes to the first element, then to the last and so on Also tried removing the brackets [], got another output which is still incorrect Output: robux15 ▶ {...} - Server - Script:30 robux5 ▶ {...} - Server - Script:30 robux50 ▶ {...} - Server - Script:30 robux61 ▶ {...} - Server - Script:30 robux10 ▶ {...} - Server - Script:30 robux20 ▶ {...} How can i fix it, and whats wrong? Tried changing the loop, but still wrong output
has answer: http://stackoverflow.com/a/78647953
type: AnsweredQuestion
tagged with: roblox
tagged with: lua
type: Question
possible better answer: http://stackoverflow.com/a/78647975
tagged with: roblox-studio
has answer: http://stackoverflow.com/a/78647975
score: 0

http://stackoverflow.com/comment/138794351
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78720214
has text: 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.

http://stackoverflow.com/q/78672665
has title: How to access Lua global object from another script?
tagged with: lua
has answer: http://stackoverflow.com/a/78672731
score: 2
answer count: 1
type: UnansweredQuestion
favorite count: 0
has body: We have a Wireshark dissector written in Lua. There is a top-level script general.lua which contains: -- Create a protocol object xran_protocol = Proto("xran", "<snip>") <-- line 27 <snip> and we have a second script cplane.lua to handle part of the protocol, which contains: require "general" -- Create a protocol object xran_cplane_proto = Proto("cplane", "<snip>") <snip> debug_level = xran_protocol.prefs.c_plane_debug_level <-- line 348 <snip> Without the require statement I see: Lua Error: \cplane.lua:348: attempt to index global 'xran_protocol' (a nil value) So I added require but then get: general.lua:27: bad argument #2 to 'Proto' (Proto new: there cannot be two protocols with the same description) Is require causing the code in general.lua to be executed twice? What is the correct way for the second script to access xran_protocol?
upvote count: 2
tagged with: wireshark-dissector
type: Question
downvote count: 0

http://stackoverflow.com/comment/138611309
type: Comment
has text: LuaXML_lib is located at `C:\Program Files (x86)\Lua\5.1\clibs\LuaXML_lib.dll`
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78617539

http://stackoverflow.com/comment/138666386
comment on: http://stackoverflow.com/a/78650316
type: Comment
has text: using self. inside table constructors is fine as long as your syntax is ok.
score: 0
type: AnswerComment

http://stackoverflow.com/q/78667335
has title: Love 2d - match 3, I get a stack overflow
tagged with: love2d
upvote count: 1
answer count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/79462117
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/138724101
has comment: http://stackoverflow.com/comment/138712437
tagged with: lua
has comment: http://stackoverflow.com/comment/138723078
has comment: http://stackoverflow.com/comment/138725299
has body: main.lua:147: stack overflow Traceback [love "callbacks.lua"]:228: in function 'handler' main.lua:94: in function 'matches' main.lua:80: in function 'checkforNil' main.lua:89: in function 'removeMatches' main.lua:148: in function 'matches' main.lua:80: in function 'checkforNil' main.lua:89: in function 'removeMatches' main.lua:148: in function 'matches' main.lua:80: in function 'checkforNil' main.lua:89: in function 'removeMatches' ... main.lua:89: in function 'removeMatches' main.lua:148: in function 'matches' main.lua:80: in function 'checkforNil' main.lua:89: in function 'removeMatches' main.lua:148: in function 'matches' main.lua:161: in function 'swap' main.lua:183: in function <main.lua:175> [love "callbacks.lua"]:154: in function <[love "callbacks.lua"]:144> [C]: in function 'xpcall' 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 "stack overflow" error, and I'm not sure how to resolve it. Here is my code: How can I resolve this stack overflow error? It seems to occur in the matches and removeMatches functions, causing an infinite loop or recursion issue. updated to provide error and minimal case of working. local game = {} -- Table to store the grid elements gridTable = {} local selectedTile = nil -- Function to initialize the gridTable with colors function game:initializeGrid() for i = 1, 64 do gridTable[i] = { x = ((i - 1) % 8) * 65, y = (math.floor((i - 1) / 8) * 65), color = love.math.random(7) } end end -- Function to draw the grid elements function game:drawGrid() for i, cell in ipairs(gridTable) do if cell.color then love.graphics.setColor(self:getColor(cell.color)) love.graphics.rectangle("fill", cell.x, cell.y, 50, 50) end end if selectedTile then love.graphics.setColor(1, 1, 1) love.graphics.rectangle("line", gridTable[select…
has comment: http://stackoverflow.com/comment/138701830

http://stackoverflow.com/a/78647975
score: 0
type: Answer
has body: Removed the keys from the table (instead of 5robux just the table), and it worked! Example: a = { { key = "5robux", value = 10, name = "21" }, { key = "10robux", value = 13, name = "31" }, { key = "15robux", value = 20, name = "41" }, } Thanks to gsck
answers question: http://stackoverflow.com/q/78647894

cygwin
tag name: cygwin
type: Tag
tags question: http://stackoverflow.com/q/78615298

http://stackoverflow.com/comment/138781822
score: 0
comment on: http://stackoverflow.com/q/78715199
type: Comment
has text: @AndrewYim I tried doing that but the two separate scripts don't run simultaneously
type: QuestionComment

http://stackoverflow.com/q/78713867
upvote count: 3
tagged with: roblox
downvote count: 0
tagged with: lua
tagged with: roblox-studio
has body: 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. However, I can't seem to pass arguments to onDisplayMessage() from the displayMessageEvent. When I fire the RemoteEvent, nothing happens. This is the server script thus far: local displayMessageEvent = Instance.new("RemoteEvent") displayMessageEvent.Name = "DisplayMessageEvent" displayMessageEvent.Parent = ReplicatedStorage displayMessageEvent:FireAllClients("Hello, World!") And this is the client script: local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local displayMessageEvent = ReplicatedStorage:WaitForChild("DisplayMessageEvent") local function onDisplayMessage(message) local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local screenGui = playerGui:WaitForChild("ScreenGui") local textLabel = screenGui:WaitForChild("TextLabel") textLabel.Text = message end displayMessageEvent.OnClientEvent:Connect(onDisplayMessage()) I tried replacing the last line with the following, with similar results: displayMessageEvent.OnClientEvent:Connect(onDisplayMessage(displayMessageEvent.event)) How can I get the client to handle the RemoteEvent correctly?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78713970
answer count: 1
accepted answer: http://stackoverflow.com/a/78713970
has title: Passing arguments through a RemoteEvent in Roblox
favorite count: 0
type: Question
score: 3
tagged with: luau

http://stackoverflow.com/q/78614240
has answer: http://stackoverflow.com/a/78615867
downvote count: 0
has title: neovim error: when using vim.fs.root(): attempt to call field 'root' (a nil value)
tagged with: lua
upvote count: 3
answer count: 1
has body: 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. I am looking at the example in the documentation. The first example uses the vim.fs.root() function. Looking at the documentation for vim.fs.root(), I see that I can use it to find the top level of my git repo: -- Find the root of a git repository vim.fs.root(0, '.git') However, when I try that in my configuration, I get an error that says I can't use root() because it is nil. local augroup_foo = vim.api.nvim_create_augroup('foo', { clear = true }) vim.api.nvim_create_autocmd({ 'FileType' }, { group = augroup_foo, pattern = { "cue" }, callback = function(ev) vim.lsp.start({ name = "cuepls", cmd = { "cuepls" }, root_dir = vim.fs.root(ev.buf, '.git'), <--- I can't use root }) end, }) The full error: Error detected while processing BufNewFile Autocommands for "*": 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 "*"..FileType Autocommands for "cue": Vim(append):Error executing lua callback: /Users/me/.config/nvim/lua/me/lsp.lua:98: attempt to call field 'root' (a nil value) The question is this How do I use vim.fn.root() inside of a vim.lsp.start()?
type: AnsweredQuestion
score: 3
type: Question
accepted answer: http://stackoverflow.com/a/78615867
tagged with: neovim
favorite count: 0

http://stackoverflow.com/comment/138643602
has text: `[^\\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}".
type: QuestionComment
comment on: http://stackoverflow.com/q/78638506
type: Comment
score: 2

http://stackoverflow.com/comment/138723078
type: Comment
comment on: http://stackoverflow.com/q/78667335
score: 0
type: QuestionComment
has text: 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) I 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,

http://stackoverflow.com/a/78743561
upvote count: 6
has body: local mux = wezterm.mux wezterm.on("gui-startup", function(cmd) local tab, pane, window = mux.spawn_window(cmd or {}) window:gui_window():maximize() end) Maybe you can try this.
score: 6
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78738575

http://stackoverflow.com/q/78621381
has comment: http://stackoverflow.com/comment/138610980
has body: I'm making a 'purchase/shop' screen for a Roblox game, but I'm having trouble opening it from a localscript in a part. I'm not sure exactly what the problem is, I'm fairly beginner to Roblox development. I used a similar script for closing the GUI (which worked well) but when prompted it will not open or make any sound. Screenshot of explorer Here's the code I've written (also displayed in the screenshot if I've typo'd it): -- localScript local clicky = game.Workspace local GUI = game.Players.FindFirstChild("menuGUI") local bloopSound = game:GetService("SoundService").UIbloop function openfromprompt() GUI.Visible = true bloopSound:Play() end clicky.ClickDetector.MouseClick:Connect(openfromprompt) And the error message as follows: (line 11 is the Mouseclick:connect line) Exception hit: LocalScript:11 attempt to index nil with 'ClickDetector'
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/138640308
has answer: http://stackoverflow.com/a/78621643
accepted answer: http://stackoverflow.com/a/78621643
tagged with: lua
favorite count: 0
tagged with: roblox-studio
downvote count: 2
has title: Having trouble showing a ScreenGUI by clicking a Part in the workspace
type: AnsweredQuestion
answer count: 1
score: -2

http://stackoverflow.com/q/78744024
has comment: http://stackoverflow.com/comment/138833796
tagged with: pandoc
has answer: http://stackoverflow.com/a/78745418
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/138833747
score: 0
has comment: http://stackoverflow.com/comment/138833807
type: Question
tagged with: lua
has body: I have an rtf file that, ultimately, I want to convert into a chunked html, splitting on the level 1 headings. My first step is to convert the rtf to one html file, which is straightforward with: pandoc -f rtf -t html -o inputfile.html inputfile.rtf The resulting html file has headings defined by rather than so I have to edit the file in a text editor to change all these. Here is a sample from the file: George Stewart Title: George Stewart Type: Task Date:1734 Description: Christening Status: +open Repository: LDS Library Last action: 8 May 2024 Ann Hill Title: Ann Hill Type: Task Date: 1799 Description: Family Status: +ToDo Repository: LDS Library which has to be edited to: George Stewart Title: George Stewart Type: Task Date:1734 Description: Christening Status: +open Repository: LDS Library Last action: 8 May 2024 Ann Hill Title: Ann Hill Type: Task Date: 1799 Description: Family Status: +ToDo Repository: LDS Library 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. pandoc -t chunkedhtml --split-level=1 -o RN_File inputfile.html 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. 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. The Pandoc Lua filters guide suggests I need a code block like: function Strong(elem) return pandoc.SmallCaps(elem.content) end but I need to capture and replace with , this does not work but may be gives a clue of what I am trying to achieve ... function Para+Strong(elem) return pandoc.Header(1) end
has comment: http://stackoverflow.com/comment/138833857
has title: Inline conversion of headers from RTF to HTML with Pandoc
accepted answer: http://stackoverflow.com/a/78745418
downvote count: 2
has comment: http://stackoverflow.com/comment/138833827
tagged with: http://stackoverflow.com/tag/html
upvote count: 2
type: AnsweredQuestion

http://stackoverflow.com/q/78598446
has answer: http://stackoverflow.com/a/78603170
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138568638
has comment: http://stackoverflow.com/comment/138568457
answer count: 2
has answer: http://stackoverflow.com/a/78598550
has body: I saw a lot of coders do this when init new table, set __index to itself. Why? local Backpack = {} Backpack.__index = Backpack To clone we still use obj.__index = self So why do we need the second line? Does it do something I don't understand? local Backpack = {} -- why we need this? Backpack.__index = Backpack Backpack.initial = "Water, cloths" function Backpack.new() local obj = {} -- If we have this? obj.__index = self return obj end local AlexBackpack = Backpack:new() AlexBackpack.initial = "Water, cloths, knife, fire starter" -- Backpack.initial: Water, cloths -- AlexBackpack.initial: Water, cloths, knife, fire starter print('Backpack.initial:', Backpack.initial) print('AlexBackpack.initial:', AlexBackpack.initial) Check this code online https://onecompiler.com/lua/42fqg7s34
has comment: http://stackoverflow.com/comment/138568612
has comment: http://stackoverflow.com/comment/138568521
has comment: http://stackoverflow.com/comment/138568642
score: 0
type: Question
has comment: http://stackoverflow.com/comment/138568603
tagged with: lua
has title: Cloning classes with obj.__index = self in lua. Why do we need the other one?
has comment: http://stackoverflow.com/comment/138568596
tagged with: roblox-studio

http://stackoverflow.com/comment/138822676
score: 3
comment on: http://stackoverflow.com/q/78736450
has text: `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.
type: Comment
type: QuestionComment

wezterm
tag name: wezterm
tags question: http://stackoverflow.com/q/78738575
type: Tag
tags question: http://stackoverflow.com/q/79059064

http://stackoverflow.com/comment/138675699
has text: thank u lol, what a stupid midunderstanding.
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78655238

http://stackoverflow.com/q/78595890
tagged with: game-engine
score: 0
has title: undefined global lov2d not working in vs code
tagged with: lua
tagged with: love2d
has answer: http://stackoverflow.com/a/79372873
type: UnansweredQuestion
has body: 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. 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
has comment: http://stackoverflow.com/comment/138583183
has comment: http://stackoverflow.com/comment/138565712
tagged with: game-development
has answer: http://stackoverflow.com/a/79237918
answer count: 2
has comment: http://stackoverflow.com/comment/138573858
type: Question
has comment: http://stackoverflow.com/comment/138573969

http://stackoverflow.com/a/78709647
accepted answer of: http://stackoverflow.com/q/78709542
answers question: http://stackoverflow.com/q/78709542
type: AcceptedAnswer
upvote count: 2
type: Answer
has body: This is conditional compilation. Of course, you can. if bit then print("BitOp method") else load[[ -- arbitrary chunk of code print((version_byte >> 4) * 10 + (version_byte & 0xf)) ]]() end However, this will cause problems with access to locals (e.g. local version_byte). So you'll have to rewrite your code accordingly.
has comment: http://stackoverflow.com/comment/138823755
score: 2
downvote count: 0

http://stackoverflow.com/comment/138715543
type: Comment
score: 0
type: QuestionComment
has text: @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)
comment on: http://stackoverflow.com/q/78678155

http://stackoverflow.com/a/78710977
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/138777016
has comment: http://stackoverflow.com/comment/138774931
has body: local ms = require(game.ReplicatedStorage.ModuleScript) if not ms then local ms = require(game.ReplicatedStorage:WaitForChild("ModuleScript")) end The second ms is local to the if statement. It shadows the first ms. So in case the first require failed you'll store the return value of the second require into the wrong variable. Remove the local keyword. local ms = require(game.ReplicatedStorage.ModuleScript) if not ms then ms = require(game.ReplicatedStorage:WaitForChild("ModuleScript")) end Or simply local ms = require(game.ReplicatedStorage.ModuleScript) or require(game.ReplicatedStorage:WaitForChild("ModuleScript")) Of course you should still check if the second require attempt succeeded befor you proceed. No to your actual problem. local info = {} local stamina = 100 local maxstamina = 100 return info You return an empty table here. So any index operation on ms will result in nil. You want to do this: local info = { stamina = 100, maxstamina = 100, } return info or local info = {} info.stamina = 100 info.maxstamina = 100 return info As stamina and maxstamina need to be fields of the table info, not local variables to your script. Then the result of your require statement will be the table { maxstamina = 100, stamina = 100 } instead of { }
has comment: http://stackoverflow.com/comment/138775531
accepted answer of: http://stackoverflow.com/q/78710890
answers question: http://stackoverflow.com/q/78710890
has comment: http://stackoverflow.com/comment/138775128
score: 3

http://stackoverflow.com/a/78746232
type: Answer
has body: I have similar issue. Try to build Solar2d yourself with steps in this link https://forums.solar2d.com/t/how-i-made-solar2d-works-on-linux/356469. In my case it solved the problem.
answers question: http://stackoverflow.com/q/78661251
score: 0

http://stackoverflow.com/q/78650171
has body: 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. 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. Function below function Tile:shimmer() if self.alpha == SHINYHIGHESTALPHA then Timer.tween(1, { [self] = {self.alpha = SHINYLOWESTALPHA} }) elseif self.alpha == SHINYLOWESTALPHA then Timer.tween(1, { [self] = {self.alpha = SHINYHIGHESTALPHA} }) end end and the error I get, line 41 is [self] = {self.alpha = SHINYLOWESTALPHA} Error Syntax error: src/Tile.lua:41: '}' expected near '=' Traceback [love "callbacks.lua"]:228: in function 'handler' [C]: at 0x7ffeef872fa0 [C]: in function 'require' src/Dependencies.lua:35: in main chunk [C]: in function 'require' main.lua:34: in main chunk [C]: in function 'require' [C]: in function 'xpcall' [C]: in function 'xpcall'
type: Question
has title: Lua Love2D, CS50's Introduction to Game Development, knife library Timer.tween syntax
accepted answer: http://stackoverflow.com/a/78650316
tagged with: cs50
tagged with: lua
tagged with: love2d
has answer: http://stackoverflow.com/a/78651180
has answer: http://stackoverflow.com/a/78650316
answer count: 2
score: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/78651180

http://stackoverflow.com/comment/138618571
has text: 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.
score: 4
comment on: http://stackoverflow.com/q/78624992
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/138774931
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78710977
type: AnswerComment
has text: 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.

http://stackoverflow.com/a/79028876
answers question: http://stackoverflow.com/q/78720214
score: 0
type: Answer
has body: 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 "MorelvalVoid" or "Morelval1". Here is an example: print("player join") local MorelvalVoid = game.Players:FindFirstChild("MorelvalVoid") local Morelval1 = game.Players:FindFirstChild("Morelval1") while task.wait(0,1) do if MorelvalVoid or Morelval1 then print("owner") -- Your code here else task.wait(30) print("not owner") end end

animation
tags question: http://stackoverflow.com/q/78742067
tag name: animation
type: Tag
tags question: http://stackoverflow.com/q/79369109
tags question: http://stackoverflow.com/q/79395533

http://stackoverflow.com/a/78694313
downvote count: 1
upvote count: 1
type: Answer
has body: 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. 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.
answers question: http://stackoverflow.com/q/78693947
score: 0

http://stackoverflow.com/q/78736450
possible better answer: http://stackoverflow.com/a/78742759
type: Question
has answer: http://stackoverflow.com/a/78740475
favorite count: 0
upvote count: 4
has comment: http://stackoverflow.com/comment/138825616
has answer: http://stackoverflow.com/a/78742759
downvote count: 0
answer count: 2
tagged with: lua-5.4
tagged with: lua
type: AnsweredQuestion
tagged with: lua-table
has title: Is there a way to use <const> inside a Lua table?
accepted answer: http://stackoverflow.com/a/78740475
has body: Since Lua 5.4, the &lt;const&gt; syntax lets us set const variables. I noticed that this doesn't transitively affect fields inside a table. local x &lt;const&gt; = { a = {1,2,3}, b = {5,6,7} } x = 5 -- error x.a = 9 -- no error The table x is const and cannot be reassigned, but fields inside the table can. Is there any way to make the fields inside a table also const via syntax alone? I know that it's possible via the index and newindex metamethods, but I'm curious if it's possible with simple syntax like &lt;const&gt;. I tried the following, but it produces a syntax error: local x &lt;const&gt; = { a &lt;const&gt; = {1,2,3}, b &lt;const&gt; = {5,6,7} }
score: 4
has comment: http://stackoverflow.com/comment/138822676

http://stackoverflow.com/q/78629303
has body: My local players table uses the PlayerServerId as Index. When i now want to access the player data at Index 1 (My PlayerServerId) i get nil as a result. 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) Debug Code: print("PlayerServerId: ".. GetPlayerServerId(PlayerId())) -- --> Output: "PlayerServerId: 1" print(players[1]) -- --> Output "nil" for i, player in pairs(players) do print("Index: " .. i) -- --> Output: "Index: 1" end Output: How is this possible? What am i doing wrong or what do I oversee? I tried to debug every single step to make sure the data i want to access is available.
tagged with: lua
score: 1
tagged with: fivem
type: AnsweredQuestion
has title: Cant access table entry at index
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/78629336
has answer: http://stackoverflow.com/a/78629336
type: Question
downvote count: 0

http://stackoverflow.com/q/78710890
tagged with: roblox-studio
upvote count: 1
accepted answer: http://stackoverflow.com/a/78710977
score: 1
answer count: 2
type: AnsweredQuestion
tagged with: luau
has answer: http://stackoverflow.com/a/78710977
favorite count: 0
has title: All ModuleScript variables == nil
tagged with: roblox
type: Question
downvote count: 0
has body: For some reason, my local variables in the module script all seem to be nil, with no exact explanation for it, or solution. Local Script (Stamina bar Script): local ms = require(game.ReplicatedStorage.ModuleScript) if not ms then local ms = require(game.ReplicatedStorage:WaitForChild("ModuleScript")) end local TW = game:GetService("TweenService")--Get Tween Service local Staminabar = script.Parent -- Get The Stamina bar local function UpdateStaminabar() --Stamina Bar Size Change Function local stamina = math.clamp(ms.stamina / ms.maxstamina, 0, 1) --Maths local info = TweenInfo.new(ms.stamina / ms.maxstamina,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --Tween Info TW:Create(script.Parent,info,{Size = UDim2.fromScale(ms.stamina, 1)}):Play() -- Create The Tween Then Play It end UpdateStaminabar()--Update The Health Bar ms.stamina:GetPropertyChangedSignal("Value"):Connect(UpdateStaminabar) --Update The Health Bar When The Health Change ms.maxstamina:GetPropertyChangedSignal("Value"):Connect(UpdateStaminabar) --Update The Health Bar Wheb The MaxHealth Change LocalScript (Combat Script): local ms = require(game.ReplicatedStorage.ModuleScript) if not ms then local ms = require(game.ReplicatedStorage:WaitForChild("ModuleScript")) end local uis = game:GetService("UserInputService") local cas = game:GetService("ContextActionService") local rs = game:GetService("ReplicatedStorage") local events = rs:WaitForChild("Events") local hitbox = events:WaitForChild("Hitbox") local plr = game.Players.LocalPlayer local character = plr.Character if not character then plr:WaitForChild("Character") end local humanoid = character.Humanoid local animator = humanoid:WaitForChild("Animator") local idle = animator:LoadAnimation(script:WaitForChild("idle")) local jab = animator:LoadAnimation(script:WaitForChild("jab")) local rightcross = animator:LoadAnimation(script:WaitForChild("rightstraight")) local lefthook = animator:LoadAnimation(script:WaitForChild("lefthook")) local ri…
possible better answer: http://stackoverflow.com/a/78713967
tagged with: lua
has answer: http://stackoverflow.com/a/78713967

http://stackoverflow.com/a/78678874
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78678707
upvote count: 1
has body: The issue with the current code is that it is unable to perform number conversation and formatting properly. _lua(R"§(string.format("%08X", tonumber(@measdata:Diag_DTC[1].max($tStep1,$tStep1End)) or 0))§") In your case tonumber() to convert the measurement value to a number, is not already in the correct format string.format("%08X", ...) formats the number as an uppercase hexadecimal string, zero-padded to 8 characters or 0 as a fallback in case the tonumber() conversion fails, to prevent errors. Tip : Next time don't add quotes around the entire string.format() call, as they were unnecessary and causing issues.
score: 1

http://stackoverflow.com/q/78655111
has title: Neovim: <leader>pv key mapping not working for :Ex command in init.lua
accepted answer: http://stackoverflow.com/a/78655238
tagged with: neovim
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/78655238
favorite count: 0
type: Question
has body: just following theprimeagen neovim setup tutorial, try to map Ex to pv not working. print("Setting leader key") vim.g.mapleader = " " print("Setting key mapping") vim.keymap.set('n', '<leader>pv', vim.cmd.Ex) print("Configuration loaded") Setting leader key Setting key mapping Configuration loaded Press ENTER or type command to continue the debug info seems to be working and also in :map n <Space>pv * <Lua 29: vim/_editor.lua:0> but when i try : pv E492:Not an editor command: pv
downvote count: 0
tagged with: lua
upvote count: 1
score: 1

http://stackoverflow.com/comment/138774855
comment on: http://stackoverflow.com/q/78709542
type: QuestionComment
score: 0
type: Comment
has text: @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.

http://stackoverflow.com/a/78713970
accepted answer of: http://stackoverflow.com/q/78713867
answers question: http://stackoverflow.com/q/78713867
has body: 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: displayMessageEvent.OnClientEvent:Connect(onDisplayMessage) Notice that I removed the inner parentheses after onDisplayMessage. What you got right Your initial intuition was correct. When you bind a function to an event with Connect, you don't have to do much work with arguments in the moment. You just have to make sure to call FireAllClients with the same number of arguments your connected function is expecting whenever you use it. In other words, assuming you connected the function to the event properly, your code does exactly what you wanted it to. Why it didn't work The problem is how you're connecting your function to the event. Connect expects a function (also known as a callback in this context), but you're actually not giving it one since onDisplayMessage() isn't a function. More specifically, there's a difference between onDisplayMessage and onDisplayMessage() - the first is a function, and the second is a function call. So when Roblox sees this line: displayMessageEvent.OnClientEvent:Connect(onDisplayMessage()) It doesn't bind the function onDisplayMessage to the event. Instead, it calls onDisplayMessage with no arguments, then binds its return value to the event.1 Removing the parentheses ensures that you're binding the function itself, not calling the function and binding the value it returns. 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.
upvote count: 4
score: 4
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/q/78649692
downvote count: 0
has body: In JavaScript, there's const a, b = await Promise.all([task1(), task2()]) In Python, there's a, b = await asyncio.gather(task1(), task2()) Is there Lua's equivalent of the above? local task1 = coroutine.create(...) local task2 = coroutine.create(...) local a, b = coroutine.resume_all(task1, task2) -- No such method -- All the coroutines have run to completion or errored. assert(coroutine.status(task1) == 'dead') assert(coroutine.status(task2) == 'dead')
tagged with: lua
has answer: http://stackoverflow.com/a/78651099
type: Question
has comment: http://stackoverflow.com/comment/138667664
tagged with: coroutine
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138663738
upvote count: 1
has title: Lua: await the completion of multiple coroutines
has comment: http://stackoverflow.com/comment/138666517
score: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/138706656
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78672216
has text: (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.

http://stackoverflow.com/q/78656483
answer count: 1
type: Question
downvote count: 0
tagged with: luau
has answer: http://stackoverflow.com/a/78657577
tagged with: lua
accepted answer: http://stackoverflow.com/a/78657577
tagged with: roblox
has title: Why doesn't my Roblox Studio print script execute correctly
tagged with: roblox-studio
upvote count: 1
has body: 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. Code: local player = game.Players.LocalPlayer local character = player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local health = humanoid.Health print(player) print(character) print(humanoid) and another one, in which it does work but, I can't use the variable or functions declared: local player = game.Players.LocalPlayer UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input, typing) if typing then return end if input.UserInputType == Enum.UserInputType.MouseButton1 then print(player, " pressed lmb") end end) local character = player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local debounce = false local health = humanoid.Health 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.
score: 1
has comment: http://stackoverflow.com/comment/138676539
favorite count: 0
has comment: http://stackoverflow.com/comment/138676426
type: AnsweredQuestion

http://stackoverflow.com/q/78678801
tagged with: lua
has comment: http://stackoverflow.com/comment/139160854
tagged with: openresty
tagged with: stream
type: UnansweredQuestion
has body: I'm trying to use Lua scripting with NGINX to handle TCP/UDP traffic within the stream context. Specifically, I want to modify the response data being proxied through my NGINX server using Lua. I've seen examples using the http context with directives like header_filter_by_lua and body_filter_by_lua based on : https://gist.github.com/ejlp12/b3949bb40e748ae8367e17c193fa9602 this work great for http directive. header_filter_by_lua and body_filter_by_lua not exist for stream directive like this : stream { server { listen 12345; proxy_pass 10.0.0.1:567; } } Here’s what I’ve tried so far: stream { server { listen 12345; preread_by_lua_block { local sock = ngx.req.socket() local data, err = sock:receive("*a") if not data then ngx.log(ngx.ERR, "failed to read data: ", err) return end -- Modify data local modified_data = string.gsub(data, "old_text", "new_text") ngx.req.set_body_data(modified_data) } proxy_pass 10.0.0.1:567; } } but is not working
tagged with: nginx
has title: Nginx OpenResty : How to Use Lua in NGINX Stream Context for Modifying TCP/UDP Traffic Response
answer count: 1
score: 0
type: Question
has answer: http://stackoverflow.com/a/78817577

chat
tag name: chat
type: Tag
tags question: http://stackoverflow.com/q/78729670

http://stackoverflow.com/a/79024931
has body: 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: player.CharacterAdded:connect(function(char) local torso = char:WaitForChild("HumanoidRootPart") --You can change this to another body part local newPart = Instance.new("Part", char) newPart.Massless = true --You will likely want to set at least these properties newPart.CanCollide = false newPart.Anchored = false local weld = Instance.new("Weld", torso) --Could also use a Motor6D, or likewise weld.C0 = CFrame.new() --Both C0 and C1 are, by default, set to a blank CFrame weld.C1 = CFrame.new() weld.Part0 = torso weld.Part1 = newPart end) end) Source: Here
type: Answer
answers question: http://stackoverflow.com/q/78705996
score: 0

http://stackoverflow.com/q/78658586
tagged with: luarocks
tagged with: lua-5.4
tagged with: lua
type: UnansweredQuestion
has body: 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 "original sites", 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 "luarocks.bat" to use it. C:\Windows\system32>luarocks C:\Lua\lua54.exe: C:\Program Files (x86)\LuaRocks\lua\luarocks\core\util.lua:18: attempt to concatenate a nil value stack traceback: C:\Program Files (x86)\LuaRocks\lua\luarocks\core\util.lua:18: in function 'luarocks.util.popen_read' C:\Program Files (x86)\LuaRocks\lua\luarocks\util.lua:420: in function 'luarocks.util.check_lua_version' C:\Program Files (x86)\LuaRocks\lua\luarocks\util.lua:491: in upvalue 'find_lua_bindir' C:\Program Files (x86)\LuaRocks\lua\luarocks\util.lua:512: in function 'luarocks.util.find_lua' (...tail calls...) C:\Program Files (x86)\LuaRocks\lua\luarocks\cmd.lua:633: in function 'luarocks.cmd.run_command' C:\Program Files (x86)\LuaRocks\luarocks.lua:35: in main chunk [C]: in ? C:\Windows\system32>luarocks C:\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 stack traceback: ...gram Files (x86)\LuaRocks\lua\luarocks\core\util.lua:18: in function 'popen_read' ...:\Program Files (x86)\LuaRocks\lua\luarocks\util.lua:420: in function 'check_lua_version' ...:\Program Files (x86)\LuaRocks\lua\luarocks\util.lua:491: in function 'find_lua_bindir' ...:\Program Files (x86)\LuaRocks\lua\luarocks\util.lua:512: in function <...:\Program Files (x86)\LuaRocks\lua\luarocks\util.lua:510> (tail call): ? C:\Program Files (x86)\LuaRocks\lua\luarocks\cmd.lua:633: in function 'run_command' C:\Program Files (x86)\LuaRocks\luarocks.lua:…
has title: How to fix my luarocks installation, on Windows?
has answer: http://stackoverflow.com/a/78658626
answer count: 1
score: 0
type: Question

http://stackoverflow.com/a/78738576
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/78738575
score: 0
has body: On a 13 inch macbook pro what I ended up doing is simply hard coding the initial rows/cols config.initial_rows = 100 config.initial_cols = 205 config.window_decorations = "NONE" This got me the perfect result.
downvote count: 1

common-lisp
tags question: http://stackoverflow.com/q/78738185
tag name: common-lisp
type: Tag

http://stackoverflow.com/comment/138786662
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78717400
has text: 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.

http://stackoverflow.com/a/78655238
has body: You set a Normal mode mapping, as in :help key-mapping. This is accessible directly from Normal mode by pressing the sequence of keys pv (that's SpacePV). You must not prefix a colon. You're confusing mappings with user-defined commands, explained in :help user-commands. By 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 :Pv or :PV. My recommendation would be to familiarize yourself with your editor's features by means of the built-in documentation like :help user-manual before trying to follow online resources. You need to understand the basics before you can tweak them. Just my two cents, though.
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78655111
answers question: http://stackoverflow.com/q/78655111
has comment: http://stackoverflow.com/comment/138675699

http://stackoverflow.com/comment/138786652
type: Comment
score: 0
type: QuestionComment
has text: in your code you have the comment `-- Output: userdata (But it Outputs: string)` do you mean `but is SHOULD output string`?
comment on: http://stackoverflow.com/q/78717400

http://stackoverflow.com/q/78699403
tagged with: lua
has title: Low performance when receiving large amounts of data from tarantool
score: 0
has comment: http://stackoverflow.com/comment/138759282
type: UnansweredQuestion
tagged with: tarantool
has body: 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. 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. Since the database needs to be integrated with a python project, I'm using the python connector https://github.com/tarantool/tarantool-python. 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. Instance is configured in the most basic way on a local machine, memtx_memory = 2048 Mb To solve these problems, I tried offloading the data in batches. To 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: import tarantool tarantool_config = { 'host': '127.0.0.1', 'port': 3301, 'user': 'user', 'password': 'password', } def create_and_fill_temp_space(): conn = tarantool.connect(**tarantool_config) create_temp_space = "box.schema.space.create('temp_space', {temporary = true})" conn.eval(create_temp_space) configure_temp_space = f""" box.space.temp_space:format({{ {{name = 'id', type = 'unsigned'}}, {{name = 'data', type = 'any'}} }}) box.space.temp_space:create_index('primary', {{ type = 'tree', parts = {'id'}, if_not_exists = true }}) """ conn.eval(configure_temp_space) lua_query = f""" local fiber = require('fiber') for i, row in ipairs(box.space.test_space.index.someid_idx:select{{{id}}}) do box.space.temp_space:insert{{i, row}} if i % 100 == 0 then fiber.yield() end end """ conn.eval(lua_query) conn.close() Then I unload data from the temporary space by register…
type: Question
tagged with: python
answer count: 0

http://stackoverflow.com/q/78623390
type: UnansweredQuestion
tagged with: neovim
upvote count: 1
tagged with: key-bindings
downvote count: 1
favorite count: 0
score: 0
has title: Neovim key command r is to be customized
answer count: 0
has body: As in neovim key command: r is to get into insert mode await a key being hit then automatically go back to normal Then does neovim have possible way to append it a key sequence, e.g. l that is can automatically go to right It'd be preferred being a Lua keybinding Please help
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/138623955

http://stackoverflow.com/q/78633143
has answer: http://stackoverflow.com/a/78637013
tagged with: roblox-studio
has answer: http://stackoverflow.com/a/78635657
has answer: http://stackoverflow.com/a/79344652
type: UnansweredQuestion
has body: 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. And currently the Popup looks like this: But the Popup should look like this: I tried with: -- @param -- Description --// Description and even with: -- [[ ... ]]
has answer: http://stackoverflow.com/a/79143714
score: 0
has title: Add a docstring to a lua function in Roblox Studio
has answer: http://stackoverflow.com/a/79544239
tagged with: function
type: Question
tagged with: lua
answer count: 5

http://stackoverflow.com/comment/138745625
type: QuestionComment
score: 0
has text: 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).
comment on: http://stackoverflow.com/q/78694409
type: Comment

http://stackoverflow.com/q/78677462
score: 1
tagged with: nginx
favorite count: 0
has title: Unable to read headers in NGINX from gRPC request
tagged with: http2
has comment: http://stackoverflow.com/comment/139083510
has body: 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. I don't know if this is related, but I was able to write "headers" back to the client using add_trailer in NGINX, and the grpc.Trailer on the client side. I am using OpenResty docker image. This is how I write the headers in the client: import ( "google.golang.org/grpc/metadata" ) // ... ctx = metadata.AppendToOutgoingContext(ctx, "custom-header-name", "foobar") client.MyRpcCall(ctx) // ... And this is how I've tried to read them in the NGINX lua block: // 1. local headers = ngx.req.get_headers() for k, v in pairs(headers) do ngx.log(ngx.ERR, "got header: ", k, ":", v) end // My header was not logged :( // 2. local customHeader = headers["custom-header-name"] I have also tried to add the grpc_pass_header custom-header-name; and set $value $http_custom_header_name; Thanks in advance!
type: Question
upvote count: 1
answer count: 0
tagged with: lua
tagged with: openresty
tagged with: grpc
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/78717400
has comment: http://stackoverflow.com/comment/138786825
score: 0
has body: I need help with CheckType. How can I make it check: Enum. (Enum is a userdata, but it doesn't work; Enum is in Luau.) (This is me asking for help in the Language: Luau (Roblox)) When I test Enum, it gives me a string because it turns into the string: "Enums" Doing type(Enum) -- Output: userdata. I want my own code to be as accurate as possible to the original type function. I also need help with a better newproxy, it just doesn't feel the same way as the original Lua 5.1 one. local proxy = {} newproxy = newproxy or function(bool) if bool then setmetatable(proxy, { __index = {} }) end return proxy end function CheckType(a) local s, e = pcall(function() return a.Archivable and (string.match(tostring(a), "^(.-):") == nil) end) local _nil = ((a == nil) and "nil") local Instance = ((s and e ~= nil) and "Instance") local userdata = ((a == newproxy(true)) and "userdata") local coffee = (string.match(tostring(a), "^(.-):")) local boolean = (((a == true) and "boolean" or (a == false) and "boolean")) local number = (((tonumber(a) ~= nil and tostring(a) ~= nil) and "number")) local string = ((((not tostring(a) == _nil) and (not tonumber(a)))) and "string") local unknown = "Unknown" return Instance or userdata or coffee or boolean or number or string or unknown end print(CheckType(Enum)) -- Output: userdata (But it Outputs: string)
type: Question
tagged with: luau
answer count: 0
has comment: http://stackoverflow.com/comment/138786652
has title: Lua function: 'type', recreated in Luau
has comment: http://stackoverflow.com/comment/138786954
has comment: http://stackoverflow.com/comment/138786912
has comment: http://stackoverflow.com/comment/138786935
tagged with: lua
has comment: http://stackoverflow.com/comment/138786945
type: UnansweredQuestion
tagged with: lua-userdata
has comment: http://stackoverflow.com/comment/138786662
has comment: http://stackoverflow.com/comment/138786901

http://stackoverflow.com/comment/138804394
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78701312
has text: @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. For 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`.

http://stackoverflow.com/q/78729670
tagged with: network-programming
answer count: 0
tagged with: sockets
tagged with: lua
has body: 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. I am using Lua lanes for multithreading, Lua-JSON for json encoding and decoding and Lua socket for networking. Here is the server code: local socket = require 'socket' local json = require 'json' local log = require '3rd.log' local connection = require 'src.connection' local udp = socket.udp() udp:setsockname('*', 7777) -- Bind to all interfaces with * log.info('Created server socket.') local rest_time = 0 -- Everytime the server handles a request, it will rest for X time. local connections = {} while true do local data, msg_or_ip, port_or_nil = udp:receivefrom() if data then log.info(string.format('Received data from %s:%d: %s', msg_or_ip, port_or_nil, data)) local connection_exists = false for _, client in pairs(connections) do if client.ip == msg_or_ip and client.port == port_or_nil then connection_exists = true -- Break so then we dont loop through anymore connections (saving time) break end end if not connection_exists then local new_connection = connection.new() new_connection.ip = msg_or_ip new_connection.port = port_or_nil print(json.encode(new_connection)) table.insert(connections, new_connection) log.info(string.format('Added new connection: %s:%d', new_connection.ip, new_connection.port)) end -- Broadcast message for _, client in pairs(connections) do print('broad') print(json.encode(client)) udp:sendto(data, client.ip, client.port) log.info(string.format('Sent data to %s:%d: %s', client.ip, client.port, data)) end elseif msg_or_ip ~= 'timeout' then log.error('Network error: '..tostring(msg_or_ip)) end socket.sleep(rest_time) end Here is the client code: local lanes = require 'lanes'.configure() local log = require '3rd.log' local packet = require 'src.packet' -- Sender thread: sends data local start_sender = lanes.gen('*', function(linda, address, port) local socket = require 's…
tagged with: chat
type: UnansweredQuestion
score: 0
tagged with: luasocket
type: Question
has title: Client is not receiving anything of data in my chat app

http://stackoverflow.com/q/78649659
type: UnansweredQuestion
tagged with: mpv
type: Question
answer count: 0
tagged with: coroutine
tagged with: lua
has body: mp.command_native_async allows one to call an external executable from an MPV script. It accepts a completion callback, which receives the results of the call. The following attempt at coroutinization even works: local function co_subprocess(...) local co = coroutine.running() mp.command_native_async({ name = 'subprocess', args = { ... }, playback_only = false, capture_stdout = true, }, function(...) coroutine.resume(co, ...) -- RESUME POINT end) return coroutine.yield() -- YIELD POINT end coroutine.wrap(function () success, result, error = co_subprocess('echo', 'Hello from MPV') print('success = ', success) print('error = ', error) if result then print('status = ', result.status) print('stdout = ', result.stdout) end end)() but I have questions about its correctness. co_subprocess yields immediately after calling mp.command_native_async. Callback is called by MPV at some later unspecified time, and that callback resumes the coroutine. Are there any guarantees by Lua runtime or by MPV that the callback will be called only after the coroutine has yielded? If there are no such guarantees, what's gonna happen if someone tries to resume a coroutine that haven't yielded?
score: 0
has title: Lua: turn MPV's mp.command_native_async into a coroutine

http://stackoverflow.com/a/78742759
type: Answer
answers question: http://stackoverflow.com/q/78736450
upvote count: 1
downvote count: 0
has body: Here's a slightly different perspective. (The answer is still no.) Part of the reason that <const> 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. The VM runtime knows nothing about <const>. The only difference is if the compiler decided to use the information to make some optimization. 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. 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. 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 dif…
score: 1

http://stackoverflow.com/comment/138573969
comment on: http://stackoverflow.com/q/78595890
type: Comment
score: 0
type: QuestionComment
has text: 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

http://stackoverflow.com/q/78661251
tagged with: android-emulator
type: Question
tagged with: lua
has body: 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. rai@rai-ThinkPad-Yoga-260:~/Documents/Solar2D Projects/langraan$ solar2d . libGL 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) libGL error: failed to load driver: iris Copyright (C) 2009-2100 C o r o n a L a b s I n c . Version: 3.0.0 Build: 2100.9999 WARNING: Cannot create path for resource file 'resource.car (/snap/solar2d/24/usr/local/bin/Solar2D/Resources/resource.car)'. File does not exist. Platform: 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 | `�� Loading project from: /snap/solar2d/24/usr/local/bin/Solar2D/Resources/homescreen Project sandbox folder: /home/rai/snap/solar2d/24/.Solar2D/Sandbox/homescreen
type: UnansweredQuestion
tagged with: installation
has title: how to setup and run Solar2d on Ubuntu?
answer count: 1
score: 0
tagged with: solar2d
tagged with: game-development
has answer: http://stackoverflow.com/a/78746232

http://stackoverflow.com/q/78606577
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78607292
answer count: 1
score: 0
type: Question
has body: I have a lot of data in Redis like User_DB_1:<user_id> , User_Main:<user_id>, Skills_DB_1:<user_id> I set the maxmemory to 50MB and write a lua script and run it in Redis that lua file should remove data that has pattern User_DB_1:<user_id> and shouldn't remove any data for Skills pattern I have tried a lot and I see that each time remove data matches Skills pattern and I run it uses redis-cli --eval /data/redis_evication.lua and the output is (integer) 1000 I am trying to know how can I write a lua file and execute it with the expected results local cursor = "0" local patterns = {"User_DB_1:*", "User_Main:*"} local total_evicted = 0 local limit = 1000 -- Limit of keys to evict per script run repeat -- Scan for the first pattern local res = redis.call("SCAN", cursor, "MATCH", patterns[1], "COUNT", limit) cursor = res[1] local keys = res[2] for _, key in ipairs(keys) do if string.match(key, "^User_DB_1:%d+$") then redis.call("DEL", key) redis.log(redis.LOG_NOTICE, "Deleted key: " .. key) total_evicted = total_evicted + 1 if total_evicted >= limit then return total_evicted end end end -- Scan for the second pattern res = redis.call("SCAN", cursor, "MATCH", patterns[2], "COUNT", limit) cursor = res[1] keys = res[2] for _, key in ipairs(keys) do if string.match(key, "^User_Main:%d+$") then redis.call("DEL", key) redis.log(redis.LOG_NOTICE, "Deleted key: " .. key) total_evicted = total_evicted + 1 if total_evicted >= limit then return total_evicted end end end until cursor == "0" return total_evicted```
has title: Redis eviction policy using lua script
tagged with: redis
tagged with: lua

http://stackoverflow.com/comment/138664475
has text: 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?
type: Comment
comment on: http://stackoverflow.com/q/78645183
score: 0
type: QuestionComment

http://stackoverflow.com/a/78603170
has body: Backpack.__index = Backpack simply stores the table Backpack in itself at index __index This on its own does nothing useful. As already mentioned function Backpack.new() local obj = {} obj.__index = self return obj end is also not very helpful as self is nil and assigning nil to obj.__index does not do anything in this context. First of all we replace function Backpack.new() with function Backpack.new(self) or short function Backpack:new() so self refers to Backpack if we call it with Backpack.new(Backpack) or short Backpack:new() Then obj the new instance of our class Backpack we are about to create needs access to Backpack This is done using a metatable. function Backpack.new() local obj = {} setmetatable(obj, self) -- this is new obj.__index = self return obj end Now obj's metatable is new and as metamethod __index refers to Backpack Lua will always default to indexing Backpack whenever that index does not exist in obj. Otherwise you would have to implement each method and property in every instance of your class. From the manual: __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 metavalue is looked up in the metatable of table.
type: Answer
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/78598446
score: 3

http://stackoverflow.com/q/78712784
tagged with: lua
type: Question
tagged with: roblox
tagged with: roblox-studio
has title: Basketball not bouncing properly in Lua in Roblox Studio (I am making a game in Roblox Studio)
has body: 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 "B-Ball" bounce in a continuous motion. This can be seen here with this code: local bball = script.Parent local function setPlayerJumpPower(player) local character = player.Character if character then local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid then humanoid.JumpHeight = 3 print("Jump Power has been set to 3 for player " .. player.Name) end end end local function weldBallToHand(player) local character = player.Character if not character then return end local righthand = character:FindFirstChild("RightHand") or character:FindFirstChild("Right Arm") if not righthand then print("RightHand or Right Arm not found for player " .. player.Name) return end local wc = Instance.new("WeldConstraint") wc.Part0 = righthand wc.Part1 = bball wc.Parent = bball bball.Position = righthand.Position + Vector3.new(0, 2, 0) end for _, player in pairs(game.Players:GetPlayers()) do setPlayerJumpPower(player) end game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) setPlayerJumpPower(player) end) end) local function animateBallContinuously() local initialPosition = bball.Position local bounceHeight = 6 local bounceTime = 0.5 local tweenService = game:GetService("TweenService") local upTweenInfo = TweenInfo.new(bounceTime, Enum.EasingStyle.Quad, Enum.EasingDirection.Out) local downTweenInfo = TweenInfo.new(bounceTime, Enum.EasingStyle.Quad, Enum.EasingDirection.In) local goalPositionUp = initialPosition + Vector3.new(0, bounceHeight, 0) local goalPositionDown = initialPosition local upTween = tweenService:Create(bball, upTweenInfo, {Position = goalPositionUp}) local downTween = tweenService:Create(bball, downTweenInfo, {Position = goalPositionDown}) upTween.Completed:Connect(function() downTween:Play() end) downTween.Completed:Connect(function() wait(0.1) upTween:Play() end) upTween:P…
type: UnansweredQuestion
score: 0
answer count: 0
tagged with: workspace

http://stackoverflow.com/a/78615867
accepted answer of: http://stackoverflow.com/q/78614240
answers question: http://stackoverflow.com/q/78614240
upvote count: 4
has comment: http://stackoverflow.com/comment/138615045
score: 4
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/138615244
has body: According to the paths in your error, you're using neovim 0.9.1, but vim.fs.root is new to neovim 0.10.0 (specifically, commit 38b9c322c97b ("feat(fs): add vim.fs.root (#28477)")).

http://stackoverflow.com/q/78615298
type: Question
has title: Which .dll file do i choose for setting up luajit?
answer count: 0
tagged with: lua
type: UnansweredQuestion
has body: I'm trying to get LazyVim/NeoVim setup and I need to build with luajit, but I wasn't able to do the instructions: Copy luajit.exe and lua51.dll (built in the src directory) to a newly created directory (any location is ok). Add lua and lua\jit directories below it and copy all Lua files from the src\jit directory of the distribution to the latter directory. There are no hardcoded absolute path names — all modules are loaded relative to the directory where luajit.exe is installed (see src/luaconf.h). 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. I tried to look online for this issue but I didn't seem to find any solution. then i just looked up .dll, and found cyglua51.dll & libluajit-5.1.dll.a within the luajit folder enter image description here Which one do i use? or do i need something that is exactly as lua51.dll instead without "cyg"? 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.
tagged with: luajit
tagged with: cygwin
score: 0
tagged with: dll

http://stackoverflow.com/q/78677429
type: AnsweredQuestion
tagged with: nvim.cmp
tagged with: lua
has answer: http://stackoverflow.com/a/79179907
type: Question
has title: Tab keymap collision between nvim-cmp and copilot.vim in AstroNvim
answer count: 2
accepted answer: http://stackoverflow.com/a/79372632
possible better answer: http://stackoverflow.com/a/79179907
has body: I'm using AstroNvim, and just installed copilot.vim. It's working fine, except that I want to use the Tab key to accept a copilot suggestion. However, the Tab key is mapped to 'Next Completion' according to the AstroNvim docs. How do I disable this behavior so that the Tab key is only used for accepting Copilot suggestions? I have tried adding the following code in my lua/plugins/cmp.lua file: return { "hrsh7th/nvim-cmp", opts = function(_, opts) local cmp = require("cmp") opts.mapping["<Tab>"] = nil end } It hasn't had any effect however.
tagged with: neovim
has answer: http://stackoverflow.com/a/79372632
score: 0

http://stackoverflow.com/a/78745418
score: 1
has body: You could use sed on the inputfile.html between the two pandoc commands. #!/bin/bash pandoc -f rtf -t html -o inputfile.html inputfile.rtf cat 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 pandoc -t chunkedhtml --split-level=1 -o RN_File inputfile-fixed.html Save as: fix_heading.sh Change mode executable: chmod +x fix_heading.sh Usage: ./fix_heading.sh I used cat as a precaution. If you want to directly edit the file, inline, replace the cat line with: 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 That will eliminate need of the intermediate file.
accepted answer of: http://stackoverflow.com/q/78744024
answers question: http://stackoverflow.com/q/78744024
type: AcceptedAnswer
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/138838733
downvote count: 0

http://stackoverflow.com/q/78651730
has comment: http://stackoverflow.com/comment/138793594
answer count: 0
type: Question
tagged with: roblox
has title: ProximityPrompt seems to only work in certain locations
tagged with: roblox-studio
score: 0
has body: 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. local Soin = game.Workspace.Pori["Button Press"] local ProximityPrompt = script.Parent local Part = game.Workspace.Pairt.NeonPoart ProximityPrompt.Triggered:Connect(function(Player) Soin:Play() ProximityPrompt.Enabled = false for i = 1,10 do game.Lighting.ColorCorrectionEffect.Brightness = game.Lighting.ColorCorrectionEffect.Brightness - 0.1 wait() end Player.Character.HumanoidRootPart.Position = game.workspace.SpawnTP2.Position wait(1) for i = 1,10 do game.Lighting.ColorCorrectionEffect.Brightness = game.Lighting.ColorCorrectionEffect.Brightness + 0.1 wait() end wait(1) ProximityPrompt.Enabled = true end) This is my code, is there anything within that could ruin it? 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.
tagged with: placeholder
tagged with: location
tagged with: lua
type: UnansweredQuestion

http://stackoverflow.com/q/78645183
has body: Here is the code: script.Parent.Activation.OnServerEvent:Connect(function() local part = Instance.new("Part") part.Size = Vector3.new(1,1,1) part.Transparency = 0 part.CanCollide = false hitboxActivated = true script.Parent.Handle.Touched:Connect(function(hit) --NPC if hit.Parent:FindFirstChild("Torso") and hitboxActivated == true then local torsoPart = hit.Parent:FindFirstChild("Torso") hitSFX.Parent = torsoPart hitSFX.Volume = 2 screamSFX.Parent = torsoPart hitSFX:Play() screamSFX:Play() torsoPart.AssemblyLinearVelocity = script.Parent.Handle.CFrame.LookVector * 1500 hitboxActivated = false end --PLAYER if hit.Parent:FindFirstChild("Torso") and hitboxActivated == true then local torsoPart = hit.Parent:FindFirstChild("HumanoidRootPart") hitSFX.Parent = torsoPart hitSFX.Volume = 2 screamSFX.Parent = torsoPart hitSFX:Play() screamSFX:Play() part.Position = torsoPart.Position part.AssemblyLinearVelocity = script.Parent.Handle.CFrame.LookVector * 100 part.Parent = torsoPart local weld = Instance.new("WeldConstraint") weld.Part0 = part weld.Part1 = torsoPart hitboxActivated = false end end) wait(3) hitboxActivated = false end) Whenever I test the tool in game, it doesn't apply the force onto the hit player. It just does AssemblyLinearVelocity = 0,0,-0 I have tried multiple ways to try and fix, but still no luck. Does anybody know how to fix this problem? PS: It only works on NPCs, not players.
has title: How to apply "AsemblyLinearVelocity" from scripts onto "hit.Parent"
score: 0
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/138655972
tagged with: roblox
has comment: http://stackoverflow.com/comment/138664475
tagged with: lua
type: UnansweredQuestion
tagged with: roblox-studio

http://stackoverflow.com/comment/138706091
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78672731
has text: 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?

http://stackoverflow.com/a/78642822
score: 0
has body: Your code can find the EyeModel successfully, but it doesn't have the PrimaryPart property set when it errors. 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. Is the name of the PrimaryPart always the same? Then you can consider doing a :WaitForChild(&quot;&quot;) for the PrimaryPart's name as well. This is the easiest and cleanest solution.
answers question: http://stackoverflow.com/q/78637224
type: Answer

http://stackoverflow.com/q/78637224
has title: How to wait for the model to load in Roblox? (lua)
has body: 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 Players.Alex.PlayerGui.AllSeeingEye:120: attempt to index nil with 'Position'. 1 time out of 3 it works. local EyeModel = workspace:WaitForChild("EyeBox"):WaitForChild("EyeBoxModel") local EyePosition = EyeModel.PrimaryPart.Position I tried adding WaitForChild for the folder (EyeBox) and Model (EyeBoxModel). But not helping. Using a while loop sounds like a bad idea...
tagged with: roblox-studio
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78642822
answer count: 1
score: 0
type: Question
tagged with: lua

http://stackoverflow.com/comment/138692350
has text: @LTyrone Why did you reject Andrew Yim's edit only to make the exact same change yourself in your own edit?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78660346

http://stackoverflow.com/q/78693947
has body: 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. 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. 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. On=1 Item1=false Item2=false Item3=false Item4=false Item5=false Item6=false Item7=false Item8=false Item9=false Slot1=turtle.getItemCount(1) Slot2=turtle.getItemCount(2) Slot3=turtle.getItemCount(3) Slot4=turtle.getItemCount(4) Slot5=turtle.getItemCount(5) Slot6=turtle.getItemCount(6) Slot7=turtle.getItemCount(7) Slot8=turtle.getItemCount(8) Slot9=turtle.getItemCount(9) MaterialLocation1= "front" MaterialLocation2= "front" MaterialLocation3= "front" MaterialLocation4= "front" MaterialLocation5= "front" MaterialLocation6= "front" MaterialLocation7= "front" MaterialLocation8= "front" MaterialLocation9= "front" function getMaterialLocation(SelectedSlot) Complete=false while Complete == false do print("Please type the chest to use for slot ", SelectedSlot, " Front Left Right Back Up Down If the slot is empty type 'empty'.") Location=read() Location=string.lower(Location) if Location == "front" then if selecte…
tagged with: lua
tagged with: minecraft
has comment: http://stackoverflow.com/comment/138743788
has title: Minecraft CC Tweaked Mod: Why does it appears that the turtle is skipping lines of code?
tagged with: computercraft
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138743732
favorite count: 0
score: -1
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/78694313
type: Question
has comment: http://stackoverflow.com/comment/138743958
upvote count: 0

http://stackoverflow.com/q/78676102
type: Question
answer count: 0
has title: What is causing LuaLS to give this bogus cast-local-type warning?
has body: Being fairly new to the wonderful language of lua, I still don't fully understand how all the bits and pieces fit together in the lua eco-system. If editing the following perfectly valid code: require "luarocks.loader" local serpent = require "serpent" local deser = {} -- This line produces the linter warning. -- local deser -- If skipping the table, it goes away. local data = { foo = "bar" } local ser = serpent.dump(data) _, deser = serpent.load(ser) for k, v in pairs(deser) do print(k, v) end The following linter warning occur on line 9: [Lua Diagnostics.] This variable is defined as type table. Cannot convert its type to string|unknown. string cannot match table Type string cannot match table 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. The function signature for serpent.load() 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? The language-server is in my case v3.9.3 of LuaLS. It does document e.g. what cast-local-type 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? 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? For fully unknown API:s, like in q77429985, a suggestion is to create Definition Files. It appears those would conflict with the actual implementation, making that a problematic path to take when the real code is available for LuaLS?
downvote count: 0
score: 2
tagged with: lua
type: UnansweredQuestion
tagged with: static-analysis
upvote count: 2
favorite count: 0
linked to: http://stackoverflow.com/q/77429985

http://stackoverflow.com/q/78698546
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138755314
has body: I get the error from the title in my Roblox(Lua) code. Here's the code: local inventoryEvent = game.ReplicatedStorage.Remotes.InventoryEvent game.Players.PlayerAdded:Connect(function(player) -- Ensure the player's inventory exists local inventory = player:FindFirstChild("Inventory") if not inventory then inventory = Instance.new("Folder") inventory.Name = "Inventory" inventory.Parent = player end -- Ensure InventoryGui and its components exist local inventoryGui = player.PlayerGui:WaitForChild("InventoryGui") local inventoryFrame = inventoryGui:WaitForChild("InventoryFrame") local itemsFrame = inventoryFrame:WaitForChild("ItemsFrame") -- Connect inventory child added event inventory.ChildAdded:Connect(function(Item) print("Item added to inventory: " .. Item.Name) -- Debugging statement inventoryEvent:FireClient(player, Item.Name, true) -- Pass the item's name as a string and true as Value end) end) inventoryEvent.OnServerEvent:Connect(function(player, ItemName, Value, button) -- Validate arguments if not (player and ItemName and Value and button) then warn("Missing argument in inventoryEvent.OnServerEvent") return end -- Debugging output print("Received request to process item:", ItemName) if Value == false then local selectedItem = player.Inventory:FindFirstChild(ItemName) if not selectedItem then print("Items in inventory:") for _, item in ipairs(player.Inventory:GetChildren()) do print(item.Name) end warn("Selected item not found in inventory: " .. ItemName) return end local backpack = player.Backpack:GetChildren() local characterItems = player.Character:GetChildren() if #backpack == 0 and not player.Character:FindFirstChildWhichIsA("Tool") then button.Text = "Unequip" button.BackgroundColor3 = Color3.new(1, 0, 0) selectedItem:Clone().Parent = player.Backpack else for _, v in ipairs(backpack) do button.Text = "Equip" button.BackgroundColor3 = Color3.new(0, 1, 0) v:Destroy() end for _, v in ipairs(characterItems) do if v:IsA("Tool") then button.Text = "Equip" butt…
has answer: http://stackoverflow.com/a/78700543
answer count: 1
has comment: http://stackoverflow.com/comment/138755621
score: -2
downvote count: 2
favorite count: 0
type: Question
has title: Lua: Missing argument in inventoryEvent.OnServerEvent
upvote count: 0

http://stackoverflow.com/comment/138777016
has text: @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.
type: AnswerComment
comment on: http://stackoverflow.com/a/78710977
type: Comment
score: 0

http://stackoverflow.com/a/78700543
score: 0
answers question: http://stackoverflow.com/q/78698546
type: Answer
has body: "Your" code is creating this error message you complain about: if not (player and ItemName and Value and button) then warn("Missing argument in inventoryEvent.OnServerEvent") <--- here return end print the arguments' values to find out which one is missing and fix that.

http://stackoverflow.com/comment/138640308
type: QuestionComment
score: 0
has text: Make sure you have read [How to ask a good question](https://stackoverflow.com/help/how-to-ask) before posting any questions here.
comment on: http://stackoverflow.com/q/78621381
type: Comment

http://stackoverflow.com/a/78647953
accepted answer of: http://stackoverflow.com/q/78647894
downvote count: 0
has comment: http://stackoverflow.com/comment/138660537
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/138667544
answers question: http://stackoverflow.com/q/78647894
score: 1
has body: 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 a = { { key = "5robux", value = 10, name = "21" }, { key = "10robux", value = 13, name = "31" }, { key = "15robux", value = 20, name = "41" }, } for i, v in ipairs(a) do print(i, v.key) end Which will output this 1 5robux 2 10robux 3 15robux
upvote count: 1
has comment: http://stackoverflow.com/comment/138662484

http://stackoverflow.com/comment/138786825
comment on: http://stackoverflow.com/q/78717400
has text: 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.)
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138680088
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78658056
type: Comment
has text: Lua strings *behave* as if copied, but I suspect they aren't actually deep copied. Maybe I'll look into the C implementation.

locks
tags question: http://stackoverflow.com/q/78712098
type: Tag
tag name: locks

http://stackoverflow.com/q/78617004
downvote count: 1
type: Question
has body: 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 "E" 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. 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. Here's a brief overview of my setup: Server Script (server.lua): Handles the AI API request and sends the response back to the client. Client Script (client.lua): Sends the player's message to the server, receives the AI response, and sends it to the NUI. UI Scripts (index.html, style.css**,** script.js**):** Manages the chat window and displays messages. I tried everything but nothing worked. If you wanna test it guys, just create an access token on huggingface and add it to the config.lua. here is my Code: --fxmanifest.lua fx_version 'cerulean' game 'gta5' author 'Revo' description 'Interactive NPCs with LLM' version '1.0.0' shared_script 'config.lua' client_scripts { 'client/client.lua' } server_scripts { 'server/server.lua' } files { 'ui/index.html', 'ui/style.css', 'ui/script.js' } ui_page 'ui/index.html' --config.lua Config = {} Config.HuggingFaceAPIKey = "API-Key" Config.ModelEndpoint = "https://api-inference.huggingface.co/models/facebook/blenderbot-400M-distill" --server.lua local json = require('json') RegisterNetEvent('InteractiveNPCS:RequestLLMResponse') AddEventHandler('InteractiveNPCS:RequestLLMResponse', function(text) print("Received text from client: " .. text) local apiKey = Config.HuggingFaceAPIKey local endpoint = Config.ModelEndpoint PerformHttpRequest(endpoint, function(err, responseText, headers) if err == 200 then print("Received response from LLM API: " .. tostring(responseText)) local response = json.decode(responseText) local …
upvote count: 0
has answer: http://stackoverflow.com/a/78655757
tagged with: lua
answer count: 1
type: UnansweredQuestion
tagged with: fivem
favorite count: 0
score: -1
has title: FiveM Script - AI Responds in Console but Not in UI

http://stackoverflow.com/comment/138568603
has text: @shingo yes it works... this is why I wonder why people use it...
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78598446

http://stackoverflow.com/q/78712660
has answer: http://stackoverflow.com/a/78717555
type: Question
tagged with: luau
tagged with: lua
accepted answer: http://stackoverflow.com/a/78717555
tagged with: roblox
tagged with: roblox-studio
type: AnsweredQuestion
has body: 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. Maybe someone knows the answer? ModuleScript: local info = { stamina = Instance.new("IntValue"), maxstamina = Instance.new("IntValue"), } return info Stamina bar Script: local ms = require(game.ReplicatedStorage.ModuleScript) if not ms then ms = require(game.ReplicatedStorage:WaitForChild("ModuleScript")) end local TW = game:GetService("TweenService")--Get Tween Service local Staminabar = script.Parent -- Get The Stamina bar local function UpdateStaminabar() --Stamina Bar Size Change Function local stamina = math.clamp(ms.stamina.Value / ms.maxstamina.Value, 0, 1) --Maths local info = TweenInfo.new(ms.stamina.Value / ms.maxstamina.Value,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --Tween Info TW:Create(script.Parent,info,{Size = UDim2.fromScale(ms.stamina, 1)}):Play() -- Create The Tween Then Play It end UpdateStaminabar()--Update The Stamina Bar ms.stamina:GetPropertyChangedSignal("Value"):Connect(function() UpdateStaminabar() end) PunchScript: local ms = require(game.ReplicatedStorage.ModuleScript) if not ms then ms = require(game.ReplicatedStorage:WaitForChild("ModuleScript")) end local uis = game:GetService("UserInputService") local cas = game:GetService("ContextActionService") local rs = game:GetService("ReplicatedStorage") local events = rs:WaitForChild("Events") local hitbox = events:WaitForChild("Hitbox") local plr = game.Players.LocalPlayer local character = plr.Character if not ch…
answer count: 1
score: 0
has title: Stamina bar going from 100 to 0 for no reason, Stamina value not getting any interactions

nominatim
tags question: http://stackoverflow.com/q/78647187
type: Tag
tag name: nominatim

http://stackoverflow.com/q/78718156
has answer: http://stackoverflow.com/a/78718207
linked to: http://stackoverflow.com/q/60696242
has body: 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. if we guess that: module script: local info = { localplayer = game.Players.LocalPlayer, } return info how do I access the character? (the script making the hitbox isn't a local script.)
type: UnansweredQuestion
tagged with: luau
tagged with: lua
has comment: http://stackoverflow.com/comment/138787259
answer count: 1
tagged with: roblox
tagged with: roblox-studio
score: 0
type: Question
has title: Is there a way to detect if local players character is touching the hitbox instead of the victim? Luau

http://stackoverflow.com/comment/138833807
has text: Note: putting a ` ` inside a ` ` is invalid HTML.
score: 1
comment on: http://stackoverflow.com/q/78744024
type: Comment
type: QuestionComment

pypandoc
type: Tag
tags question: http://stackoverflow.com/q/78616651
tag name: pypandoc

http://stackoverflow.com/comment/138787259
comment on: http://stackoverflow.com/q/78718156
type: Comment
score: 0
type: QuestionComment
has text: 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.

http://stackoverflow.com/q/78739507
accepted answer: http://stackoverflow.com/a/78740142
score: 2
tagged with: lua
tagged with: lua-table
has body: I have stumbled upon a strange behavior of table.sort(), in which the comparing function is invoked by passing the same array element in both parameters. Consider the code below. I want to sort the array from highest to lowest value of the property v and, in case they are equal (and since table.sort() algorithm is not stable as of the docs), I want to sort them by the original indices of the elements. -- The array to sort local arr = { {id="A", v = 1}, {id="B", v = 1}, {id="C", v = 0}, {id="D", v = 1}, {id="E", v = 1} } -- A map containing the original index of the elements in the array: element => originalIndex local original_indices = {} for index, elem in ipairs(arr) do original_indices[elem] = index end -- Sort the array table.sort(arr, function(a, b) assert(a ~= b, "Comparing the same element in the array!") -- Compare the value if a.v > b.v then return true elseif a.v < b.v then return false end -- Values are equal. Compare original indices, which should always -- decide the final order. local ia = original_indices[a] local ib = original_indices[b] if ia < ib then return true elseif ia > ib then return false end error("BUG! Comparing the same element in the array!") end ) The expected result should be: { {id="A", v = 1}, {id="B", v = 1}, {id="D", v = 1}, {id="E", v = 1}, {id="C", v = 0} } But, instead, I get an error because Lua is invoking the sorting function by passing the same element in both parameters, which should not. Am I missing something? How can I get the expected result? You can play around with the code here.
upvote count: 2
has answer: http://stackoverflow.com/a/78740142
favorite count: 0
type: AnsweredQuestion
has title: Lua table.sort invokes the comparing function with the same element
tagged with: sorting
answer count: 1
type: Question
downvote count: 0

http://stackoverflow.com/q/78618889
answer count: 0
type: Question
has body: I'm programming a wx.grid application under lua. I want to change the width and colour of some single horizontal lines. 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. I found some workaround based on 'grid.wx.GetRowGridLinePen(self, columnnumber)'. For that I would have to override this virtual function or derive a class. Unfortunately 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.
tagged with: lua
type: UnansweredQuestion
tagged with: wxgrid
has title: looking for help on changing line attributes of single horizontal lines in wxgrid.lua
score: 0
tagged with: horizontal-line

http://stackoverflow.com/q/78660346
tagged with: lua
has comment: http://stackoverflow.com/comment/138692350
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138683308
tagged with: roblox-studio
has body: This is the code: game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" money = Instance.new("IntValue") money.Name = "Money" money.Parent = leaderstats money.Value = 0 --------------------------------------------------------------------- multiplier = Instance.new("IntValue") multiplier.Name = "Multiplier" multiplier.Parent = player multiplier.Value = 1.0 --------------------------------------------------------------------- leaderstats.Parent = player end) : workspace:WaitForChild("Upgrades"):WaitForChild("Upgrade_1"):WaitForChild("ClickDetector").MouseClick:Connect(function(player) workspace:WaitForChild("Upgrades"):WaitForChild("Upgrade_1"):WaitForChild("ClickDetector"):Destroy() -- Removes ClickDetector local money = player:WaitForChild("leaderstats"):WaitForChild("Money") --------------------------------------------------------------------- --------------------------------------------------------------------- while True wait(0.025) do local currentMultiplier = player:WaitForChild("Multiplier").Value money.Value = money.Value + (1.0 * currentMultiplier) end end) The problem is that when I change the multiplier.Value 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. One of my theories is that money.Value is not checking if the variable changed while the loop is running.
score: 0
type: Question
has comment: http://stackoverflow.com/comment/138684823
has title: Variable is not updating when I change it in Roblox Studio Lua
has comment: http://stackoverflow.com/comment/138699173
has comment: http://stackoverflow.com/comment/138700342
tagged with: roblox
answer count: 0

http://stackoverflow.com/comment/138703730
comment on: http://stackoverflow.com/a/78668370
type: Comment
score: 0
has text: 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
type: AnswerComment

mplayer
tag name: mplayer
tags question: http://stackoverflow.com/q/78658397
type: Tag

http://stackoverflow.com/comment/138823755
type: Comment
score: 0
has text: Awesome answer, thanks! Accepted.
type: AnswerComment
comment on: http://stackoverflow.com/a/78709647

http://stackoverflow.com/comment/138682547
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78659386
type: QuestionComment
has text: 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.

http://stackoverflow.com/comment/138755621
score: 0
has text: 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.
comment on: http://stackoverflow.com/q/78698546
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/138745240
type: Comment
comment on: http://stackoverflow.com/q/78693254
type: QuestionComment
score: 0
has text: 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?

http://stackoverflow.com/q/78638506
has comment: http://stackoverflow.com/comment/138647838
answer count: 3
type: Question
accepted answer: http://stackoverflow.com/a/78638733
tagged with: data-manipulation
has answer: http://stackoverflow.com/a/78638614
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/138643602
tagged with: pattern-matching
upvote count: 2
has answer: http://stackoverflow.com/a/78638733
linked to: http://stackoverflow.com/q/1426954
possible better answer: http://stackoverflow.com/a/78640819
tagged with: match
score: 2
downvote count: 0
type: AnsweredQuestion
tagged with: lua
has body: I would need to extract everything that comes before and everything that comes after the "\\scalebox" string. I tried with local example = "sometext\\scalebox{0.74}" for i in string.gmatch(example, "[^\\scalebox]+") do print(i) end I expect sometext {0.74} but the result is m t t {0.74} EDIT: not an escape chatacter problem, because local example = "sometextscalebox{0.74}" for i in string.gmatch(example, "[^scalebox]+") do print(i) end leads to same result Any ideas?
has title: Weird behaviour in Lua string.gmatch
has answer: http://stackoverflow.com/a/78640819

http://stackoverflow.com/q/78647470
has title: Importing file, recursive function and infinite loop in Lua
upvote count: 1
tagged with: recursion
has body: I have a file structured like this: we can call it input.tex \begin{document} \import{./}{Capitolo1.tex} \import{./}{Capitolo2.tex} \end{document} Using this function I can perform a serger operation, replacing the \import command with the content of the desired file (Chapter 1, Chapter 2) function file_exists(name) local f = io.open(name, "r") if f ~= nil then io.close(f) return true else return false end end function rows_from(file) if not file_exists(file) then return {} end local rows = {} for line in io.lines(file) do rows[#rows + 1] = line end return rows end function search_for_import(tex) local tbl = {} for j = 1, #rows_from(tex) do if string.sub(rows[j],1,7) == "\\import" then table.insert(tbl,{ [1] = j, --line [2] = string.sub(rows[j],13,-2), --file name }) print(string.sub(rows[j],13,-2)) search_for_import(string.sub(rows[j],13,-2)) end end if #tbl > 0 then temp = tex..".mirror" --create mirror file io.output(temp) local line row = rows_from(tex) for i = 1, #row do line = row[i] for key, value in pairs(tbl) do if i == value[1] then print(value[2]) line = row[i+1] for j = 1, #rows_from(value[2]) do io.write(rows_from(value[2])[j], "\n") end end end io.write(line, "\n") end io.close() end os.execute("move "..temp.." "..tex) --final result end This function works fine. But what if the imported file itself had an \import command? My attempt is to use the recursive function for j = 1, #rows_from(tex) do if string.sub(rows[j],1,7) == "\\import" then table.insert(tbl,{ [1] = j, [2] = string.sub(rows[j],13,-2), }) print(string.sub(rows[j],13,-2)) search_for_import(string.sub(rows[j],13,-2)) --this end end But this end with an infinite loop. Ant ideas?
type: Question
downvote count: 0
tagged with: import
tagged with: lua
has comment: http://stackoverflow.com/comment/138661023
has answer: http://stackoverflow.com/a/78647643
accepted answer: http://stackoverflow.com/a/78647643
answer count: 1
score: 1
tagged with: file
favorite count: 0
tagged with: replace
type: AnsweredQuestion

http://stackoverflow.com/q/78672216
has comment: http://stackoverflow.com/comment/138704621
has comment: http://stackoverflow.com/comment/138708079
has comment: http://stackoverflow.com/comment/138704656
tagged with: http://stackoverflow.com/tag/mp4
answer count: 1
has body: Question: 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. Details: I'm looking for guidance on how to: Create video frames in Lua. Assemble these frames into an MP4 file. Read frames from an existing MP4 file. Since 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. What I Tried: 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: local function create_ftyp_box() local major_brand = "isom" local minor_version = "\0\0\2\0" -- Version 2.0 local compatible_brands = "isom" .. "iso2" .. "avc1" .. "mp41" local ftyp_data = major_brand .. minor_version .. compatible_brands return ftyp_data end local function create_mvhd_box() local version = "\0" -- version 0 local flags = "\0\0\0" -- flags local creation_time = "\0\0\0\0" local modification_time = "\0\0\0\0" local timescale = "\0\0\03\xe8" -- 1000 units per second local duration = "\0\0\03\xe8" -- 1 second duration local rate = "\0\0\01\00" -- 1.0 local volume = "\0\01\00\00" -- full volume local reserved = "\0\0" .. string.rep("\0", 10) local matrix = string.rep("\0", 36) -- identity matrix local pre_defined = string.rep("\0", 24) local next_track_ID = "\0\0\0\2" return version .. flags .. creation_time .. modification_time .. timescale .. duration .. rate .. volume .. reserved .. matrix .. pre_defined .. next_track_ID end local function create_tkhd_box() local version = "\0" -- version 0 local flags = "\0\0\7" -- track enabled, track in movie, track in preview local creation_time = "\0\0\0\0" local modification_time = "\0\0\0\0" local track_ID = "\0\0\0\1" local reserved = "\0\0\0\0" local duration = "\0\0\03\xe8" -- 1 second duration local reserved2 = string.rep("\0", 8) local layer = "\0\0" local alte…
score: 0
type: Question
has comment: http://stackoverflow.com/comment/138707522
has comment: http://stackoverflow.com/comment/138704676
has title: How to create and manipulate MP4 video frames using only native Lua?
has comment: http://stackoverflow.com/comment/138706656
tagged with: lua
tagged with: video-processing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78674041

http://stackoverflow.com/comment/138724101
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78667335
type: Comment
has text: @user25690029 Please provide full error message and [minimum reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)

http://stackoverflow.com/q/78693254
has comment: http://stackoverflow.com/comment/138742568
downvote count: 1
answer count: 1
type: Question
tagged with: timestamp
upvote count: 0
has comment: http://stackoverflow.com/comment/138745293
has title: os.clock() in lua return wrong value
score: -1
tagged with: lua
has body: I'm using os.clock in lua to measure working time of a function. I add debug log like below test = function() print(">>>>>>>>start record id: ", record_id, "clock: ", os.clock()) ... body ... print(">>>>>>>>end record id: ", record_id, "clock: ", os.clock()) end I also use <your commadn> | ts "[%Y-%m-%d %H:%M:%S]" to monitor output console. When monitoring output console, I figure out time stamp in ts command is different from os.clock() result in lua. [2024-07-01 22:46:29] >>>>>>>>start record id: 2 clock: 0.143632 [2024-07-01 22:46:29] >>>>>>>>end record id: 2 clock: 0.152762 [2024-07-01 22:46:29] >>>>>>>>start record id: 3 clock: 0.152998 ... ... [2024-07-01 22:50:25] >>>>>>>>end record id: 3639 clock: 48.124877 [2024-07-01 22:50:25] >>>>>>>>start record id: 3640 clock: 48.125138 [2024-07-01 22:50:25] >>>>>>>>end record id: 3640 clock: 48.137237 Following above result logs, to log 3639 records, ts command needs 4 minutes to complete but os.clock() only needs 48 seconds. Do I misunderstanding about os.clock() result? Expected I just wanna know how much time do my system need to log 1 record. Because it's very fast so I use os.clock() but the result make me confuse
linked to: http://stackoverflow.com/q/7335920
has comment: http://stackoverflow.com/comment/138745240
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10192903
favorite count: 0
has answer: http://stackoverflow.com/a/78701312

http://stackoverflow.com/comment/138743958
comment on: http://stackoverflow.com/q/78693947
has text: 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.
type: QuestionComment
score: 0
type: Comment

horizontal-line
type: Tag
tags question: http://stackoverflow.com/q/78618889
tag name: horizontal-line

coroutine
tag name: coroutine
tags question: http://stackoverflow.com/q/78649692
tags question: http://stackoverflow.com/q/78649659
type: Tag
tags question: http://stackoverflow.com/q/78974545
tags question: http://stackoverflow.com/q/79318781

http://stackoverflow.com/comment/138665576
comment on: http://stackoverflow.com/a/78650316
type: Comment
score: 0
has text: Yes thankyou that worked. Looking at it now its kind of obvious that the `self.` was redundant.
type: AnswerComment

http://stackoverflow.com/q/78658397
tagged with: mplayer
answer count: 0
type: Question
downvote count: 0
score: 1
tagged with: lua
type: UnansweredQuestion
has body: My development tool can't use PIPE/socket connections, so… 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. Lua should be an option, but it seems that Lua scripts are executed from inside MPV. I can't find how to execute a Lua script from another application. I can do that with VLC using its http interface, sending and receiving JSON, but I need another media player. Is there an another interface, protocol or technique? 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).
upvote count: 1
has title: Controlling MPV via http requests, like VLC, or an alternative
tagged with: vlc
favorite count: 0
tagged with: mpv

http://stackoverflow.com/q/78659386
tagged with: lua
has comment: http://stackoverflow.com/comment/138682490
has comment: http://stackoverflow.com/comment/138682573
tagged with: data-manipulation
tagged with: string
answer count: 1
type: UnansweredQuestion
tagged with: file
tagged with: tags
has body: I have a file structured like this $$ some text $$ and I would like to make my script reveal when there is a block of text present within the "$$" tags. This script works well when the text is of the form $$ some text $$ function file_exists(name) local f = io.open(name, "r") if f ~= nil then io.close(f) return true else return false end end function rows_from(file) if not file_exists(file) then return {} end local rows = {} for line in io.lines(file) do rows[#rows + 1] = line end return rows end function detect_non_indexed_equations(rows,j) if rows[j]:sub(1,2) == "$$" then for i=j, #rows do if rows[i]:sub(-2) == "$$" then print("text between $$ detected") break end end end end function fetch_equations(start) local rows = rows_from(file) for j = start, #rows do detect_non_indexed_equations(rows,j) end end fetch_equations(1) But the block is written like $$ some text $$ print("text between $$ detected") run twice, and the block is not revealed correctly. Any ideas?
has answer: http://stackoverflow.com/a/78668370
has title: Detect text block between two tags
score: 0
linked to: http://stackoverflow.com/q/1426954
type: Question
has comment: http://stackoverflow.com/comment/138682547

http://stackoverflow.com/q/78738575
answer count: 2
downvote count: 1
has body: Originally closed here https://github.com/wez/wezterm/issues/284 I could not get any of the solutions in the thread or the docs to work correctly in conjunction with config.window_decorations = "NONE"
type: Question
has title: How to maximize wezterm on startup?
has answer: http://stackoverflow.com/a/78743561
tagged with: wezterm
tagged with: lua
upvote count: 2
score: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78738576
favorite count: 0

http://stackoverflow.com/q/78673757
type: Question
tagged with: lua
tagged with: openresty
has body: 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 metadata.AppendToOutgoingContext(ctx, MD) while reading works using metadata.FromIncomingContext(ctx) I need to make a decision on the ngnix which requires reading a specific header "lb-header: value" but having trouble reading the value and setting a local variable. tried so far set $value $http_lb_header lua code local headers = ngx.req.get_headers() for k, v in pairs(headers) do ngx.log(ngx.ERR, "we got header: ", k, ":", v) end thanks in advance!
tagged with: grpc
type: UnansweredQuestion
tagged with: proxy
has title: reading request headers on ngnix from a grpc client
answer count: 0
score: 0

http://stackoverflow.com/q/78633861
tagged with: filter
tagged with: vlc
has title: Problems with coding censor extension for VLC Media Player using Lua
has body: I am relatively new to Lua, and I am encountering a problem when I try to compile my code in VLC. Please 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! This is the error that it gives: lua info: Activated Addon! lua info: Preparing Subtitles lua info: Subtitle file opened successfully lua info: Keyword found at 52.943 seconds. lua info: Keyword found at 7337.018 seconds. lua info: Successfully processed subtitles for exclusion times. lua info: Printing exclusion times... lua info: Exclusion Time 1: Start = 51.943, End = 53.943 lua info: Exclusion Time 2: Start = 7336.018, End = 7338.018 lua error: Could not activate extension! Code: -- Define descriptor function for the VLC addon function descriptor() return { title = "Censor Extension", version = "1.0", author = "Deacon Griffiths", capabilities = {} } end -- Global table to store exclusion times exclusion_times = {} old_time = 0 -- For storing initial volume prev_vol = vlc.volume.get() -- Function to convert time from HH:MM:SS,ms to seconds function timeToSeconds(time_str) local hours, minutes, seconds, milliseconds = time_str:match("(%d+):(%d+):(%d+),(%d+)") return tonumber(hours) * 3600 + tonumber(minutes) * 60 + tonumber(seconds) + tonumber(milliseconds) / 1000 end -- Function to process subtitle file and populate exclusion_times function prepareSubtitles() vlc.msg.info("Preparing Subtitles") local subtitle_file_path = "C:\\Program Files (x86)\\VideoLAN\\VLC\\lua\\extensions\\Subtitles.srt" local subtitle_file = io.open(subtitle_file_path, "r") if not subtitle_file then vlc.msg.error("Failed to open subtitle file at " .. subtitle_file_path) return end vlc.msg.info("Subtitle file opened successfully") local current_time = 0 local in_block = false for line in subtitle_file:lines() do -- Detect the time block local start_time_str, end_time_str = line:match("(%d+:%d+:%d+,%d+)%s*-->%s*(%d+:%d+:%d…
score: 0
answer count: 0
tagged with: libvlc
type: Question
tagged with: lua
type: UnansweredQuestion
tagged with: profanity

http://stackoverflow.com/comment/138775531
type: AnswerComment
has text: 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.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78710977

http://stackoverflow.com/comment/138856514
comment on: http://stackoverflow.com/a/78740142
type: Comment
has text: Thank you. It would have been nice if the docs mentioned this detail!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/138615045
has text: Ah! That will do it. If the on/off trick doesn't work... upgrading probably does. Thanks!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78615867

http://stackoverflow.com/a/79372873
has body: You will want to install two extensions; the love2d support extension and the lua extension so you have the language server which provides syntax highlighting and error checking. Do read their installation instructions. 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: open the Visual Studio Code command palette (under the "View" menu) Search for "lua addon manager" and open it In the lua addon manager you will want to look for LOVE (should be at the top) and enable it. This will resolve the undefined global error for this project. If you start a new project, you will need to repeat these steps. 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 \\ 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: Opening the extensions in the left menu Clicking on the gear next to the installed "lua" extension and then clicking "settings" In the search box at the top search for "lua runtime version" and make sure "LuaJIT" is selected in the select box. 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: Open the visual studio code keyboard shortcuts (under File -> Preferences) In the search box at the top, search for "love2d" The ke…
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78595890

http://stackoverflow.com/q/78693009
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138742490
tagged with: regex
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/63528999
has answer: http://stackoverflow.com/a/78693476
has body: In Lua, is there a way to check if a string is a valid PCRE pattern? Examples: local function is_valid_regex(pattern) -- Check if the pattern is PCRE-compliant end -- Test print(is_valid_regex(".*")) -- true print(is_valid_regex("[a-z]+")) -- true print(is_valid_regex("([0-9]")) -- false (unbalanced parentheses) print(is_valid_regex("*invalid")) -- false (invalid usage of *)
has title: How to check if a regex string is PCRE-compliant?
type: Question
linked to: http://stackoverflow.com/q/11360858
tagged with: lua
accepted answer: http://stackoverflow.com/a/78693476

http://stackoverflow.com/q/78610713
has body: I cannot figure out how to make ENT:Touch only detect when touching a specific entity instead of detecting anything and everything touching it. It probably has something to do with the argument but nothing I've tried has worked current code (useless) function ENT:Touch(entity) EmitSound( Sound ("buttons/lightswitch2.wav" ), self:GetPos(), 1, CHAN_AUTO, 1, 75, 0, 100) self:Remove() end 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.
tagged with: garrys-mod
type: UnansweredQuestion
tagged with: entity
has title: How to make ENT:Touch only detect touches from a certain entity [GLua]
has comment: http://stackoverflow.com/comment/138624036
has comment: http://stackoverflow.com/comment/138596190
score: 0
type: Question
tagged with: lua
answer count: 0

http://stackoverflow.com/q/78654334
type: UnansweredQuestion
tagged with: neovim
downvote count: 0
score: 1
tagged with: fzf
favorite count: 0
has title: how use fzf-lua to prompt with directory listing ; then file listing in selected directory
answer count: 0
tagged with: lua
type: Question
upvote count: 1
has body: 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! function Projects() coroutine.wrap(function() local actions = { ["default"] = { require("fzf-lua").files { cwd = project }, }, } local project = require("fzf-lua").fzf_exec("ls", { prompt = "Projects> ", cwd = "~/projects" }) end)() end

http://stackoverflow.com/a/78717555
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78712660
answers question: http://stackoverflow.com/q/78712660
score: 1
has comment: http://stackoverflow.com/comment/138787049
upvote count: 1
has body: Just set the maxStamina to 100 because that value never changes. Make sure to update the stamina script. local info = { stamina = Instance.new("IntValue"), maxstamina = 100 } return info
type: Answer
downvote count: 0

http://stackoverflow.com/a/78601506
answers question: http://stackoverflow.com/q/78598788
score: 0
has body: It is not clear what is the issue here. I can only assume that it is caused by: local player = vRP.getUserSource{v} According to https://jamesuk.gitbook.io/fivem-guides/dunko-vrp/docs#vrp.getusersource-user_id vRP.getUserSource(user_id) takes a single argument, where user_id seems to be an integer. You are providing a table with a single integer instead. vRP.getUserSource{v} is syntactic sugar for vRP.getUserSource({v}) but you probably want to call vRP.getUserSource(v) Same for vRP.getOnlineAdmins{} but here it does not have any effect as the function does not evaluate any parameters.
type: Answer

http://stackoverflow.com/comment/138786935
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78717400
has text: 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.
type: Comment

http://stackoverflow.com/q/78738185
tagged with: lazyvim
tagged with: neovim
downvote count: 0
tagged with: common-lisp
score: 1
type: UnansweredQuestion
tagged with: slimv
favorite count: 0
has title: neovim + lua + slimv: how to start swank server in the current folder/project?
answer count: 0
tagged with: lua
type: Question
upvote count: 1
has body: I'm using Slimv with NVim, and it works perfectly except when attempting to (load ...) files from the same folder. I presume it's an issue with translating vim shell commands (with % expansions, etc.) to vim.cmd() lua functions. I used to run Slimv with Vim and set g:slimv_swank_cmd to '!osascript -e "tell application \"Terminal\" to do script \"cd %:p:h && sbcl --load ~/.vim/pack/plugins/start/slimv/slime/start-swank.lisp""'. This would load sbcl at the current folder without an issue. Now with neovim and using a Lua LazyVim config file, I have to call vim.cmd(let g:slimv_swank_cmd='!osascript -e "tell application \"Terminal\" to do script \"cd %:p:h && sbcl --load ~/.local/share/nvim/slimv/lazy/slime/start-swank.lisp\""'), but apparently the placeholders for folder location cannot be resolved. I'm guessing I'm missing something about how vim.cmd runs its argument. 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.

http://stackoverflow.com/comment/138716761
type: AnswerComment
comment on: http://stackoverflow.com/a/78678400
has text: 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
type: Comment
score: 1

http://stackoverflow.com/a/78817577
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/139036849
answers question: http://stackoverflow.com/q/78678801
has comment: http://stackoverflow.com/comment/139070654
has body: 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 ngx.req.set_body_data(modified_data) 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. There are only one possible workaround - using cosoket API during access phase (use access_by_lua directive) and implement direct socket to socket communication with your upstream server, but this is really tricky. 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.

http://stackoverflow.com/comment/139475326
has text: @X078 You can shorten every identifier.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78615847
type: Comment

http://stackoverflow.com/q/78734889
has body: I'm trying to use include along with the token premake5: include "%{wks.location}/BuildSystemDependencies/UNIX/MacOS/Dependencies.lua" file tree: ├── BuildSystemDependencies ├── LICENSE ├── README.md ├── build ├── premake5.lua my premake5, which is next to the folder BuildSystemDependencies contains a workspace for defining the wks.location token workspace "Radiant" configurations { "Debug", "Release" } architecture "x64" startproject "Sanxbox" language "C++" cppdialect "C++17" targetdir "build/Bin/%{cfg.buildcfg}" objdir "build/Intermediates/%{cfg.buildcfg}" externalanglebrackets "On" externalwarnings "Off" warnings "Off" group "ThirdParty" include "ThirdParty/" group "" -- Platform-specific includes if os.target() == "windows" then include "Radiant/BuildSystem/Windows" elseif os.target() == "macosx" then include "Radiant/BuildSystem/UNIX/MacOS" end But I get an error Error: unable to open %{wks.location}/BuildSystemDependencies/Dependencies.lua: No such file or directory What's the reason my wks.location is not detected?
type: UnansweredQuestion
has title: using tokens when including files
score: 0
answer count: 0
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/138827423
tagged with: premake

http://stackoverflow.com/q/78715199
linked to: http://stackoverflow.com/q/24578998
has comment: http://stackoverflow.com/comment/138783503
tagged with: logitech-gaming-software
has comment: http://stackoverflow.com/comment/138781737
has comment: http://stackoverflow.com/comment/138782344
tagged with: mouse
has body: Im trying to put the following 2 scripts together so that they can run at the same exact time. function OnEvent(event, arg) if EnableRCS ~= false then if IsMouseButtonPressed(3) then -- Only check for right mouse button press repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0, RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end end and if event == "MOUSE_BUTTON_PRESSED" and arg == 8 then PressKeySequenceA() end I've tried combining the script like this: function OnEvent(event, arg) if EnableRCS ~= false then if event == "MOUSE_BUTTON_PRESSED" and arg == 8 then PressKeySequenceA() end if IsMouseButtonPressed(3) then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0, RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end end But it doesn't result in the scripts being executed simultaneously Right now the scripts execute one by one but I want them to execute at the same time.
has comment: http://stackoverflow.com/comment/138782639
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138782719
has comment: http://stackoverflow.com/comment/138781822
linked to: http://stackoverflow.com/q/54669211
has title: How to combine two logitech scripts?
score: 0
has comment: http://stackoverflow.com/comment/138782728
type: Question
has comment: http://stackoverflow.com/comment/138781716
tagged with: logitech
tagged with: lua
has answer: http://stackoverflow.com/a/78717085

http://stackoverflow.com/comment/138625878
score: 1
comment on: http://stackoverflow.com/a/78629336
type: AnswerComment
has text: thats the solution... Thank you very much man!
type: Comment

http://stackoverflow.com/q/78616651
tagged with: pandoc
type: UnansweredQuestion
score: 0
tagged with: pypandoc
has body: I'm using pypandoc to use pandoc in python to convert html to markdown I'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. I 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. Here is my pypandoc call: filters = ["lua/" + f for f in os.listdir("lua")] md = pypandoc.convert_file(source_file=sourcepath, format='html', to='gfm-raw_html', filters = filters) Here are some of my filters: lua/Nav.lua: function Nav(el) return {} end lua/Img.lua: function Img(el) if el.attributes.alt == "question_mark" then return ' "?" ' else return {} end end What I tried: Using lua filters in pypandoc. Expected behavior: The filters get applied. Actual behavior: The filters are ignored. Pypandoc converts files without applying any filters. No errors are thrown.
tagged with: python
answer count: 0
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/138614975
has title: pypandoc ignores lua filters

http://stackoverflow.com/comment/138838733
score: 0
comment on: http://stackoverflow.com/a/78745418
has text: Thank you that certainly works. That command to manipulate the HTML is what I hoped the Pandoc filter would do.
type: AnswerComment
type: Comment

puredata
type: Tag
tags question: http://stackoverflow.com/q/78678246
tag name: puredata

http://stackoverflow.com/comment/138807280
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78727370
score: 0
type: QuestionComment

http://stackoverflow.com/q/78655709
score: -1
has body: For some reason, my code doesn't work in any way. Does someone has an answer why UserInputService doesn't work for me? local player = game.Players.LocalPlayer local character = player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local debounce = false UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(input, typing) print("input") if typing then return end if input.UserInputType == Enum.UserInputType.MouseButton1 then print(player, " pressed lmb") end end) 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. I also tried changing devices, and currently writing this from my Laptop (I mainly do everything on PC.)
downvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/78655825
favorite count: 0
has title: UserInputService isn't detecting inputs
type: AnsweredQuestion
tagged with: roblox
upvote count: 0
tagged with: luau
tagged with: lua
has answer: http://stackoverflow.com/a/78655825
type: Question
tagged with: user-input
tagged with: roblox-studio

spring-boot
tags question: http://stackoverflow.com/q/78601647
tag name: spring-boot
type: Tag

http://stackoverflow.com/q/78628036
favorite count: 0
upvote count: 2
has body: 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? hs.hotkey.bind({ "cmd" }, "left", function() local win = hs.window.focusedWindow() local f = win:frame() local screen = win:screen() local max = screen:frame() f.x = max.x f.y = max.y f.w = max.w / 2 f.h = max.h win:setFrame(f, 0) end) and here is what happened to my computer when i try this hotkey
type: Question
answer count: 0
tagged with: macos
tagged with: lua
tagged with: hammerspoon
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/138831407
tagged with: screen
type: UnansweredQuestion
has title: Strange issue with hammerspoon window movement
has comment: http://stackoverflow.com/comment/140086263
has comment: http://stackoverflow.com/comment/138831424

http://stackoverflow.com/a/78711198
answers question: http://stackoverflow.com/q/78709542
score: 3
has comment: http://stackoverflow.com/comment/138823345
has body: 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: -- bit_shim_5_2.lua -- Defines a common interface to bit operations. local M = {} function M.bitop () print("Lua pre-5.3 bit ops") end return M -- bit_shim_5_3.lua -- Defines a common interface to bit operations. local M = {} function M.bitop () print("built-in Lua 5.3 bit ops") end return M -- main.lua local bit = nil local version = tonumber(string.sub(_VERSION, 5)) if version < 5.3 then bit = require("bit_shim_5_2") else bit = require("bit_shim_5_3") end bit.bitop() Running this program on Lua 5.4.7 yields: $ lua main.lua built-in Lua 5.3 bit ops
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/comment/139036849
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78817577
score: 0
has text: I wonder if it's possible with Varnish or HAProxy

http://stackoverflow.com/a/78621643
type: AcceptedAnswer
type: Answer
has body: The Gui is not located inside the player itself. it is actually inside Player.PlayerGui. but other than that if this is the LocalScript inside the Gui you could just do script.Parent: -- // Variables local Clicky = workspace:FindFirstChild("Upgrades"); local Gui = script.Parent; local Bloop = game:GetService("SoundService").UIbloop; Clicky.ClickDetector.MouseClick:Connect(function() Gui.Visible = true; Bloop:Play(); end)
score: 0
accepted answer of: http://stackoverflow.com/q/78621381
answers question: http://stackoverflow.com/q/78621381

http://stackoverflow.com/comment/138706478
comment on: http://stackoverflow.com/a/78672731
type: Comment
score: 0
has text: @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.
type: AnswerComment

http://stackoverflow.com/a/79179907
type: Answer
answers question: http://stackoverflow.com/q/78677429
has body: Here is the code snippet that works for me. cmp.setup { mapping = { [&quot;&lt;Tab&gt;&quot;] = function(fallback) local copilot_keys = vim.fn['copilot#Accept']() if cmp.visible() then cmp.select_next_item() elseif copilot_keys ~= '' and type(copilot_keys) == 'string' then vim.api.nvim_feedkeys(copilot_keys, 'i', true) else fallback() end end, }, experimental = { ghost_text = true, }, }
score: 0

http://stackoverflow.com/q/78660123
upvote count: 4
downvote count: 0
tagged with: lua
answer count: 1
score: 4
type: AnsweredQuestion
has body: My question is exactly as the heading. I can't find any good documentation explaining what it is and any usecase. I found the code being used in many many lua.init files (the file where neovim configs are kept). I've included a snippet. I know what it's doing. It is checking whether the path exists. But, why is it under loop and why is it called fs_stat? I'd greatly appreciate it if anyone could refer me to the documentation of vim or neovim that explains it.
tagged with: neovim
has answer: http://stackoverflow.com/a/78660636
has title: What is vim.loop.fs_stat()?
type: Question
favorite count: 0
accepted answer: http://stackoverflow.com/a/78660636

screen
type: Tag
tag name: screen
tags question: http://stackoverflow.com/q/78628036

http://stackoverflow.com/comment/138725299
comment on: http://stackoverflow.com/q/78667335
score: 0
type: QuestionComment
has text: updated to provide error message and the most basic case of it working whilst still very ocassionally getting the error
type: Comment

http://stackoverflow.com/a/78629336
has body: i is probably the string "1". 1 ~= "1" due to things of different types never being equal in Lua. So t[1] can be nil, while t["1"] can be something else. When you iterate with pairs, you also iterate over string keys. print("Index: " .. i) will then print Index: 1 if i is the string "1". It would also print the same if i was the number 1. Effectively, your print 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. I would recommend using something like inspect.lua or writing your own equivalent. For now, printing type(i) as well should tell you everything you need to know.
score: 5
answers question: http://stackoverflow.com/q/78629303
accepted answer of: http://stackoverflow.com/q/78629303
has comment: http://stackoverflow.com/comment/138625878
downvote count: 0
type: AcceptedAnswer
upvote count: 5
type: Answer

http://stackoverflow.com/q/78742067
score: 0
tagged with: roblox
answer count: 0
tagged with: lua
type: Question
tagged with: roblox-studio
has title: My animation in Roblox Studio plays, but in a actual Roblox game it dosen't play, but the projectile works
type: UnansweredQuestion
has body: My Problem is that the animation I labelled as FireballThrow 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. Here is my original code: My Local Script (Below) in the StarterPack folder: local player = game.Players.LocalPlayer local cooldown = false local UIS = game:GetService("UserInputService") local RS = game:GetService("ReplicatedStorage") local mouse = player:GetMouse() UIS.InputBegan:Connect(function(Input,gpe) if Input.KeyCode == Enum.KeyCode.E and not gpe and not cooldown then print("Skill Thrown") cooldown = true local animation = player.Character:WaitForChild("Humanoid"):LoadAnimation(script.FireballThrow) animation:Play() wait(.5) RS.ThrowRemote:FireServer(mouse.Hit.p) game.Debris:AddItem(animation,2) wait(2) cooldown = false end end) And my server side script (Below) in ServerScriptService: local remote = game.ReplicatedStorage.ThrowRemote remote.OnServerEvent:Connect(function(player,MousePosition) local fireball = game.ReplicatedStorage.Fireball:Clone() fireball.Parent = workspace fireball.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,-2) local NewForce = Instance.new("BodyForce") NewForce.Force = Vector3.new(0,workspace.Gravity * fireball:GetMass(),0) NewForce.Parent = fireball fireball.Velocity = CFrame.new(player.Character.HumanoidRootPart.Position,MousePosition).LookVector * 70 fireball.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and not hit:IsDescendantOf(player.Character) then hit.Parent.Humanoid.Health -= 50 -- You can choose how much damage they take fireball:Destroy() end wait(4) fireball:Destroy() end) end) I used RemoteEvents to trigger the server-side script. The animation for the fireball is nested in the local script, and the RemoteEvents and fireball model are in Replicated Storage. I've tried reaching out to other people who have made other functions to the code that work but the a…
has comment: http://stackoverflow.com/comment/138886623
tagged with: animation

http://stackoverflow.com/q/78613770
tagged with: lua
has body: 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. My best work (In Lua by the way) on this is as shows: local p = {"celeb","celery","carnita","bobby","logno","1x1x1","invalidcharacter"} local u = coroutine.create( function() for i,v in ipairs(p) do print("uscan", i) coroutine.yield() end end) for i=1,#p do coroutine.resume(u) end I need to find out if I can shorten function coroutine to be assigned to string "c" and if I can take player list "p" 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 here. What I do not 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 "c" and similar keywords shortened. I have tried things like local e = end 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.
has answer: http://stackoverflow.com/a/78615847
upvote count: 1
favorite count: 0
score: 0
type: AnsweredQuestion
has title: Lua Minimalization (literally minimizing it to it's smallest format)
downvote count: 1
has comment: http://stackoverflow.com/comment/138601146
answer count: 1
type: Question
accepted answer: http://stackoverflow.com/a/78615847

http://stackoverflow.com/comment/139083510
has text: 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? Try sending the request to https://grpcbin.test.k6.io/ and inspect the response to make sure the metadata is sent to the server.
type: Comment
comment on: http://stackoverflow.com/q/78677462
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138623955
type: Comment
comment on: http://stackoverflow.com/q/78623390
type: QuestionComment
has text: 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`
score: 0

http://stackoverflow.com/comment/138786901
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78717400
has text: @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.

http://stackoverflow.com/comment/138648743
has text: I am new to api, so may i know how u can find those parameter to pass into the api?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78640605
type: Comment

stream
tag name: stream
tags question: http://stackoverflow.com/q/78678801
type: Tag

http://stackoverflow.com/comment/138706252
has text: The problem is discussed here: https://gitlab.com/wireshark/wireshark/-/issues/18589
type: Comment
comment on: http://stackoverflow.com/a/78672731
type: AnswerComment
score: 1

http://stackoverflow.com/comment/138717675
comment on: http://stackoverflow.com/a/78678400
score: 0
type: AnswerComment
has text: @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).
type: Comment

http://stackoverflow.com/a/79237918
has body: The lua language server (lls) doesn't require love by default so, add this at every first line of any lua file that uses the love table. also with the love support extension you can use alt+l in order to run the project your in. local love = require("love")
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78595890

http://stackoverflow.com/q/78647187
has title: Nominatim 4.4.0 motorway_link not imported despite editing import.lua files
tagged with: lua
answer count: 0
tagged with: nominatim
type: UnansweredQuestion
tagged with: openstreetmap
has body: 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 https://download.geofabrik.de/europe/netherlands/flevoland-latest.osm.obf which is the smallest province of the netherlands. The import takes 30 minutes. call: [secret_url]/nominatim/reverse?format=geojson&lat=52.3976067014153&lon=5.348081447780394&adressdetails=1&zoom=17&namedetails=1 expected result { "type": "FeatureCollection", "licence": "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "features": [ { "type": "Feature", "properties": { "place_id": 10189945, "osm_type": "way", "osm_id": 6972708, "place_rank": 26, "category": "highway", "type": "motorway_link", "importance": 0.09999999999999998, "addresstype": "road", "name": "A6", "display_name": "A6, Almere, Flevoland, Nederland, 1336 ZG, Nederland", "address": { "road": "A6", "city": "Almere", "state": "Flevoland", "ISO3166-2-lvl4": "NL-FL", "country": "Nederland", "postcode": "1336 ZG", "country_code": "nl" }, "namedetails": { "ref": "A6" } }, "bbox": [ 5.3463977, 52.3966557, 5.3518242, 52.4009178 ], "geometry": { "type": "Point", "coordinates": [ 5.348065750718098, 52.397617756544484 ] } } ] } actual result { "type": "FeatureCollection", "licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright", "features": [ { "type": "Feature", "properties": { "place_id": 338896, "osm_type": "way", "osm_id": 261859776, "place_rank": 26, "category": "highway", "type": "motorway", "importance": 0.0533433333333333, "addresstype": "road", "name": "A6", "display_name": "A6, Almere, Flevoland, 1336 ZG, Nederland", "address": { "road": "A6", "city": "Almere", "state": "Flevoland", "ISO3166-2-lvl4": "NL-FL", "postcode": "1336 ZG", "country": "Nederland", "country_code": "nl" }, "namedetails": { "ref": "A6", "official_name": "A6" } }, "bbox": […
score: 0
type: Question

http://stackoverflow.com/comment/138823345
type: Comment
score: 1
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/78711198

http://stackoverflow.com/comment/138705688
type: AnswerComment
has text: 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?
comment on: http://stackoverflow.com/a/78672731
type: Comment
score: 0

http://stackoverflow.com/a/79372632
accepted answer of: http://stackoverflow.com/q/78677429
answers question: http://stackoverflow.com/q/78677429
score: 0
type: AcceptedAnswer
type: Answer
has body: I used these snippets: In cmp.lua: return { "hrsh7th/nvim-cmp", opts = function(_, opts) local cmp = require("cmp") opts.mapping["<Tab>"] = nil end } In astrocore.lua: return { "AstroNvim/astrocore", options = {...}, mappings = { i = { ["<CR>"] = "copilot#Accept('\\<CR>')" } } }

http://stackoverflow.com/comment/138783503
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78715199
has text: you have to combine PressKeySequenceA and MoveMouseRelative into a PressAndMoveAtSameTime function

http://stackoverflow.com/q/78720214
tagged with: lua
has comment: http://stackoverflow.com/comment/138797261
has comment: http://stackoverflow.com/comment/138794351
tagged with: roblox-studio
score: 0
type: Question
has answer: http://stackoverflow.com/a/79028876
has body: 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. game.Players.PlayerAdded:Connect(function(player) print("player join") if player.UserId == 3193848005 or 2601513514 then print("owner join") ms.stamina.Value = 250 ms.maxstamina.Value = 250 ms.recover.Value = 10 end end) 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?
has comment: http://stackoverflow.com/comment/138793747
tagged with: luau
tagged with: roblox
has comment: http://stackoverflow.com/comment/138797698
has comment: http://stackoverflow.com/comment/138797774
has title: Script not detecting when a player with a set ID joins. Luau
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/138676539
type: QuestionComment
comment on: http://stackoverflow.com/q/78656483
has text: 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`
score: 0
type: Comment

profanity
type: Tag
tags question: http://stackoverflow.com/q/78633861
tag name: profanity

http://stackoverflow.com/a/78640605
has comment: http://stackoverflow.com/comment/138648743
answers question: http://stackoverflow.com/q/78638625
score: 0
has comment: http://stackoverflow.com/comment/138648675
type: Answer
has body: I also couldn't get this to work with Splash. However, there is an API behind the site and you can just extract the data directly from that. This will grab the first page of 15 results. import requests headers = { 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0', 'Accept': '*/*', 'Accept-Language': 'en-US,en;q=0.5', } params = { 'uiLang': 'zh', 'uiCity': 'hongkong', 'districtId': '2008', 'regionId': '0', 'startAt': '0', 'rows': '15', 'pageToken': 'CONST_DUMMY_TOKEN', } response = requests.get('https://www.openrice.com/api/v2/search', params=params, headers=headers) data = response.json() for result in data["paginationResult"]["results"]: print(result["name"]) Here's what the data look like: Gram cafe & pancakes Lady Nara Mamaday Outdark (H8) Nara Thai Cuisine (港威商場) 十和田總本店 JUST'er Bar & Restaurant Amitie Kitchen The Grill Room (The Humphreys) Café Crêpe (K11購物藝術館) 牛魔 hoo韓國包車 古今二 (The ONE) 小魚兒 (金馬大廈) 鬼金棒 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. To implement pagination via the API you'd just need to loop over the requests, incrementing the value in the 'startAt' parameter by 15 each time. Stop when there are no new results.
has comment: http://stackoverflow.com/comment/138649959

http://stackoverflow.com/q/78717540
type: UnansweredQuestion
has title: Prevent duplication entry based on amount
score: 0
answer count: 0
has body: So I'm writing an inventory for a game in lua, but I have some issues when it saves the inventory. The function code is as follows function SaveInventory(source, offline) local source = source local xPlayer = ESX.GetPlayerFromId(source) local PlayerName = xPlayer.getName() items = AllItemData[source] local ItemsJson = {} if items and table.type(items) ~= 'empty' then for slot, item in pairs(items) do if items[slot] then for k, v in pairs(items) do ItemsJson[#ItemsJson + 1] = { name = v.name, amount = v.amount, info = v.info, type = v.type, slot = v.slot, } end end end MySQL.prepare('UPDATE users SET inventory = ? WHERE identifier = ?', { json.encode(ItemsJson), xPlayer.identifier }) end end The inventory saves fine, however, with every item it duplicates and I wonder why it's doing that. So with just a phone, it returns [ { "name": "phone", "amount": 1, "slot": 6, "info": [] } ] However if I add another item lets say a male id card to the inventory, it doubles the entry as such [ { "name": "idcard_m", "amount": 1, "slot": 7, "info": [] }, { "name": "phone", "amount": 1, "slot": 6, "info": [] }, { "name": "idcard_m", "amount": 1, "slot": 7, "info": [] }, { "name": "phone", "amount": 1, "slot": 6, "info": [] } ] 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. The expected behavior is that json.encode should return unduplicated as such [ { "name": "idcard_m", "amount": 1, "slot": 7, "info": [] }, { "name": "phone", "amount": 1, "slot": 6, "info": [] } ]
type: Question
tagged with: http://stackoverflow.com/tag/json
tagged with: lua
tagged with: fivem
has comment: http://stackoverflow.com/comment/138787432
has comment: http://stackoverflow.com/comment/138786304

http://stackoverflow.com/comment/138605405
comment on: http://stackoverflow.com/q/78617539
has text: I performed my test by using the working directory specified in `cwd` from launch.json. So they are identical.
score: 0
type: Comment
type: QuestionComment

placeholder
type: Tag
tags question: http://stackoverflow.com/q/78651730
tag name: placeholder

http://stackoverflow.com/comment/138786912
comment on: http://stackoverflow.com/q/78717400
has text: @Nifim -- `newproxy` is still in [Luau](https://luau-lang.org/), I believe.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/78637106
score: 0
type: Question
answer count: 0
has title: Visionary Render Lua, Moving Assembly
tagged with: lua
type: UnansweredQuestion
has body: 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). I'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. Does anyone know of a way to make it move at a specified velocity instead? Would be a huge help, thank you. :)

http://stackoverflow.com/comment/138686995
type: Comment
type: AnswerComment
score: 0
has text: 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.
comment on: http://stackoverflow.com/a/78654413

http://stackoverflow.com/q/78694409
answer count: 1
has body: 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. #include "Engine.h" #include <sol.hpp> void TestLua() { sol::state lua; // <-- This is causing linker errors } int main(int argv, char* argc[]) { TestLua(); return 0; } Solution Explorer file structure 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.
score: 0
type: Question
has comment: http://stackoverflow.com/comment/138745625
has answer: http://stackoverflow.com/a/78697973
tagged with: lua
has title: linker errors LNK2019 integrating Lua 503 into a C++ game engine using Sol v3.2.1
type: UnansweredQuestion
tagged with: lnk2019

http://stackoverflow.com/comment/138662484
has text: Nitpick: There aren't separate "array" and "dictionary" types in Lua. It's all tables; `pairs` doesn't guarantee any order.
comment on: http://stackoverflow.com/a/78647953
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/138833747
score: 2
type: Comment
comment on: http://stackoverflow.com/q/78744024
type: QuestionComment
has text: 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...

static-analysis
tags question: http://stackoverflow.com/q/78676102
tag name: static-analysis
type: Tag

http://stackoverflow.com/comment/138583183
has text: 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/
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78595890
type: QuestionComment

import
tag name: import
type: Tag
tags question: http://stackoverflow.com/q/78647470

http://stackoverflow.com/comment/138780997
has text: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
type: Comment
comment on: http://stackoverflow.com/q/78712098
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138778511
has text: How is this related to Python or FastAPI?
type: Comment
comment on: http://stackoverflow.com/q/78712098
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138782728
has text: 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.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78715199
type: Comment

http://stackoverflow.com/a/78672731
answers question: http://stackoverflow.com/q/78672665
score: 0
has comment: http://stackoverflow.com/comment/138706091
has comment: http://stackoverflow.com/comment/138706166
has comment: http://stackoverflow.com/comment/138705797
has body: The error says: Proto new: there cannot be two protocols with the same description. So what is a description? According to the documentation, description is the second parameter to the Proto function. So <snip> is the description, when you do xran_protocol = Proto("xran", "<snip>") in one file and then xran_cplane_proto = Proto("cplane", "<snip>") in another you are using the same description twice. You simply need to change one of those descriptions to make it unique from the other. Also if you are running general.lua 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. local general = {} -- Create a protocol object general.xran_protocol = Proto("xran", "<snip>") <snip> ... return general Or less properly, you could have the file add its output to the packages which will then return that output to any call of require 'general' package.loaded['general'] = { xran_protocol = xran_protocol } and change the other file to local general = require "general" ... debug_level = general.xran_protocol.prefs.c_plane_debug_level
has comment: http://stackoverflow.com/comment/138706252
type: Answer
has comment: http://stackoverflow.com/comment/138706478
has comment: http://stackoverflow.com/comment/138705688

http://stackoverflow.com/q/78678246
linked to: http://stackoverflow.com/q/4800605
tagged with: http://stackoverflow.com/tag/json
has body: 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): ofelia f; resp = ofLoadURL("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY&date=2024-06-06"); text = resp.data:getText(); print(text); return(anything); 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 (Iterating through objects in JsonCpp) 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: Json::Value root; Json::Reader parser; // Parse the json (using the text in the code above) parser.parse( text, root ); // Get the url print(root["url"]);
tagged with: puredata
has title: How to parse JSON with Ofelia in Puredata
type: Question
answer count: 0
tagged with: lua
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/138614975
comment on: http://stackoverflow.com/q/78616651
type: QuestionComment
type: Comment
score: 0
has text: The filter functions must match the names that pandoc uses in it's internal data structure; so for example `Image` instead of `Img`.

http://stackoverflow.com/comment/139473511
comment on: http://stackoverflow.com/a/78615847
has text: 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?
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/138610980
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78621381
has text: [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551)
score: 1

http://stackoverflow.com/q/78727370
has comment: http://stackoverflow.com/comment/138807280
has title: Can nginx's njs (or Lua?) be used to replace a header with that header's SHA-512?
type: Question
upvote count: 0
linked to: http://stackoverflow.com/q/78722188
tagged with: lua
has body: I need to replace one log field, from nginx.conf, with its SHA-512 hash, for security reasons. I'd prefer to do this with njs, but would consider Lua. However, the only way I know of to modify a log field is js_set, but js_set wants synchronous code, while njs' crypto.subtle.digest("SHA-512", msgUint8) is asynchronous. Is there an alternative to js_set that can accept an asynchronous function, that can be used in the http block of an nginx.conf? 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. Here's a summarized version of what I have right now: nginx.conf, in the http section: js_import obfuscate.js; js_set $obfuscated_token obfuscate.get_obfuscated_token_test; log_format main escape=json '{' '"http_authorization":"$obfuscated_token",' '}'; And a little test code in obfuscate.js: async function get_obfuscated_token_test(r) { return "abc"; } This replaces the http_authorization field with: "http_authorization":"[object Promise]" ...which is not what I want. Instead of [object Promise], I want a SHA-512 hash in hexadecimal, or at least just "abc".
tagged with: njs
downvote count: 1
answer count: 1
type: UnansweredQuestion
tagged with: nginx
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/78732351

http://stackoverflow.com/comment/138682490
comment on: http://stackoverflow.com/q/78659386
has text: 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 '$$'*.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/138606115
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78617539
has text: where is LuaXML_lib on your machine?
type: QuestionComment

http://stackoverflow.com/comment/139070654
score: 0
comment on: http://stackoverflow.com/a/78817577
type: Comment
has text: 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
type: AnswerComment

http://stackoverflow.com/comment/138700101
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78668370
has text: 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.
type: AnswerComment

http://stackoverflow.com/q/78705996
tagged with: roblox
score: 0
tagged with: lua
has answer: http://stackoverflow.com/a/79024931
answer count: 1
tagged with: roblox-studio
type: Question
has title: How do I make a hitbox part move with the character
has body: Is it possible to make a part that is welded to the Humanoid Root Part move with it? It serves as a hitbox, but I encounter the problem that if I move forward while attacking it hurts the player. For this I have 2 scripts Local Script: `local cas = game:GetService("ContextActionService") local rs = game:GetService("ReplicatedStorage") local events = rs:WaitForChild("Events") local hitbox = events:WaitForChild("Hitbox") local plr = game.Players.LocalPlayer local character = plr.Character if not character then plr:WaitForChild("Character") end local humanoid = character.Humanoid local animator = humanoid:WaitForChild("Animator") local idle = animator:LoadAnimation(script:WaitForChild("idle")) local jab = animator:LoadAnimation(script:WaitForChild("jab")) local rightcross = animator:LoadAnimation(script:WaitForChild("rightstraight")) local lefthook = animator:LoadAnimation(script:WaitForChild("lefthook")) local currentPunch = 0 local debounce = false local function punch() if debounce then return end debounce = true if currentPunch == 0 then jab:Play() hitbox:FireServer(Vector3.new(3, 5, 2), Vector3.new(4.5, 1), 10, 0.1) task.wait(0.5) jab:Stop() debounce = false elseif currentPunch == 1 then jab:Play() hitbox:FireServer(Vector3.new(3, 5, 2), Vector3.new(4.5, 1), 10, 0.1) task.wait(0.5) jab:Stop() debounce = false elseif currentPunch == 2 then rightcross:Play() hitbox:FireServer(Vector3.new(3, 5, 2), Vector3.new(4.65, 1), 10, 0.1) task.wait(0.5) rightcross:Stop() debounce = false elseif currentPunch == 3 then lefthook:Play() hitbox:FireServer(Vector3.new(3, 5, 2), Vector3.new(4, 1), 10, 0.2) task.wait(0.5) lefthook:Stop() debounce = false end if currentPunch == 3 then currentPunch = 0 debounce = true wait(1.5) debounce = false else currentPunch += 1 end end cas:BindAction("Punch", punch, true, Enum.UserInputType.MouseButton1) and the server sided one: local rs = game:GetService("ReplicatedStorage") local events = rs:WaitForChild("Events") local hitboxEvent = events:Wai…
type: UnansweredQuestion
tagged with: luau

http://stackoverflow.com/q/78617539
has comment: http://stackoverflow.com/comment/138611309
answer count: 0
has title: lua require works in CMD but not in VSCode debugger
tagged with: visual-studio-code
type: Question
has comment: http://stackoverflow.com/comment/138605405
has comment: http://stackoverflow.com/comment/138605068
tagged with: lua
type: UnansweredQuestion
has body: I'm trying to debug a lua program using VSCode with Lua Debug. This is the program require 'luaxml' print('Hello') When I run it from the CMD it works fine. But when I run it from VSCode it complains the library cannot be found 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: no field package.preload['LuaXML_lib'] no file './LuaXML_lib.lua' no file 'C:/Program Files (x86)/Lua/5.1/lua/LuaXML_lib.lua' no file 'C:/Program Files (x86)/Lua/5.1/lua/LuaXML_lib/init.lua' no file 'C:/Program Files (x86)/Lua/5.1/LuaXML_lib.lua' no file 'C:/Program Files (x86)/Lua/5.1/LuaXML_lib/init.lua' no file 'C:/Program Files (x86)/Lua/5.1/lua/LuaXML_lib.luac' no file 'C:\Users\Me\Documents/LuaXML_lib.lua' no file 'C:\Program Files (x86)\Lua\5.1/LuaXML_lib.lua' no file 'C:\Users\Me\Documents\LuaXML_lib.lua' no file 'C:\Users\Me\Documents\LuaXML_lib.dll' no file 'C:\Program Files (x86)\Lua\5.1/LuaXML_lib.dll' no file 'C:\Users\Me\Documents\LuaXML_lib.dll' stack traceback: [C]: in function 'require' C:/Program Files (x86)/Lua/5.1/lua/luaxml.lua:1: in main chunk [C]: in function 'require' ...Documents\test.lua:4: in main chunk [C]: ? This is the content of my launch.json. I have specified the path to the lua that runs when I call which lua from the CMD. { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "lua", "luaexe": "C:\\Program Files (x86)\\Lua\\5.1\\lua.exe", "request": "launch", "luaVersion": "lua51", "luaArch": "x86", "name": "Debug", "program": "C:\\Users\\Me\\Documents\\test.lua", "cwd": "C:\\Users\\Me\\Documents", "arg": ["C:\\Users\\Me\\Documents\\output"] } ] } 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 specifie…
has comment: http://stackoverflow.com/comment/138606115
score: 0

http://stackoverflow.com/comment/138568521
score: 0
comment on: http://stackoverflow.com/q/78598446
type: QuestionComment
has text: @shingo why is it wrong? it works https://onecompiler.com/lua/42fqg7s34 what I am missing? =(
type: Comment

http://stackoverflow.com/comment/138797698
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78720214

http://stackoverflow.com/comment/138827423
has text: Tokens are mostly handled for *"properties"*, there are several places where there are not handled (`filter` and as you discover `include`).
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78734889

http://stackoverflow.com/comment/139160854
has text: 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
comment on: http://stackoverflow.com/q/78678801
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/138573858
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78595890
has text: 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
type: Comment

http://stackoverflow.com/q/78601647
type: Question
has body: 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. -- Handler.lua local http = require "resty.http" local utils = require "kong.tools.utils" local cjson = require("cjson") local MessageForwarder = { VERSION = "1.0", PRIORITY = 1000, } local function forward_message(conf, request_method, request_path, request_headers, request_body) -- Make HTTP Request local httpc = http.new() local res, err = httpc:request_uri(conf.forward_host .. request_path, { method = request_method, headers = request_headers, body = request_body, ssl_verify = false }) -- Checking response if not res then kong.log.err("Failed to forward request: ", err) return kong.response.exit(500) end if res.status ~= 200 then kong.log.err("Responded with status: ",res.status) return kong.response.exit(500) end return true -- all is well end local function forward_message_new(conf, request_method, request_path, request_headers, request_body) local server = assert(socket.bind("*", 0)) end function MessageForwarder:access(conf) local request_path = kong.request.get_raw_path() local request_method = kong.request.get_method() local request_headers = kong.request.get_headers() local raw_request_body if raw_request_method ~= "GET" then raw_request_body = kong.request.get_raw_body() end local request_body = cjson.decode(raw_request_body) local auth_path = conf.auth_token_b2b_endpoint local bool = forward_message(conf, request_method, request_path, request_headers, request_body) return true end return MessageForwarder 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: WARN 20440 --- [nio-8010-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Ignoring exception, response committed already: org.springframework.http.converter.HttpMessageNotReadableException: I/…
tagged with: spring-boot
downvote count: 0
answer count: 0
tagged with: lua
tagged with: kong-plugin
has title: Custom Lua Plugin in Kong Failed to Properly Send HTTP Request to Spring Boot Rest API (or the other way around)
tagged with: kong
upvote count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: rest

http://stackoverflow.com/tag/mp4
tag name: mp4
type: Tag
tags question: http://stackoverflow.com/q/78672216

http://stackoverflow.com/a/78874987
answers question: http://stackoverflow.com/q/78704192
score: 0
type: Answer
has body: In your Lua filter filter.lua use somehting like the following: local links = {} Link = function(link) table.insert(links, pandoc.Plain(link)) end Pandoc = function(elem) return elem:walk{ Block = function(s) if pandoc.utils.stringify(s) == "YOURSOURCES" then return {pandoc.BulletList(links)} end end } end with this markdown document input.md ([Link 1](http://www.somedomain.org)) ([Link 2](http://www.anotherdomain.org)) [YOURSOURCES]{custom-style="Sources"} and the following pandoc commmand pandoc input.md -f markdown -t markdown --lua-filter filter.lua You get this output: ([Link 1](http://www.somedomain.org)) ([Link 2](http://www.anotherdomain.org)) - [Link 1](http://www.somedomain.org) - [Link 2](http://www.anotherdomain.org)

http://stackoverflow.com/a/78668370
answers question: http://stackoverflow.com/q/78659386
has comment: http://stackoverflow.com/comment/138700101
has comment: http://stackoverflow.com/comment/138703730
has body: You could do this by splitting the string on $$ occurrences. Given the input of something like Some text $$ Something else $$ Some more text $$ Another example $$ end local inputStr = Some text $$ Inside area $$ Some more text $$ Another $$ end -- Taken from https://stackoverflow.com/questions/1426954/split-string-in-lua function splitString(inputstr, sep) if sep == nil then sep = "%s" end local t = {} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do table.insert(t, str) end return t end local stringParts = splitString(inputStr, "$$") for i, v in ipairs(stringParts) do if i % 2 == 0 then -- When i is a multiple of 2 its inside the $$ tags, supports multi line print("$$ area detected", i, v) end end 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. 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.
upvote count: 1
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/comment/138704656
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78672216
has text: 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?

http://stackoverflow.com/comment/138782719
type: Comment
score: 0
type: QuestionComment
has text: @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
comment on: http://stackoverflow.com/q/78715199

http://stackoverflow.com/q/78740442
tagged with: c++
type: UnansweredQuestion
has title: Error parsing config from lua tables in boost unit test
answer count: 0
score: 0
type: Question
tagged with: lua
tagged with: access-violation
has body: 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 here as the lua-managing library. stack trace of error The code I'm running is pretty simple: BOOST_AUTO_TEST_CASE(SCENARIO_LOGIN_TEST) { sZone->general_conf().set_test_run(); sZone->general_conf().set_config_file_path("../../../../../config/zone-server.lua.dist"); sZone->read_config(); sZone->config().set_static_db_path(std::string("../../../../../db/")); HLog(info) << "Static database path set to " << sZone->config().get_static_db_path() << ""; sZone->config().set_mapcache_path(std::string("../../../../../db/maps.dat")); HLog(info) << "Mapcache file name is set to " << sZone->config().get_mapcache_path() << ", it will be read while initializing maps."; sZone->config().set_script_root_path(std::string("../../../../../scripts/")); sZone->initialize(); sZone->finalize(); } Any more project related code can be found here

http://stackoverflow.com/a/78654413
score: 1
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/138686995
has body: 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. If you will 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 never get a CROSSSLOT error. Of course, that means that these particular keys can never benefit from clustering. So, tradeoffs. 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. WATCH DATA:{color}:ID1 GET DATA:{color}:ID1 // returns red MULTI SADD INDEX:{color}:blue ID1 SREM INDEX:{color}:red ID1 SET DATA:{color}:ID1 blue EXEC Hope this helps!
downvote count: 0
has comment: http://stackoverflow.com/comment/138688210
answers question: http://stackoverflow.com/q/78654335

http://stackoverflow.com/comment/138665613
type: Comment
score: 0
has text: @MatthewKlassen If my answer solved your problem, please accept it with the check mark.
type: AnswerComment
comment on: http://stackoverflow.com/a/78650316

http://stackoverflow.com/q/78678707
has answer: http://stackoverflow.com/a/78678874
tagged with: lua
answer count: 1
score: 0
has title: Converting Measurement Signal to Hexadecimal String in Lua for Excel Template Integration
type: Question
tagged with: hex
tagged with: excel
has body: 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: _lua(R"§("string.format("%8X", @measdata:Diag_DTC[1].max($tStep1,$tStep1End))")§") The signal from the array, for example, @measdata:Diag_DTC[1].max($tStep1,$tStep1End) which equals 10555136, should be converted to A10F00. Does anyone have any suggestions on how to fix this? Thank you in advance.
type: UnansweredQuestion

http://stackoverflow.com/a/78660636
accepted answer of: http://stackoverflow.com/q/78660123
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0
has body: First of all, vim.loop is now called vim.uv: https://github.com/neovim/neovim/pull/22846 But before that change, the documentation said this: vim.loop exposes all features of the Nvim event-loop. Anyway, that's the luv library for Lua (https://github.com/luvit/luv), which is a wrapper around the libuv library for C (https://github.com/libuv/libuv). luv calls it fs_stat because the library it's wrapping calls it uv_fs_stat. The fs part of the name is because it's a file system operation. The stat part of the name is because that's the name of the underlying syscall: Equivalent to stat(2), fstat(2) and lstat(2) respectively. And stat is short for status, 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.)
score: 3
answers question: http://stackoverflow.com/q/78660123

http://stackoverflow.com/comment/138782344
type: Comment
score: 0
type: QuestionComment
has text: _"...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?
comment on: http://stackoverflow.com/q/78715199

http://stackoverflow.com/q/78638625
tagged with: scrapy
answer count: 1
type: UnansweredQuestion
has body: I am recently try using scrapy splash to scrape data from a website that loads more data when scrolls to bottom. website: https://www.openrice.com/zh/hongkong/restaurants/district/%E5%B0%96%E6%B2%99%E5%92%80 so I first try to perform scrolling in console of dev tools using JavaScript: for (let i = 0; i < 5; i++) { setTimeout(() => window.scrollTo(0, (document.body.scrollHeight-1500)), i * 2000); } (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) The js code works perfectly when do this in the dev tool on browser, so i put this in scrapy splash: and here's my code: import scrapy from Task2.items import RestaurantItem from scrapy_splash import SplashRequest lua_script = """ function main(splash, args) splash:go(args.url) splash:wait(5.0) local scroll = splash:jsfunc([[ function scrollWithDelay() { for (let i = 0; i < 5; i++) { setTimeout(() => window.scrollTo(0, (document.body.scrollHeight-1500)), i * 2000); } } ]]) scroll() splash:wait(5.0) return {html = splash:html()} end """ class OpenriceTstSpider(scrapy.Spider): name = "openrice_tst" allowed_domains = ["www.openrice.com"] def start_requests(self): url = "https://www.openrice.com/zh/hongkong/restaurants/district/%E5%B0%96%E6%B2%99%E5%92%80" yield SplashRequest(url, callback=self.parse, endpoint='execute', args={'wait': 2, 'lua_source': lua_script, 'viewport': '1920x1080', url: "https://www.openrice.com/zh/hongkong/restaurants/district/%E5%B0%96%E6%B2%99%E5%92%80"}) def parse(self, response): ... 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. 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 not 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 c…
tagged with: lua
tagged with: javascript
tagged with: scrapy-splash
tagged with: web-scraping
has title: Scrapy splash cannot perform js like what I did directly in the browser terminal
type: Question
has answer: http://stackoverflow.com/a/78640605
score: 0

http://stackoverflow.com/q/78709542
score: 4
has title: Lua conditional evaluation of new language operators
favorite count: 0
accepted answer: http://stackoverflow.com/a/78709647
has answer: http://stackoverflow.com/a/78711198
type: Question
has comment: http://stackoverflow.com/comment/138774855
tagged with: wireshark
upvote count: 4
tagged with: wireshark-dissector
downvote count: 0
has comment: http://stackoverflow.com/comment/138778128
has body: 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. 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: local bit = nil if tonumber(string.sub(_VERSION, 5)) < 5.3 then bit = require("bit") end local version_byte = 0xaf if bit then print("BitOp method") else print((version_byte >> 4) * 10 + (version_byte & 0xf)) end The issue is that Lua 5.2 (of course) doesn't recognize the bitwise shift and & operators and throws unexpected symbol near '>'. Is there a way to conditionally evaluate something like this?
tagged with: lua
possible better answer: http://stackoverflow.com/a/78711198
has answer: http://stackoverflow.com/a/78709647
type: AnsweredQuestion
answer count: 2

http://stackoverflow.com/comment/138706166
has text: 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.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78672731
type: AnswerComment

http://stackoverflow.com/comment/138701830
type: Comment
comment on: http://stackoverflow.com/q/78667335
has text: 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) ??
score: 2
type: QuestionComment

http://stackoverflow.com/comment/138787049
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78717555
type: Comment
has text: Ehh, tried that. .Changed doesn't work on numbers :/, and max stamina will be able to change. Thanks though

http://stackoverflow.com/comment/138568638
comment on: http://stackoverflow.com/q/78598446
type: Comment
has text: @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.....
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138715485
type: Comment
has text: @tkausl: it's a table with two parameters. Isn't it ?
comment on: http://stackoverflow.com/q/78678155
score: 0
type: QuestionComment

grpc
tags question: http://stackoverflow.com/q/78673757
tags question: http://stackoverflow.com/q/78677462
tag name: grpc
type: Tag

http://stackoverflow.com/comment/138786945
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78717400
has text: I am trying to make it run in Luau (aka Lua 5.1 Fork, Roblox). The rest of the Checks work fine.

http://stackoverflow.com/comment/138781716
type: Comment
has text: Is there something wrong with putting the second snippet at the top of the function?
comment on: http://stackoverflow.com/q/78715199
type: QuestionComment
score: 0

cs50
tag name: cs50
type: Tag
tags question: http://stackoverflow.com/q/78650171

http://stackoverflow.com/comment/139063435
comment on: http://stackoverflow.com/q/78704192
has text: Please show your Lua filter (at least the relevant parts)
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138568457
score: 1
has text: The code you showed is totally wrong, or did you omit any important part?
type: Comment
comment on: http://stackoverflow.com/q/78598446
type: QuestionComment

http://stackoverflow.com/comment/140086263
type: QuestionComment
comment on: http://stackoverflow.com/q/78628036
type: Comment
has text: 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.
score: 0

http://stackoverflow.com/a/78637013
answers question: http://stackoverflow.com/q/78633143
type: Answer
score: 0
has body: Roblox Studio does not support documentation comments so adding any comments to code won't be reflected in its popup. Documentation comments for Roblox Studio has been requested for years now on the Roblox Developer Forum: Custom Intellisense Documentation Comments Add script editor support for Lua code documentation using comments (DocBlocks) 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: What do you guys think about User user defined function Documentation? A FFlag option 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 Visual Studio Code which does support code documentation using the syntax you are describing. -- Given a string, turns it into a number local function numberify(n: string): () return tonumber(n) end For the above in Visual Studio Code, it shows the popup as: Given a string, turns it into a number

http://stackoverflow.com/a/78651099
score: 2
downvote count: 0
upvote count: 2
type: Answer
has body: I'll just quote Programming in Lua: A coroutine is similar to a thread (in the sense of multithreading): a line of execution, with its own stack, its own local variables, and its own instruction pointer; but sharing global variables and mostly anything else with other coroutines. The main difference between threads and coroutines is that, conceptually (or literally, in a multiprocessor machine), a program with threads runs several threads concurrently. Coroutines, on the other hand, are collaborative: 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. Hence there is no function to run several coroutines concurrently. 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. You'll find some libraries to work around this though.
answers question: http://stackoverflow.com/q/78649692

http://stackoverflow.com/comment/138615244
score: 0
type: AnswerComment
type: Comment
has text: UPDATE: I upgraded neovim and ran into other issues with my config but NOT this one. Thanks!
comment on: http://stackoverflow.com/a/78615867

http://stackoverflow.com/comment/138676426
score: 0
type: QuestionComment
has text: 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?
comment on: http://stackoverflow.com/q/78656483
type: Comment

http://stackoverflow.com/a/78713967
downvote count: 0
has body: The first answer is correct, but if the module is not found, then require will not return nil! Use this check when loading a module: local _, ms = pcall(require, game.ReplicatedStorage.ModuleScript) if type(ms)~="table" then ms = require( game.ReplicatedStorage:WaitForChild("ModuleScript") ) end
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/78710890
score: 1

http://stackoverflow.com/a/78658754
has body: So if I understand this correctly, Lua data types of string, numbers are values, while functions and tables are references. Since your question is ultimately about implementation details (e.g. memory usage): It is a bit more nuanced than this. Lua values are effectively a "tagged union": 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 "reference" types. nil, booleans, and numbers in Lua are "primitive" 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 NaN boxing), so they are copied on every assignment. The value is just the boolean or floating-point number value. Not copying them (referencing them) would be more expensive than copying them. Strings behave like a "value" 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 "copied" - only the reference (a pointer with a type tag) is being copied. This means that when you do local x = ..., 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. So this should theoretically improve speed by a bit since we're assigning it to a local variable 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 "smart" implementations like LuaJIT. but I wonder if doing so will consume significantly more memory Usually not signif…
has comment: http://stackoverflow.com/comment/138686637
score: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78658056
type: AcceptedAnswer
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/138708668
answers question: http://stackoverflow.com/q/78658056

http://stackoverflow.com/comment/138755314
score: 0
comment on: http://stackoverflow.com/q/78698546
type: Comment
has text: 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
type: QuestionComment

http://stackoverflow.com/comment/138797261
has text: The condition is also not always true. It's only true if Users ID is matching.
comment on: http://stackoverflow.com/q/78720214
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/78701312
type: Answer
has comment: http://stackoverflow.com/comment/138804394
has body: It seems that LuaSocket can be a good answer: https://w3.impa.br/~diego/software/luasocket/socket.html#gettime You can have even more precise timing with LuaPosix: https://luaposix.github.io/luaposix/modules/posix.time.html#clock_gettime but for some I cannot make it work on my machine (the clock_gettime function returns a number instead of a table with the seconds and the nanoseconds). So LuaSocket may be a safer choice. With LuaSocket: local socket = require('socket') test = function() print(">>>>>>>>start record id: ", record_id) local t = socket.gettime() ... body ... print(">>>>>>>>end record id: ", record_id, "time taken: ", socket.gettime() - t) end With LuaPosix: local posix = require('posix') test = function() print(">>>>>>>>start record id: ", record_id) local t = posix.clock_gettime(0) ... body ... local t2 = posix.clock_gettime(0) local elapsed_time = end_time.tv_sec - start_time.tv_sec + (end_time.tv_nsec - start_time.tv_nsec) print(">>>>>>>>end record id: ", record_id, "time taken: ", elapsed_time) end 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.
answers question: http://stackoverflow.com/q/78693254
has comment: http://stackoverflow.com/comment/138763484
score: 0

http://stackoverflow.com/comment/138787432
comment on: http://stackoverflow.com/q/78717540
type: Comment
score: 0
type: QuestionComment
has text: 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

http://stackoverflow.com/q/78657809
tagged with: logitech-gaming-software
has body: 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. 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. 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. I've also add another function on the top of the script "function math.pow(x,y) return x^y end" because I had similar error before like this one Attempt to call nil value, when run on g hub am fairly new to Lua and don't really know the mechanics. so I really ask for you help, thank you guys enter image description here -------------------------------------------------------------------------- -------------------------------------------------------------------------- ---- key bind ---- local scarl_key = nil local ump9_key = nil local hold_breath_key = "lshift" local m416_key = 11 local set_off_key = 10 local akm_key = nil local m16a4_key = nil local uzi_key = nil ---- control_key ---- local control_key = "lctrl" ---- can use "lalt", "ralt", "alt" "lshift", "rshift", "shift" "lctrl", "rctrl", "ctrl" local ignore_key = "lalt" --- ignore key --- fastloot setting--- --- Press controlkey and and ignore_key and click Left mouse button --- --- "lctrl" + "lalt" + mousebutton local control_key = "lctrl" local fastloot = false ---if you don't need it, you can close it by true to false. local move = 40 ----1920*1080 ---- only can use "numlock", "capslock", "scrolllock" local full_mode_key = "numlock" ---numlock lamp on,recoil is full_mode."numlock" local mode_switch_key = "capslock" local lighton_key = "scrolllock" ---start script,scrolllock l --- Your Sensitivity in Game amp will be on.close script ,scrolllock lamp will…
type: UnansweredQuestion
has title: logitech ghub can not run old script from LGS
linked to: http://stackoverflow.com/q/67126798
score: 0
type: Question
answer count: 0
tagged with: lua

http://stackoverflow.com/comment/138742490
has text: 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).
comment on: http://stackoverflow.com/q/78693009
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/78624992
has title: attempt to concatenate string with nil | Roblox Code, How to fix?
tagged with: lua-scripting-library
type: Question
has body: I've been working on a GUI system where I have a health, stamina and EXP bar. Once I finally got towards the end, I was given an error message on this part of code, saying: attempt to concatenate string with nil HealthDisplay.Text = "HP: " .. Humanoid.Health .. "/" .. Humanoid.MaxHealth StaminaDisplay.Text = "Stamina: " .. Stamina.Value .. "/" .. MaxStamina.Value LvlDisplay.Text = "Lvl: " .. Level.Value Im not sure how to fix this. I tried using the "tostring()" function but it would only say "nil" on the bars rather than the number.
upvote count: 1
tagged with: roblox
tagged with: lua
has answer: http://stackoverflow.com/a/78629324
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/138618571
tagged with: roblox-studio
answer count: 1
type: UnansweredQuestion
tagged with: string
favorite count: 0

http://stackoverflow.com/q/78654335
has title: How to modify existing and new string index in Redis?
has body: I am storing strings and numbers in Redis. I use basic key value stores to keep track of the current color value. DATA:color:ID1 = red DATA:color:ID2 = red DATA:color:ID3 = red DATA:color:ID4 = blue I use SETs to allow for quick lookup of colors and corresponding IDs. INDEX:color:red = {ID1, ID2, ID3} INDEX:color:blue = {ID4} How should I go about updating these values? If ID1 becomes blue, we will need to run the following commands: SADD INDEX:color:blue ID1 SREM INDEX:color:red ID1 SET DATA:color:ID1 blue 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: -- ARGV[1] is the index key -- ARGV[2] is the ID -- ARGV[3] is the new value local k = redis.call('GET', KEYS[1]) redis.call('SREM', ARGV[1] .. &quot;:&quot; .. k, ARGV[2]) redis.call('SADD', ARGV[1] .. &quot;:&quot; .. ARGV[3], ARGV[2]) redis.call('SET', KEYS[1], ARGV[3]) Example usage would look like: EVALSHA &lt;SHA&gt; 1 DATA:color:ID1 INDEX:color ID1 blue If I were storing numbers, this is trivial as I can use sorted sets. Is there a way to achieve this without violating the guidelines?
score: 0
has answer: http://stackoverflow.com/a/78654413
type: Question
tagged with: lua
tagged with: redis
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/138708079
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78672216
has text: @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).
type: QuestionComment

http://stackoverflow.com/comment/138786639
comment on: http://stackoverflow.com/q/78717783
type: Comment
score: 0
has text: 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`
type: QuestionComment

http://stackoverflow.com/comment/138825616
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78736450
has text: @adabsurdum right, that makes sense. Thanks!

http://stackoverflow.com/comment/138661023
has text: Perhaps better suited to https://codereview.stackexchange.com
type: Comment
comment on: http://stackoverflow.com/q/78647470
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138743732
comment on: http://stackoverflow.com/q/78693947
type: Comment
score: 0
type: QuestionComment
has text: `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.

http://stackoverflow.com/a/78638733
downvote count: 0
answers question: http://stackoverflow.com/q/78638506
has body: I'm assuming you've seen other posts that tell you to use [^sep] to split a string by the sep character. These work, but only for one character long separators. So for your pattern, [^\\scalebox]+, we will split on ALL the characters \,s,c,a,l,e,b,o, or x. Which results in the list of strings that you're getting: "m", "t", "t", "{0.74}". Since you want to split on text, rather than characters, you can use string.find to find the index of your "\scalebox", and then string.sub to substring around that index: local s = "sometext\\scalebox{0.74}" local pattern = "\\scalebox" local index = s:find(pattern) local first = s:sub(1, index - 1) local second = s:sub(index + string.len(pattern), string.len(s)) 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.
type: AcceptedAnswer
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/78638506

http://stackoverflow.com/a/78647643
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78647470
answers question: http://stackoverflow.com/q/78647470
has body: You could set a recursion limit so that it will recursively load the imports until it reaches a certain depth. function search_for_import(tex, depth) -- First time this is called set depth to 0 if depth > 5 then return end local tbl = {} for j = 1, #rows_from(tex) do if string.sub(rows[j],1,7) == "\\import" then table.insert(tbl,{ [1] = j, --line [2] = string.sub(rows[j],13,-2), --file name }) print(string.sub(rows[j],13,-2)) search_for_import(string.sub(rows[j],13,-2), depth + 1) end end ... Rest of the code This way it only ever recurses to a depth of 5. 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) function tableContains(haystack, needle) for _, v in ipairs(haystack) if v == needle then return true end end end function search_for_import(tex, visited) -- First time this is called set visited to an empty array if tableContains(visited, tex) then return -- Dont visit an import weve already seen. end table.insert(visited, tex) local tbl = {} for j = 1, #rows_from(tex) do if string.sub(rows[j],1,7) == "\\import" then ... search_for_import(string.sub(rows[j],13,-2), visited) end end ... Rest of the code os.execute("move "..temp.." "..tex) --final result table.remove(visited, #visited) end
downvote count: 0
type: AcceptedAnswer
type: Answer

excel
tag name: excel
type: Tag
tags question: http://stackoverflow.com/q/78678707

http://stackoverflow.com/comment/138833857
type: QuestionComment
comment on: http://stackoverflow.com/q/78744024
has text: That would be far better and describes the content.
type: Comment
score: 1

http://stackoverflow.com/q/78620746
type: Question
has answer: http://stackoverflow.com/a/78621611
tagged with: lua
tagged with: roblox
tagged with: roblox-studio
has title: How to spawn part 35 studs in front of player, facing same direction as player?
score: 0
has body: 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 this video for example. local player = game.Players.LocalPlayer local char = player.Character local rootPart = char:WaitForChild("HumanoidRootPart") local wall = workspace.FX:WaitForChild("Wall") -- Note that the wall is cloned into the FX folder in a different script. wall.Position = rootPart.CFrame.LookVector.Unit * 35 + rootPart.Position
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/138775128
type: Comment
comment on: http://stackoverflow.com/a/78710977
score: 1
type: AnswerComment
has text: 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.

http://stackoverflow.com/q/78704192
has comment: http://stackoverflow.com/comment/139063435
answer count: 1
has comment: http://stackoverflow.com/comment/139063461
has body: I am trying to take a markdown file that looks like this (this is from a pandoc conversion of a Word document): # Standard 1.1 ## Narrative ::: {custom-style="Body Text"} Please see artifact 1 ([Artifact 1]{custom-style="Link to Artifact"}). You can also add references here as links ([[This is a reference]{custom-style="Hyperlink"}](https://www.website.link/path_to/reffile.pdf)). ::: ## Conclusion ::: {custom-style="Body Text"} This is my conclusion. ::: ## Sources [All sources will be automatically listed here. Do not modify this section.]{custom-style="Sources"} 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): # Standard 1.1 ## Narrative ::: {custom-style="Body Text"} Please see artifact 1 ([Artifact 1]{custom-style="Link to Artifact"}). You can also add references here as links ([[This is a reference]{custom-style="Hyperlink"}](https://www.website.link/path_to/reffile.pdf)). ::: ## Conclusion ::: {custom-style="Body Text"} This is my conclusion. ::: ## Sources - [Artifact 1](./path_to/Artifact-1.pdf) - [This is a reference](./path_to/reffile.pdf) using Quarto (with Pandoc and a Lua extension in the background). My extension captures the custom-styles Link to Artifact and Hyperlink (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 Sources 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). 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? I have tried to convert it using pandoc.utils.blocks_to_inlines, RawInline, RawBlock, etc. Obviously, none of th…
tagged with: pandoc
score: 0
has answer: http://stackoverflow.com/a/78874987
type: Question
tagged with: lua
has title: Converting a Span element to a BulletList in a pandoc Lua extension that works for pdf and html
type: UnansweredQuestion
tagged with: quarto

http://stackoverflow.com/a/78635657
answers question: http://stackoverflow.com/q/78633143
score: 0
has body: I don't have Roblox Studio to test, but according to its documentation a block comment like this should be used to document functions --Shuts off the cosmic moon ray immediately. Should only be called within 15 minutes of midnight Mountain Standard Time, or the cosmic moon ray may be damaged. Maybe -- [[ ... ]] does not work because it is a single line?
type: Answer

http://stackoverflow.com/comment/138704621
has text: 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.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78672216

http://stackoverflow.com/comment/138683308
comment on: http://stackoverflow.com/q/78660346
has text: 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.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/138647838
has text: `print( ("sometext\\scalebox{0.74}"):gsub("\\scalebox","") ) `
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/78638506

http://stackoverflow.com/q/78598788
tagged with: lua
tagged with: fivem
score: 0
answer count: 1
type: UnansweredQuestion
has body: I am trying to print a staff list with all the online staff members on the server This is my code: RegisterCommand('staff', function(source) local catistaff = 0 local staff = vRP.getOnlineAdmins{}; for k,v in pairs(staff) do local player = vRP.getUserSource{v} local name = GetPlayerName(player) or "Unknown" if name ~= "Unknown" then TriggerClientEvent('chatMessage', player, '^5' .. name .. ' ^0(^5' .. v .. '^0) -> ^1' .. vRP.getUserAdminTitle{v}) catistaff = catistaff +1 end end TriggerClientEvent('chatMessage', source, 'Staff Online: ^1' .. catistaff) end) And this is the error that I ve got: [ c-scripting-core] InvokeNative: execution failed: Argument at index 1 was null. [ script:vrp] SCRIPT ERROR: Execution of native 000000002f7a49e6 in script host failed: Argument at index 1 was null. [ script:vrp] > [global chunk] (TriggerClientEventInternal.lua:3) [ script:vrp] > sendStaffMessage (@vrp/modules/admin.lua:411) [ script:vrp] > callback (@vrp/modules/admin.lua:317) [ script:vrp] > handler (vrp-lib/Tunnel.lua:139) [ script:vrp] null
has title: InvokeNative: execution failed: Argument at index 1 was null
has answer: http://stackoverflow.com/a/78601506
type: Question

http://stackoverflow.com/comment/138745293
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78693254
has text: 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
type: Comment

http://stackoverflow.com/a/78598550
type: Answer
has body: Self is not defined in functions that are structured with periods, you're supposed to use setmetable to define a backpack with its own table You use __index for OOP (Object Oriented Programming), read up on that to refine your code
answers question: http://stackoverflow.com/q/78598446
score: 0

http://stackoverflow.com/q/78678155
type: Question
has title: Lua not being able to load a script
has comment: http://stackoverflow.com/comment/138715351
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138715494
has comment: http://stackoverflow.com/comment/138715543
score: 0
has comment: http://stackoverflow.com/comment/138715485
tagged with: lua
has body: The following code: sol::state lua; lua.open_libraries( sol::lib::base ); sol::table result = lua.script( R"( 'machineData={serial=1,name="mob2",}' )" ); throws the following error: [sol2] An error occurred and has been passed to an error handler: sol: syntax error: [string " 'machineData={serial=1,name="mob2",}' "]:1: unexpected symbol near ''machineData={serial=1,name="mob2",}'' terminate called after throwing an instance of 'sol::error'
has answer: http://stackoverflow.com/a/78678400
answer count: 1

http://stackoverflow.com/a/78740142
has comment: http://stackoverflow.com/comment/138856514
type: AcceptedAnswer
type: Answer
has body: To solve your problem, simply return when comparing the same element. if a == b then return end Internally the sorting algorithm of Lua is the quick sort of Hoare partition scheme. 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.
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78739507
answers question: http://stackoverflow.com/q/78739507
score: 4

http://stackoverflow.com/comment/138793747
has text: 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. I 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.
comment on: http://stackoverflow.com/q/78720214
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78658626
score: 0
type: Answer
has body: Well, it wasn't so hard. I opened "util.lua", and the problem was clear: The "TMP" environment variable was not defined anymore. I can't count anymore, how many times I defined this. I hate Windows sometimes ...
answers question: http://stackoverflow.com/q/78658586

http://stackoverflow.com/comment/138605068
type: Comment
type: QuestionComment
has text: One possible difference could be the working directory, where is the xml lib and from what working dir do you start using cmd?
score: 0
comment on: http://stackoverflow.com/q/78617539

http://stackoverflow.com/comment/138688210
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78654413
type: Comment
has text: Yep. That's what the call to GET right before the MULTI is for.

http://stackoverflow.com/a/78615847
has comment: http://stackoverflow.com/comment/139475326
score: 3
has comment: http://stackoverflow.com/comment/139473511
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/78613770
answers question: http://stackoverflow.com/q/78613770
has body: You can shorten identifiers like coroutine. Just local c=coroutine will work (or even just c=coroutine if you don't care about polluting the global namespace). You could go further, e.g., with local r=c.resume. You cannot shorten keywords like end.

http://stackoverflow.com/comment/138682573
has text: @Luatic yes, I need `$$` to be at start/end of a line. `$$` is a LaTeX tag to display math equations, just like, for example, in XML.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78659386
type: Comment

http://stackoverflow.com/comment/138707522
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78672216
type: Comment
has text: @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.

http://stackoverflow.com/comment/138715351
score: 0
comment on: http://stackoverflow.com/q/78678155
type: Comment
type: QuestionComment
has text: `'machineData={serial=1,name="mob2",}'` is just invalid lua, what did you expect?

http://stackoverflow.com/comment/138568612
type: QuestionComment
comment on: http://stackoverflow.com/q/78598446
type: Comment
has text: People don't use it like this, they use `setmetatable`, that's why I think you omitted something.
score: 1

http://stackoverflow.com/q/78660017
tagged with: lua
type: UnansweredQuestion
downvote count: 1
has body: 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 > 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 typedef enum libvlc_video_projection_t { libvlc_video_projection_rectangular, libvlc_video_projection_equirectangular, /**< 360 spherical */ libvlc_video_projection_cubemap_layout_standard = 0x100, } libvlc_video_projection_t; typedef enum libvlc_video_multiview_t { libvlc_video_multiview_2d, /**< No stereoscopy: 2D picture. */ libvlc_video_multiview_stereo_sbs, /**< Side-by-side */ libvlc_video_multiview_stereo_tb, /**< Top-bottom */ libvlc_video_multiview_stereo_row, /**< Row sequential */ libvlc_video_multiview_stereo_col, /**< Column sequential */ libvlc_video_multiview_stereo_frame, /**< Frame sequential */ libvlc_video_multiview_stereo_checkerboard, /**< Checkerboard pattern */ } libvlc_video_multiview_t; I found that I need to somehow make the video_multiview to be multiview_stereo_sbs and maybe also libvlc_video_projection to video_projection_rectangular. 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? I tried something like function activate() local input_item = vlc.input.item() local name = input_item:name() vlc.msg.info("Activating extension for: " .. name) if string.match(name, "3dh") then vlc.msg.info("SBS file detected: " .. name) -- Attempt to set stereoscopy mode using libvlc_video_multiview_t local vout = vlc.object.vout() if vout then -- set the stereoscopy mode, assuming supported by the VLC and API local multiview_mode = 'stereo-sbs' --…
upvote count: 1
tagged with: vlc
score: 0
favorite count: 0
type: Question
answer count: 0
has title: Question about making lua extension for forcing VR SBS playback
tagged with: libvlc

libvlc
tags question: http://stackoverflow.com/q/78660017
tags question: http://stackoverflow.com/q/78633861
type: Tag
tag name: libvlc

http://stackoverflow.com/comment/138833827
type: Comment
comment on: http://stackoverflow.com/q/78744024
has text: @Rob OK, so I really should be replacing with etc. Thanks.
score: 0
type: QuestionComment

http://stackoverflow.com/a/78657577
accepted answer of: http://stackoverflow.com/q/78656483
answers question: http://stackoverflow.com/q/78656483
has body: Depending on where your LocalScript is, you are likely going to run into a timing issue. If this is in StarterPlayer &gt; StarterCharacterScripts, then the code won't execute until the player's character is already created. So the order of events will be this : Player joins the game Player's Character spawns in the world Your LocalScript starts to execute... 1st line grabs the Local Player 2nd line waits for the player's character to spawn.... 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. 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 : local player = game.Players.LocalPlayer local character = player.Character if not character then character = player.CharacterAdded:Wait() end -- after this point, the player's character is guaranteed to exist
score: 3
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/138663738
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78649692
score: 1
type: QuestionComment

http://stackoverflow.com/a/79344652
answers question: http://stackoverflow.com/q/78633143
type: Answer
has body: If you're using Luau in VS Code, I'm assuming that you have Luau Language Server installed. Luau Language Server supports Moonwave-like docstrings. According to the documentation, you can do this: --[=[ This is a very fancy function that adds a couple numbers. @param a number -- The first number you want to add @param b number -- The second number you wanna add @return number -- Returns the sum of `a` and `b` ]=] function MyFirstClass:add(a, b) return a + b end
score: 0

http://stackoverflow.com/comment/138649959
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78640605
has text: 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.
type: AnswerComment

entity
type: Tag
tags question: http://stackoverflow.com/q/78610713
tag name: entity

http://stackoverflow.com/comment/138648675
has text: 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 `data = response.json() data["paginationResult"]["results"]["shortenUrl"]` with 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?
type: Comment
comment on: http://stackoverflow.com/a/78640605
score: 0
type: AnswerComment

http://stackoverflow.com/comment/138684823
type: Comment
has text: 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
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78660346

http://stackoverflow.com/comment/138624036
type: Comment
has text: 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)
score: 0
comment on: http://stackoverflow.com/q/78610713
type: QuestionComment

http://stackoverflow.com/comment/138797774
type: QuestionComment
score: 0
has text: shouldn't stats go into StarterPlayerScripts or StarterCharacterScripts? if your event does not fire you can always call the event handling functioin manually btw.
comment on: http://stackoverflow.com/q/78720214
type: Comment

http://stackoverflow.com/comment/138708668
score: 1
type: AnswerComment
has text: @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.
type: Comment
comment on: http://stackoverflow.com/a/78658754

http://stackoverflow.com/a/78638614
type: Answer
downvote count: 0
has body: I took a slightly different approach (as i was seeing same as you :-( ) cat user3204810.lua local instr = "sometext\\scalebox{0.74}" local strip = "\\scalebox" local res = string.gsub(instr, strip, "") print( 'orig:', instr, " result:", res ) lua user3204810.lua orig: sometext\scalebox{0.74} result: sometext{0.74} as always, check/test/double-check all suggestions
answers question: http://stackoverflow.com/q/78638506
upvote count: 1
score: 1

http://stackoverflow.com/comment/138763484
type: AnswerComment
score: 0
has text: Hi, I have 2 points confuse: - 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. - My system report `module 'posix' not found` when I import the module. I can't update luajit version. How to bypass it
comment on: http://stackoverflow.com/a/78701312
type: Comment

luasocket
tag name: luasocket
type: Tag
tags question: http://stackoverflow.com/q/78729670
tags question: http://stackoverflow.com/q/78826653
tags question: http://stackoverflow.com/q/79120179

http2
tag name: http2
tags question: http://stackoverflow.com/q/78677462
type: Tag

http://stackoverflow.com/a/79544239
answers question: http://stackoverflow.com/q/78633143
type: Answer
has body: This seems to be a relatively new feature given the age of this post. 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. 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. 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. Screenshot of docstrings in Roblox Studio.
score: 0

http://stackoverflow.com/comment/138704676
type: Comment
comment on: http://stackoverflow.com/q/78672216
has text: If your specific question changes then yes, create a new topic.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138786304
score: 0
type: QuestionComment
has text: 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?
comment on: http://stackoverflow.com/q/78717540
type: Comment

http://stackoverflow.com/comment/138786565
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78717085
has text: logitech ghub doesn't have the coroutine library
type: AnswerComment

wxgrid
tag name: wxgrid
tags question: http://stackoverflow.com/q/78618889
type: Tag

http://stackoverflow.com/comment/138568596
score: 0
comment on: http://stackoverflow.com/q/78598446
type: QuestionComment
has text: Removing the 2 lines also works, and self is not defined.
type: Comment

http://stackoverflow.com/comment/138667664
type: Comment
comment on: http://stackoverflow.com/q/78649692
score: 0
has text: 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).
type: QuestionComment

http://stackoverflow.com/a/78674041
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78672216
has body: "I'm looking for guidance on how to:" Create video frames in Lua Read frames from an existing MP4 file. 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). Get a hex editor to see the file structure of a working file versus your file. Later when asking, you need to be specific about how or where you're stuck. "I've written some Lua code to create an MP4 file with frames, but it doesn't seem to be working as expected..." You must fix the following to be able to get a picture from a media player loading your file... You don't have an STSS box (for listing keyframes). The first frame must be of type: IDR keyframe. 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. About fixing function create_stsz_box(): Also try to add at least 2 frames (for a start & end frame). It can be same frame data copied twice. local function create_stsz_box() local version = "\0" -- version 0 local flags = "\0\0\0" local sample_size = "\0\0\0\0" -- non-uniform sample sizes local sample_count = "\x00\x00\x00\x02" -- total entries of sizes local sample_sizes_1 = "\0\0\0\1" -- use real size (bytes length) of frame 1 local sample_sizes_2 = "\0\0\0\1" -- use real size (bytes length) of frame 2 return version .. flags .. sample_size .. sample_count .. sample_sizes_1 .. sample_sizes_2 end But now you must update STTS to have two time display entries. (called PTS and is related to the MDHD timescale entry). local function create_stts_box() local version = "\0" -- version 0 local flags = "\0\0\0" local entry_count = "\0\0\0\1" local sample_count = "\0\0\0\2" -- use total frames as the sample count local sample…

http://stackoverflow.com/q/78712098
score: 0
has body: Details: 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. 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? 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? Objective: I want to ensure that my application can handle multiple concurrent requests efficiently without unnecessary blocking or performance degradation due to Lua script execution. Request: Could 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. Request: Could 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.
type: Question
tagged with: locks
has comment: http://stackoverflow.com/comment/138780997
tagged with: python
tagged with: fastapi
tagged with: lua
answer count: 0
has comment: http://stackoverflow.com/comment/138778511
has title: Does executing a Lua script in Redis block the entire Redis server or just the database being accessed?
tagged with: redis
type: UnansweredQuestion

http://stackoverflow.com/comment/138705797
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78672731
has text: @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.
type: Comment

http://stackoverflow.com/comment/138793594
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78651730
score: 0
has text: perhaps you are using `RequiresLineOfSight` prop., which is True by default

http://stackoverflow.com/comment/138686637
comment on: http://stackoverflow.com/a/78658754
score: 0
type: Comment
has text: 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?
type: AnswerComment

android-emulator
type: Tag
tags question: http://stackoverflow.com/q/78661251
tag name: android-emulator

http://stackoverflow.com/q/78658056
downvote count: 0
has comment: http://stackoverflow.com/comment/138680088
tagged with: lua
score: 1
has title: Lua Variables And Its Effect On Speed And Memory
type: AnsweredQuestion
has body: 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: local x = 5 local y = x Is the variable y, a copy of x and is not a reference, which means doing it this way will consume twice the memory? While doing: local myTab = { one = "hello" } local myTab2 = myTab Would mean that myTab and myTab2 reference the same table and assigning myTab to myTab2 won't consume extra memory? I ask this since I usually tend to reassign global variables to local variables to improve speed. Such as: Config = {} -- This is in file1.lua -- On file2. lua we do: local Config = Config 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.
answer count: 1
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/78658754
type: Question
accepted answer: http://stackoverflow.com/a/78658754

http://stackoverflow.com/comment/138786954
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78717400
has text: Currently, `userdata` checks are `Luau` only, the rest work in `Lua 5.2-5.4` too.
type: Comment

http://stackoverflow.com/a/78678400
has comment: http://stackoverflow.com/comment/138717675
score: 0
has comment: http://stackoverflow.com/comment/138716761
has body: the solution is simple: your script needs to return the table.You can do so by adding: return machineData
type: Answer
answers question: http://stackoverflow.com/q/78678155

http://stackoverflow.com/a/78697973
has body: 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.
score: 0
answers question: http://stackoverflow.com/q/78694409
type: Answer

http://stackoverflow.com/comment/138759282
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78699403
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138655972
type: QuestionComment
comment on: http://stackoverflow.com/q/78645183
has text: Why do you have the same `if` statement twice? And why are you working on `part` instead of `torsoPart` in the second `if` statement?
score: 1
type: Comment

http://stackoverflow.com/a/78651180
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78650171
has body: {self.alpha = SHINYLOWESTALPHA} is invalid syntax { someKey = someValue } is syntactic sugar for { ["someKey"] = someValue} but this is only allowed for valid Lua identifiers which may not contain a dot. Lua names may consist of numbers, letters and underscore and may not start with a number. So depending on what you want to achieve you either need to use { ["self.alpha"] = SHINYLOWESTALPHA } to use "self.alpha" as your key (unlikely) or { ["alpha"] = SHINYLOWESTALPHA} or { alpha = SHINYLOWESTALPHA} to use "alpha" as your key or if you actually want to use the value self.alpha as the key: { [self.alpha] = SHINYLOWESTALPHA }

http://stackoverflow.com/comment/138715494
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78678155
type: Comment
has text: It would be without those `'` around it.

http://stackoverflow.com/comment/138833796
score: 0
type: QuestionComment
has text: 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?
type: Comment
comment on: http://stackoverflow.com/q/78744024

http://stackoverflow.com/comment/139063461
has text: Without seeing your filter I guess that one approach is to have a styled `Block` instead of a styled `Inline` in your markdown document.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78704192
type: QuestionComment

http://stackoverflow.com/a/78650316
has comment: http://stackoverflow.com/comment/138665576
has comment: http://stackoverflow.com/comment/138665613
accepted answer of: http://stackoverflow.com/q/78650171
has body: Try this instead: function Tile:shimmer() if self.alpha == SHINYHIGHESTALPHA then Timer.tween(1, { [self] = {alpha = SHINYLOWESTALPHA} }) elseif self.alpha == SHINYLOWESTALPHA then Timer.tween(1, { [self] = {alpha = SHINYHIGHESTALPHA} }) end end You're not supposed to put self. prefixes inside of table constructors.
answers question: http://stackoverflow.com/q/78650171
score: 0
has comment: http://stackoverflow.com/comment/138666386
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/138781737
score: 1
type: Comment
type: QuestionComment
has text: please show how the second snippet is executed in your code
comment on: http://stackoverflow.com/q/78715199

http://stackoverflow.com/comment/138601146
has text: why would you want to do that? that's pretty bad style
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78613770
type: QuestionComment

http://stackoverflow.com/a/78732351
has body: You can use something like: async function get_obfuscated_token(r) { r.setReturnValue("abc"); } The r.setReturnValue keeps js_set happy. The call to js_set just looks like: js_path "/etc/nginx"; js_import obfuscate.js; js_set $obfuscated_token obfuscate.get_obfuscated_token; IOW, sometimes you can 'return' a value from an async function. njs requires it sometimes too.
answers question: http://stackoverflow.com/q/78727370
type: Answer
score: 0

http://stackoverflow.com/comment/138565712
comment on: http://stackoverflow.com/q/78595890
type: Comment
has text: I believe this is an issue with the extension. I get the same error. After disabling the extension the error is also gone.
score: 0
type: QuestionComment

web-scraping
type: Tag
tag name: web-scraping
tags question: http://stackoverflow.com/q/78638625

http://stackoverflow.com/a/79462117
answers question: http://stackoverflow.com/q/78667335
score: 0
has body: In addition to the stack overflow error in certain circumstances, the grid falls apart very quickly after a move or two. 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. Avoid magic values. 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. Keep the UI and game logic separate. 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. Model a 2d grid with a 2d table, rather than a 1d table. 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. Avoid recursion, which is generally harder to reason about and debug than loops. 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: local grid = {} local gridSize = 8 local gapSize = 15 local squareSize = 50 local squareSizeWithGap = gapSize + squareSize local selectedTile = nil local colors = { {1, 0, 0}, {0, 1, 0}, {0, 0, 1}, {1, 1, 0}, {0, 1, 1}, {1, 0, 1}, {0.5, 0.5, 0.5}, } function initializeGrid() for row = 1, gridSize do grid[row] = {} end fillGrid() resolveMatches() end function drawGrid() for row = 1, gridSize do for col = 1, gridSize do love.graphics.setColor(colors[grid[row][col]]) love.graphi…
type: Answer

user-input
tags question: http://stackoverflow.com/q/78655709
type: Tag
tag name: user-input

http://stackoverflow.com/comment/138782639
type: Comment
has text: @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
type: QuestionComment
comment on: http://stackoverflow.com/q/78715199
score: 0

http://stackoverflow.com/comment/138743788
comment on: http://stackoverflow.com/q/78693947
has text: 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.
type: Comment
score: 0
type: QuestionComment

lua-scripting-library
tag name: lua-scripting-library
tags question: http://stackoverflow.com/q/78624992
type: Tag
tags question: http://stackoverflow.com/q/79010976

http://stackoverflow.com/comment/138596190
score: 1
comment on: http://stackoverflow.com/q/78610713
has text: GetClass is the way to do it! How you tried to use it?
type: Comment
type: QuestionComment

fzf
type: Tag
tag name: fzf
tags question: http://stackoverflow.com/q/78654334

fastapi
type: Tag
tags question: http://stackoverflow.com/q/78712098
tag name: fastapi

lazyvim
tags question: http://stackoverflow.com/q/78738185
tag name: lazyvim
type: Tag
tags question: http://stackoverflow.com/q/78845415
tags question: http://stackoverflow.com/q/79522535

http://stackoverflow.com/comment/138700342
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/78660346
has text: @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".

http://stackoverflow.com/a/79143714
score: 0
answers question: http://stackoverflow.com/q/78633143
type: Answer
has body: This feature has been added to Studio! Adding a comment above a function definition will add it to the intellisense as a docstring example: -- This adds 2 numbers together local function add(a, b) return a + b end

installation
tags question: http://stackoverflow.com/q/78661251
type: Tag
tag name: installation
tags question: http://stackoverflow.com/q/79118768

http://stackoverflow.com/a/78718207
answers question: http://stackoverflow.com/q/78718156
has body: Player objects in Roblox have a Character property that you can access pretty easily. It can be accessed as such, barring any timing issues: local info = { localplayer = game.Players.LocalPlayer, localcharacter = localplayer.Character, } return info
score: 0
type: Answer

http://stackoverflow.com/q/78717783
type: UnansweredQuestion
score: 0
has title: Can`t get constraint.HasConstraints working in Lua gmod
answer count: 0
has body: 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 if SERVER then hook.Add("PlayerSpawnedProp", "PrintConstraintsCount", function(player, entity) print(constraint.HasConstraints(entity)) end) end
tagged with: garrys-mod
tagged with: lua
has comment: http://stackoverflow.com/comment/138786639
type: Question

http://stackoverflow.com/comment/138660537
type: AnswerComment
score: 0
has text: Thank you so much! It worked. Didnt know there wasnt any order in dictionaries
comment on: http://stackoverflow.com/a/78647953
type: Comment

lnk2019
type: Tag
tag name: lnk2019
tags question: http://stackoverflow.com/q/78694409

rest
tag name: rest
tags question: http://stackoverflow.com/q/78601647
type: Tag

http://stackoverflow.com/comment/138831424
comment on: http://stackoverflow.com/q/78628036
has text: As an aside, do check https://www.hammerspoon.org/docs/hs.grid.html
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138568642
has text: Talking about local Backpack = {} Backpack.__index = Backpack
type: Comment
comment on: http://stackoverflow.com/q/78598446
score: 0
type: QuestionComment

http://stackoverflow.com/a/78621611
has body: You can do this by using the CFrame.new(Position, LookAt) function. -- // Services local Players = game:GetService("Players"); -- // Variables local client = Players.LocalPlayer; local Character = client.Character; local Root = Character:WaitForChild("HumanoidRootPart"); local Wall = workspace.FX:WaitForChild("Wall"); -- CFrame.new(position (Vector3), lookAt (Vector3)) Wall.CFrame = CFrame.new( (Root.Position + Root.CFrame.LookVector * 35), Root.Position );
answers question: http://stackoverflow.com/q/78620746
score: 0
type: Answer

key-bindings
tags question: http://stackoverflow.com/q/78623390
tag name: key-bindings
type: Tag
tags question: http://stackoverflow.com/q/78894422
tags question: http://stackoverflow.com/q/79449456

http://stackoverflow.com/comment/138778128
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78709542
type: QuestionComment
has text: 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 should continue to work (the lua_bitop library has been patched to work with Lua 5.3 and 5.4, in addition to the native Lua support for bit operations present in those versions), different versions of Lua are not guaranteed to be compatible."_.

http://stackoverflow.com/a/78655825
accepted answer of: http://stackoverflow.com/q/78655709
score: 0
has body: The answer was actually, that WaitForChild is better to be used in an if, for example: if not character then character = player:WaitForChild("Character")
answers question: http://stackoverflow.com/q/78655709
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/78655757
answers question: http://stackoverflow.com/q/78617004
score: 0
type: Answer
has body: To fix this, add local source = source at the beginning of the register server event like this : RegisterNetEvent('InteractiveNPCS:RequestLLMResponse') AddEventHandler('InteractiveNPCS:RequestLLMResponse', function(text) local source = source -- here, i don't remember this explanation but remember to do this when you create a server event print("Received text from client: " .. text) local apiKey = Config.HuggingFaceAPIKey local endpoint = Config.ModelEndpoint PerformHttpRequest(endpoint, function(err, responseText, headers) if err == 200 then print("Received response from LLM API: " .. tostring(responseText)) local response = json.decode(responseText) local reply = response and response[1] and response[1].generated_text or "Sorry, I don't understand." print("Sending response to client: " .. reply) TriggerClientEvent('InteractiveNPCS:ReceiveLLMResponse', source, reply) else print("Error from LLM API: " .. tostring(err)) print("Response text: " .. tostring(responseText)) TriggerClientEvent('InteractiveNPCS:ReceiveLLMResponse', source, "Sorry, something went wrong.") end end, 'POST', json.encode({ inputs = text }), { ["Authorization"] = "Bearer " .. apiKey, ["Content-Type"] = "application/json" }) end)

http://stackoverflow.com/comment/138742568
has text: 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.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78693254
type: QuestionComment

slimv
tags question: http://stackoverflow.com/q/78738185
tag name: slimv
type: Tag

workspace
tags question: http://stackoverflow.com/q/78712784
tag name: workspace
type: Tag

http://stackoverflow.com/a/78629324
answers question: http://stackoverflow.com/q/78624992
type: Answer
upvote count: 3
downvote count: 0
has body: The issue is that one or multiple the Humanoid.Health, Humanoid.MaxHealth, Stamina.Value, MaxStamina.value, Level.Value variables are empty(nil). 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 documentation if it's a constant).
score: 3

access-violation
type: Tag
tags question: http://stackoverflow.com/q/78740442
tag name: access-violation

http://stackoverflow.com/comment/138699173
type: Comment
score: 0
has text: @JosephSible-ReinstateMonica - [suggested edit](https://stackoverflow.com/review/suggested-edits/36185135) != [my edit](https://stackoverflow.com/posts/78660346/revisions).
type: QuestionComment
comment on: http://stackoverflow.com/q/78660346

http://stackoverflow.com/comment/138831407
has text: 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?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78628036

hex
tag name: hex
tags question: http://stackoverflow.com/q/78678707
type: Tag

http://stackoverflow.com/a/78717085
has body: 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: function OnEvent(event, arg) if EnableRCS ~= false then if event == "MOUSE_BUTTON_PRESSED" and arg == 8 then local co = coroutine.create(PressKeySequenceA) coroutine.resume(co) end if IsMouseButtonPressed(3) then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0, RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end end
answers question: http://stackoverflow.com/q/78715199
has comment: http://stackoverflow.com/comment/138786565
score: 0
type: Answer

http://stackoverflow.com/comment/138886623
has text: What is the asset ID for the `FireballThrow` animation and is it public? You should make sure your place has access to the animation.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78742067
type: QuestionComment

http://stackoverflow.com/comment/138666517
type: Comment
has text: Rephrased to avoid making an impression that the question is about genuinely parallel programming/
comment on: http://stackoverflow.com/q/78649692
score: 0
type: QuestionComment

njs
type: Tag
tags question: http://stackoverflow.com/q/78727370
tag name: njs

http://stackoverflow.com/a/78607292
answers question: http://stackoverflow.com/q/78606577
has body: I wasn't understand how it work, I was think it looks like redisgear that it run auto but no. 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. and to achive that, you need to run lua file in cron job to help you free memory. 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. until now I can't find any way that help me on that. Edit: The best approach for that is to use another policy like volatile-ttl that will help you in case you need to delete a specific patter Usage : you will add a ttl for the pattern that you need to be deleted if Redis 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 you also can read about it in Redis Documentation
score: 0
type: Answer

timestamp
tags question: http://stackoverflow.com/q/78693254
tag name: timestamp
type: Tag

openstreetmap
tags question: http://stackoverflow.com/q/78647187
tag name: openstreetmap
type: Tag
tags question: http://stackoverflow.com/q/79435348
tags question: http://stackoverflow.com/q/79452139

location
tags question: http://stackoverflow.com/q/78651730
type: Tag
tag name: location

http://stackoverflow.com/q/78783308
accepted answer: http://stackoverflow.com/a/78783951
has comment: http://stackoverflow.com/comment/138902571
upvote count: 3
type: Question
has title: What's the advantage and disadvantage that using string.format("str", ...) instead of "str":format(...) in Lua?
score: 3
downvote count: 0
tagged with: lua
tagged with: format
tagged with: string
answer count: 1
favorite count: 0
type: AnsweredQuestion
has body: 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. Coincidentally, Lua allows : operator to make a object call a function with the first parameter is itself, which means the following statement can run normally: local myWord = "Hello, %s" -- two ways to format: string.format(myWord, "World") myWord:format("World") Is there any difference between those two style? If not, which one is better for me to use in my program?
has answer: http://stackoverflow.com/a/78783951

http://stackoverflow.com/q/78839677
tagged with: ffi
has title: Is userdata in LuaJIT ffi garbage collected when it is returned from a C function by value?
score: 1
answer count: 1
tagged with: luajit
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78842059
accepted answer: http://stackoverflow.com/a/78842059
upvote count: 1
type: Question
tagged with: http://stackoverflow.com/tag/c
has body: I'm trying to figure out LuaJIT garbage collection when its FFI is involved. Let's say I have a function that returns a struct by value. typedef struct MyTestData { int id; // ... other fields that may need finalizing/freeing } MyTestData; MyTestData createTestData(int id); void deleteTestData(MyTestData data); // finalizes/frees the data in MyTestData fields // and then I use the same in ffi.cdef and local lib = ffi.load(LIBRARY_PATH) My questions are: When I create a Lua variable by calling local v = lib.createTestData(25) and then v gets garbage collected (for example, going out of score with no other references), does it free the memory allocated for it even though createTestData returned the struct value, not a pointer to it? If I need additional cleanup of resources MyTestData may hold, and I create it like this: local v = ffi.gc(lib.createTestData(25), lib.deleteTestData), does it also automatically free the memory used by v when it goes out of scope after calling deleteTestData? I'm asking this because the LuaJIT FFI docs and examples usually deal with pointers, mallocs and frees, whereas in my case what I have are values.
downvote count: 0
tagged with: lua

http://stackoverflow.com/q/78791470
type: Question
has answer: http://stackoverflow.com/a/78791618
accepted answer: http://stackoverflow.com/a/78791618
tagged with: lua
tagged with: variables
has body: local expType = tostring(type1) local expTypeStat = expType:gsub("Exp", "") local profileDataExpType = "profile.Data."..expType Here I want to change which data is pulled from profile.Data depending on which expType is given to the function I'm making. 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. To access the player's stats and exp amounts, I need to use profile.Data.Strength or profile.Data.StrengthExp for example. if profileDataExpType <= math.round(100 * (expTypeStat / 2)) then Here is the part of the function that I want to use the profileDataExpType and expTypeStat variables as code instead of strings. 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 I tried writing the code like this, replacing the actual name of the data with expType: if profile.Data.expType <= math.round(100 * (profile.Data.expType/ 2)) then I tried this before converting expType to a string thinking it would use the parameter expType instead of looking for data called "expType" within profile.Data
tagged with: string
type: AnsweredQuestion
answer count: 1
score: 0
has title: How can I use a parameter to alter which data my profile.Data is accessing?
tagged with: roblox
tagged with: type-conversion

http://stackoverflow.com/q/78800396
accepted answer: http://stackoverflow.com/a/78800463
type: Question
has answer: http://stackoverflow.com/a/78800463
has comment: http://stackoverflow.com/comment/138931803
has body: 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. local replicatedStorage = game:GetService("ReplicatedStorage") local assets = replicatedStorage:WaitForChild("Assets") local player = game.Players.LocalPlayer local function addItem(itemName) local item = assets:FindFirstChild(itemName) if not item then return end print(item) print("Adding "..itemName.." to backpack!") item:Clone().Parent = player.Backpack end I tried replacing the item:Clone().Parent = player.Backpack with this: local clone = item:Clone() clone.Parent = player.Backpack Which also doesn't add the item into the StarterPack. No errors or warnings are thrown up. As you can see, I put some print() functions in there and here is what they print: Cloth Tunic -- from the print(item) Adding Cloth Tunic to backpack! -- from the other print Cloth Trousers -- from the print(item) Adding Cloth Trousers to backpack! -- from the other print (The function gets called two separate times at the beginning of the game, once for each item in the inventory) So I'm not sure why the items aren't being put into the StarterPack if the code is making to the Clone() function and the item names are correct.
has comment: http://stackoverflow.com/comment/138931802
upvote count: 1
answer count: 1
favorite count: 0
tagged with: clone
type: AnsweredQuestion
tagged with: roblox
has title: Clone() not seeming to work when setting it's parent to the StarterPack
downvote count: 0
score: 1
tagged with: lua

http://stackoverflow.com/a/78922257
type: Answer
has body: 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 CanCollide property to false. Weld the hitbox to the part you want to have a hitbox. Insert a script to check for the Touched event then connect a function. Example: local hitbox=script.parent hitbox.Touched:Connect(function() print("object touched"!) end) Hope this helps!
answers question: http://stackoverflow.com/q/78882803
has comment: http://stackoverflow.com/comment/139233199
has comment: http://stackoverflow.com/comment/139149785
score: 0
has comment: http://stackoverflow.com/comment/139228396

http://stackoverflow.com/q/78836865
tagged with: for-loop
has answer: http://stackoverflow.com/a/78836907
tagged with: lua
linked to: http://stackoverflow.com/q/55108794
tagged with: lua-table
has title: Why does `for key, value in table` stop working in Lua 5.1 and later?
tagged with: lua-4.0
has answer: http://stackoverflow.com/a/78838511
favorite count: 0
answer count: 2
has body: 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: wget https://www.lua.org/ftp/lua-all.tar.gz tar xvf lua-all.tar.gz --strip-components=1 make Afterwards, you can run example code in all versions to compare: cat <<EOF >pairs.lua for key, value in pairs({[2] = "a", [1] = "b", ["c"] = "d"}) do print(key .. " -> " .. value) end EOF ls -1d */ | sed 's/\/$//' | sort | while IFS= read -r f; do printf %s\\n "" "$f"; "$f/lua" pairs.lua; done Outputs: lua-1.0 lua: syntax error near "key" at line 1 in file "pairs.lua" lua-1.1 lua: syntax error near "key" at line 1 in file "pairs.lua" lua-2.1 lua: syntax error near "key" at line 1 in file "pairs.lua" lua-2.2 lua: syntax error near "key" at line 1 in file `pairs.lua' Active Stack: fallback error lua-2.4 lua: syntax error; last token read: "key" at line 1 in file `pairs.lua' Active Stack: `error' fallback lua: error trying to run file pairs.lua lua-2.5 lua: syntax error; > last token read: "key" at line 1 in file pairs.lua Active Stack: `error' fallback lua-2.5.1 lua: syntax error; > last token read: "key" at line 1 in file pairs.lua Active Stack: `error' fallback lua-3.0 lua: syntax error; > last token read: "key" at line 1 in file pairs.lua lua-3.1 lua: `=' expected; last token read: `key' at line 1 in chunk `pairs.lua' lua-3.2 lua-3.2.1 lua error: `=' expected; last token read: `key' at line 1 in file `pairs.lua' lua-3.2.2 lua error: `=' expected; last token read: `key' at line 1 in file `pairs.lua' lua-4.0 error: attempt to call global `pairs' (a nil value) stack traceback: 1: main of file `pairs.lua' at line 1 lua-4.0.1 error: attempt to call global `pairs' (a nil value) stack traceback: 1: main of file `pairs.lua' at line 1 lua-5.0 1 -> b 2 -> a c -> d lua-5.0.1 1 -> b 2 -> a c -> d lua-5.0.2 1 -> b 2 -> a c -> d lua-5.0.3 1 -> b 2 -> a c -> d lua-5.1 2 -> a 1 -> b c -> d lua-5.1.1 2 -> a 1 -> b c -> d lua-5.1.2 2 -> a 1 -> b c -> d…
accepted answer: http://stackoverflow.com/a/78836907
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/78838511
tagged with: syntax
score: 4
linked to: http://stackoverflow.com/q/35171569
linked to: http://stackoverflow.com/q/25347503
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/17436947
upvote count: 4

http://stackoverflow.com/a/78846539
type: Answer
has comment: http://stackoverflow.com/comment/139021180
accepted answer of: http://stackoverflow.com/q/78846295
answers question: http://stackoverflow.com/q/78846295
has body: Don't make it look harder than it is. Just exec curl or wget through io.popen and parse with the help of a builtin JSON decoder. local h = io.popen("wget -qO- https://example.org/example.json") local rawdata = h:read("all") h:close() local t = vim.json.decode(rawdata) print(vim.inspect(t)) And if you need some extra modules then put them all under your plugin's /lua subdirectory.
upvote count: 3
downvote count: 0
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/78758535
tagged with: roblox
type: Question
has title: My Script inside my model's part doesn't run when I clone it
tagged with: lua
tagged with: scripting
tagged with: roblox-studio
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78769472
score: 0
has body: This is my code for spawning in the model itself which is located in ReplicatedStorage, which this is the hierarchy: SpawnDoor (Model) Door (Sound) Light (Folder) Door1 (Part) Door2 (Part) Part (Part) SurfaceLight (SurfaceLight) Teleport (Script) --script that doesn't work when door spawns in Wood (Folder) Door1 (Model) Union Door2 (Model) Union local TweenService = game:GetService("TweenService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local CameraShaker = require(ReplicatedStorage:WaitForChild("CameraShaker")) local player = game.Players.LocalPlayer local playerGui = player.PlayerGui.Red.Red local Camera = game.Workspace.CurrentCamera local cooldown = false -- Cooldown flag local cooldownTime = 2 -- Cooldown time in seconds local function ShakeCamera(shakCf) Camera.CFrame = Camera.CFrame * shakCf end local renderPriority = Enum.RenderPriority.Camera.Value + 1 local camShake = CameraShaker.new(renderPriority, ShakeCamera) camShake:Start() -- Function to handle J key press local function onKeyPress(input) if input.KeyCode == Enum.KeyCode.J then if cooldown then print("Tool is on cooldown") -- Shake camera and show GUI camShake:ShakeOnce(60, 80, 1, 1) -- Adjust parameters as needed local transparencyTweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0) local tween1 = TweenService:Create(playerGui, transparencyTweenInfo, { BackgroundTransparency = 0.3 }) local tween2 = TweenService:Create(playerGui, transparencyTweenInfo, { BackgroundTransparency = 1 }) tween1:Play() tween1.Completed:Connect(function() tween2:Play() end) return end cooldown = true -- Activate cooldown print("Tool Activated") -- Check if this prints when you use the tool game.SoundService.Biwa:Play() local Player = game.Players.LocalPlayer local Char = Player.Character if not Char then print("Character not found") cooldown = false -- Reset cooldown if an error occurs return end local HRP = Char:FindFirstChild("HumanoidRootPart") if not HRP…

http://stackoverflow.com/comment/139092047
type: AnswerComment
comment on: http://stackoverflow.com/a/78890243
has text: @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.
score: 1
type: Comment

http://stackoverflow.com/a/78806414
score: 1
has body: Classical. = in a numbered template parameter makes it technically named: will not be treated as. You should either replace = with: {{BubbleBox/hex |classes=tagInfobox |styles=width: 350px; padding: 8px; float: right; | Insert caption here { } }} or explicitly state the argument name: {{BubbleBox/hex |classes=tagInfobox |styles=width: 350px; padding: 8px; float: right; |1= Insert caption here { } }}
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78805862
answers question: http://stackoverflow.com/q/78805862
downvote count: 0

http://stackoverflow.com/comment/139149785
has text: Also, this question should be in the Game Dev Site. Ask questions like this over there.
type: AnswerComment
comment on: http://stackoverflow.com/a/78922257
type: Comment
score: 0

http://stackoverflow.com/q/78831855
type: UnansweredQuestion
favorite count: 0
tagged with: neovim
tagged with: path
type: Question
score: 3
has title: Neovim config lazy.lua file error on moving the file to its parent's directory
has answer: http://stackoverflow.com/a/78846143
tagged with: lua
has body: I had my lazy.lua file in .config/nvim/lua/{name}/ directory and then to structure my config I moved it to .config/nvim/lua. After that I got some errors basically about nil values in some lazy files. All these errors originate from require('lazy').setup('plugins') These errors will disappear once I move lazy.lua back to .config/nvim/lua/{name}/ directory. I obviously updated all the imports in init.lua file. I also tried re-installing lazy by sudo rm ~/.local/share/nvim/lazy ~/.local/state/nvim/lazy -rf, also deleted lazy-lock.json file but nothing works except moving lazy.lua to .config/nvim/lua/{name}/ directory. I even updated neovim to latest version. Here is my lazy.lua file: -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" print('installing lazy...') local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) if vim.v.shell_error ~= 0 then vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { out, "WarningMsg" }, { "\nPress any key to exit..." }, }, true, {}) vim.fn.getchar() os.exit(1) end end vim.opt.rtp:prepend(lazypath) print('lazy installed') -- Make sure to setup `mapleader` and `maplocalleader` before -- loading lazy.nvim so that mappings are correct. -- This is also a good place to setup other settings (vim.opt) vim.g.mapleader = " " vim.g.maplocalleader = "\\" -- Setup lazy.nvim require("lazy").setup('plugins') Here are the errors:- In Older version 0.9.4 ERROR Failed to run healthcheck for "lazy" plugin. Exception: function health#check, line 25 Vim(eval):E5108: Error executing lua ...al/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua:52: attempt to index upvalue 'uv' (a >nil value) stack traceback: .local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.lua:52: in function 'spawn' .local/share/nvim/lazy/lazy.nvim/lua/lazy/manage/process.l…
tagged with: config
upvote count: 3
tagged with: lazy-evaluation
downvote count: 0
answer count: 1

http://stackoverflow.com/q/78829514
tagged with: roblox
tagged with: youtube-api
accepted answer: http://stackoverflow.com/a/78829658
answer count: 1
score: 0
type: AnsweredQuestion
tagged with: luau
has title: Unable to clone and move the cloned model
has body: 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, but that just dont work or just spawns the clone inside the original model. Can someone help me please? Also, please PLEASE sorry if the code is hard to understand, thats because all the coments are in another language (Brazilian Portuguese). Here is my current LUA script: --!strict print("[YTLiveSubs]: Script inserido...") local http = game:GetService('HttpService') local channel_id = 'UCA4yZCVHlHZVknfesTU3XOg' local url = 'https://api.socialcounts.org/youtube-live-subscriber-count/'..channel_id local decoded local subs local diffsubs local data local success local finaldiffsubs -- aquele negócio que mostra a diferença de incritos. -- Ping if script:GetAttribute("Debug") == true then -- Checa se o modo "Debug" foi ativado print("[YTLiveSubs]: Iniciando teste de ping!...") local startTime = os.clock() local success, response = pcall(function() return http:GetAsync("https://www.google.com") end) if success then local deltaTime = os.clock() - startTime print("Pong!: " .. deltaTime .. " segundos") else print("Erro: " .. response) end end -- Fim do Ping function ChecarInscritos() success,data = pcall(function() return http:GetAsync(url) end) --if data then decoded = http:JSONDecode(data) subs = decoded["est_sub"] print(subs) --end end print("[YTLiveSubs]: Calculando First-run...") ChecarInscritos() while true do diffsubs = subs wait(3) -- em resumo, eu coloquei isso para não sobrecarregar a API -- Eu podia tranquilamente não ter feito isso, ou mudade o cooldown para 0.1 ou 0.5, -- Mas a API épública e eu não quero estragar o uso das outras pessoas. - PatoFlamejanteTV ChecarInscritos() print("[YTLiveSubs]: Inscritos atuais: " .. subs) --print("Pong!") -- Avisa que um novo "tick" print("[YTLiveSubs]: Novos inscritos: ".. subs - diffsubs) --matemáticas :nerd: finaldiffsubs = subs - diffsubs for i = 1, finaldiffsubs do loca…
has answer: http://stackoverflow.com/a/78829658
tagged with: lua
type: Question

http://stackoverflow.com/comment/139013538
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78845415
has text: `checkhealth treesitter` gives: ============================================================================== vim.treesitter: require("vim.treesitter.health").check() - Nvim runtime ABI version: 14
type: Comment

http://stackoverflow.com/comment/138873270
type: QuestionComment
comment on: http://stackoverflow.com/q/78766168
has text: _"...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.
type: Comment
score: 0

http://stackoverflow.com/q/78836411
has answer: http://stackoverflow.com/a/78837343
type: UnansweredQuestion
answer count: 1
score: 0
favorite count: 0
has title: Infinite yield possible on Players:WaitForChild("CombatStatus")
type: Question
has comment: http://stackoverflow.com/comment/138995642
tagged with: roblox
downvote count: 1
has body: I keep getting the error: "ServerScriptService.CoreScript(Server).CombatScript:13: attempt to index nil with 'CombatStatus'" In a script I'm working on in a Roblox Game This line of code is what the error is referring to: if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent.Name ~= Player.Name and game.Players:FindFirstChild(Hit.Parent.Name).CombatStatus.Value == "" and Hitbox.CanTouch == true then 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: "Infinite yield possible on 'Players:WaitForChild("CombatStatus")'"
upvote count: 1
has comment: http://stackoverflow.com/comment/138996492
tagged with: lua

http://stackoverflow.com/q/78832294
has title: buttons not responding in roblox studio
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78836162
accepted answer: http://stackoverflow.com/a/78832846
tagged with: game-development
has body: Im making a main menu in Lua(Roblox Studio) and the start game/play button doesnt work i tried this code for the play button but the button wasnt responding local button = script.Parent local main_menu = script.Parent.Parent.Parent.Parent local main_menu_frame = script.Parent.Parent.Parent main_menu.Enabled = true game.Lighting.Blur.Enabled = true while true do if button.MouseButton1Click == true then game.Lighting.Blur.Enabled = false main_menu.Enabled = false main_menu_frame.Active = false main_menu_frame.Transparency = 1 main_menu_frame.Visible = false end task.wait(0.1) end
answer count: 3
type: Question
has answer: http://stackoverflow.com/a/79016460
has answer: http://stackoverflow.com/a/78832846
downvote count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139222148
score: 1
tagged with: roblox-studio
has comment: http://stackoverflow.com/comment/138989572
upvote count: 1
possible better answer: http://stackoverflow.com/a/78836162
favorite count: 0

http://stackoverflow.com/q/78787625
tagged with: printing
has body: Issue Description 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. Here is the critical part of my code: function split(s, delimiter) local result = {}; for match in (s..delimiter):gmatch("(.-)"..delimiter) do table.insert(result, match); end return result; end function readCSV(filename) local file = io.open(filename, "r") if not file then error("Failed to open file: " .. filename) end local header = file:read() local headerArr = split(header, ",") print("length of headerArr: " .. #headerArr) for i, value in ipairs(headerArr) do print(i, value) end local data = {} for line in file:lines() do line = line:gsub("\n", ""):gsub("\r", "") print("line: " .. line) local valuesArr = split(line, ",") print("length of valuesArr: " .. #valuesArr) for i, value in ipairs(valuesArr) do -- print(i, value) end local entry = {} for i = 1, #valuesArr do print("headerArr[" .. i .. "]:" .. headerArr[i]) print("valuesArr[" .. i .. "]:" .. valuesArr[i]) -- print("headerArr[" .. i .. "] key = '" .. headerArr[i] .. "' , value = " .. valuesArr[i]) print(string.format("headerArr[%d] key = '%s' , value = '%s'", i, headerArr[i], valuesArr[i])) print("-------------------------------------------------") end for key, value in pairs(entry) do -- print(">>> Entry[" .. key .. "]: " .. value) end -- table.insert(data, entry) end file:close() return data end -- Usage example local filename = "/Users/weijialiu/Downloads/FC 24 CT v24.1.1.4/FC_24_LE_ICONS.csv" local data = readCSV(filename) -- Print the data for i, entry in ipairs(data) do for header, value in pairs(entry) do print(header .. ": " .. value) end print("--------------------") end Problem Details While processing the CSV file, the output format of the last line is incorrect. Specifically, the issue appears as: ... headerArr[1021]:runningcode2 valuesArr[1021]:0 headerArr[1021] key = 'runningcode2' , value = '0' ---------…
has answer: http://stackoverflow.com/a/78787925
accepted answer: http://stackoverflow.com/a/78787925
score: 0
tagged with: lua
has title: Lua Script for Reading CSV Produces Incorrect Output Format on Last Line
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138910051
answer count: 1
tagged with: arrays
type: Question

http://stackoverflow.com/comment/139108644
score: 2
type: Comment
comment on: http://stackoverflow.com/q/78896730
has text: Perhaps, the only purpose of patterns with even numbers is to override smaller odd numbers, thus effectively forbidding hyphenation.
type: QuestionComment

http://stackoverflow.com/comment/139032658
has text: @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.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78855024
type: QuestionComment

http://stackoverflow.com/q/78826881
type: Question
answer count: 1
downvote count: 0
has body: I have to move to Lua for a scripting language and trying to recreate a condition I use a lot line 1: if the pattern returns capture groups, assign them to "match" and this condition returns true regFind is my function that runs pattern matches and returns the matches as a python dictionary line 2: if true, then use the capture group values is this even possible in Lua? thanks so much for your help 1. if (match := o.regFind("(?P<test>\d+)\s(?P<letters>[A-Z]+)","1111111 GGGG")): 2. if match["test"]: 3. value = match.get("test") 4. print(value) 5. if match["letters"] != None: 6. print(match) I created a lua function called "Regex" that will return the capture matches as a table. But this gets a syntax error because it's expecting == if matches = Regex("THIS IS a TEST", "%a") then print "is a match" end
has answer: http://stackoverflow.com/a/78826958
score: 2
tagged with: lua
has comment: http://stackoverflow.com/comment/138977899
type: UnansweredQuestion
upvote count: 2
has title: assigning pattern matches in an if statement
favorite count: 0

http://stackoverflow.com/q/78828816
answer count: 1
type: UnansweredQuestion
favorite count: 0
score: 0
downvote count: 1
upvote count: 1
has answer: http://stackoverflow.com/a/78829370
type: Question
tagged with: roblox
tagged with: datastore
tagged with: lua
has title: DataStore Could Not Save Gui settings
has body: 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 game.startergui.screengui.themeframe.default game.startergui.screengui.themeframe.gren when i change between those, it works but when i rejoin the the default theme always shows really appreciate your help i tried chatgpt but chatgpt's code never works.

youtube-api
tag name: youtube-api
type: Tag
tags question: http://stackoverflow.com/q/78829514
tags question: http://stackoverflow.com/q/79012369

http://stackoverflow.com/a/78895254
has body: this local pointPart1 = game.Workspace.PointsPlaceFolder.PointPart1 blacklist = {} blacklist.findPlayer = function(player) for i,v in ipairs(blacklist) do if v==player then return true end end return false end PointPart1.Touched:Connect(function(hit) if hit.Parent:FindFirstChild(“Humanoid”) then thePlayer = game.Players:GetPlayerFromCharacter(hit.Parent:FindFirstChild(“Humanoid”).Parent) if(thePlayer and not blacklist.findPlayer(thePlayer)) thePlayer.leaderstats.Points.Value+=1 table.insert(blacklist,thePlayer) end end) 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
score: 0
answers question: http://stackoverflow.com/q/78883172
type: Answer

http://stackoverflow.com/q/78745464
tagged with: roblox
tagged with: roblox-studio
has body: 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.) I found two options: First option: Drag the model to ReplicatedStorage and add the following script to ServerScriptService local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local newSkin = ReplicatedStorage:WaitForChild("NewSkinModel") Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:WaitForChild("Humanoid") local newCharacter = newSkin:Clone() newCharacter.Name = player.Name local humanoid = newCharacter:WaitForChild("Humanoid") humanoid:ApplyDescription(player.Character.Humanoid:GetAppliedDescription()) player.Character = newCharacter newCharacter.Parent = workspace end) end) Second option: Upload the model to StarterPlayer. But unfortunately neither option helps me. I tried to find issues in the code, but I couldn't find anything.
has title: How to Apply the Same Skin to All Players in Roblox?
type: AnsweredQuestion
type: Question
upvote count: 1
favorite count: 0
downvote count: 0
accepted answer: http://stackoverflow.com/a/78745513
tagged with: luau
score: 1
tagged with: lua
has answer: http://stackoverflow.com/a/78745513
answer count: 1

http://stackoverflow.com/comment/138877245
type: Comment
comment on: http://stackoverflow.com/q/78767348
score: 0
has text: Yes it's doable, but not a good idea for performance or maintainability of the resulting code.
type: QuestionComment

http://stackoverflow.com/a/78830039
type: AcceptedAnswer
type: Answer
has body: Upon further investigation, I have found the solution. The following code works as desired: vim.opt.scrolloff = math.floor(vim.opt.lines:get() / 2) Yes. NeoVim uses Lua 5.1, whereas the // operator was only introduced in Lua 5.3. Therefore, this is a syntax error. Yes. Use vim.opts.lines:get(). You can access option values using the following syntax: vim.opts.&lt;option&gt;:get(). See :help vim.opt:get() for more info.
score: 1
accepted answer of: http://stackoverflow.com/q/78828662
answers question: http://stackoverflow.com/q/78828662
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/139228396
type: Comment
score: 0
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/78922257

http://stackoverflow.com/comment/139525691
type: AnswerComment
comment on: http://stackoverflow.com/a/78842059
type: Comment
score: 0
has text: @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?

http://stackoverflow.com/q/78894927
tagged with: lpeg
possible better answer: http://stackoverflow.com/a/78895246
has title: How to use LPeg to replace parts of the matched grammar?
has answer: http://stackoverflow.com/a/78903262
tagged with: lua
has answer: http://stackoverflow.com/a/78895246
type: AnsweredQuestion
answer count: 2
has body: Given a LPeg grammar, I want to do a find/replace on some of the sub-matches. For example, suppose that I want to replace all the occurrences of the letter "a" that are outside of double quotes. I came up with a grammar for that: local re = require "re" local pattern = re.compile([[ line <- (quoted / 'a' / .)* quoted <- '"' rest rest <- '"' / . rest ]]) It seems that re.gsub 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 "a". But it was unwieldy because the pattern returns a table instead of a string. line <- {| ({quoted} / 'a' / {.})* |} I also looked into substitution captures, but got stuck because I needed to add ->'%1' around everything other than the 'a'.
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/78903262

http://stackoverflow.com/q/78846464
has comment: http://stackoverflow.com/comment/139021650
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139021691
tagged with: roblox-studio
has comment: http://stackoverflow.com/comment/139015491
score: 0
tagged with: game-development
has comment: http://stackoverflow.com/comment/139020078
has body: I'm making a simple flappy bird game in roblox studio 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 local bird = game.Workspace.bird bird.Anchored = true local uis = game.UserInputService local player = game.Players.LocalPlayer local gravity = -1 local Parts = bird:GetTouchingParts() local bird_flap = bird.Position + Vector3.new(0, 10, 0) local gravity_cancel = false local script_start = false uis.InputBegan:Connect(function(input) -- detect when to start script if input.UserInputType == Enum.UserInputType.MouseButton1 then script_start = true end end) if script_start then while not Parts do gravity_cancel = false if not Parts then task.wait(0.5) gravity = gravity * 2 -- make the bird fall on exponentially increasing increments end uis.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then -- make the gravity factor reset when clicked gravity_cancel = true end end) if not gravity_cancel then --make the bird fall bird.Position = bird.Position + Vector3.new(0, gravity, 0) else -- make the bird go up or "flap" bird.Position = bird_flap gravity = -1 end task.wait(0.1) end end
has title: mouse click not registering in roblox studio
answer count: 0
type: Question

http://stackoverflow.com/q/78874062
type: UnansweredQuestion
score: 1
has title: Get parent of element in Lua Pandoc filter
upvote count: 1
has comment: http://stackoverflow.com/comment/139065536
favorite count: 0
has answer: http://stackoverflow.com/a/78880558
has body: Is there a way to get the parent of an element, i.e. the element in which an element is in? Use cases: when printing the traversal of the elements (show_level) or when checking whether a Str is in a ListItem (str_in_listitem). See my python example below. If there is no parent in Lua, how are those use cases implemented in a Lua filter? from panflute import * from panflute.utils import debug def get_level(elem: Element, level=0): if elem.parent is None: return level else: return get_level(elem.parent, level=level + 1) def is_ancestor_of(elem: Element, clazz: Element): if elem.parent is not None: if type(elem.parent) == clazz: return True else: return is_ancestor_of(elem.parent, clazz) else: return False def show_level(elem: Element, doc: Doc): debug(" " * get_level(elem) + elem.tag) def str_in_listitem(elem: Element, doc: Doc): if type(elem) == Str: if is_ancestor_of(elem, ListItem): debug(stringify(elem)) if __name__ == "__main__": run_filters([show_level, str_in_listitem]) Appying this filter to the following input: [ Para [ Str "some" , Space , Str "text" ] , BulletList [ [ Plain [ Str "item1" ] ] , [ Plain [ Str "item2" ] , BulletList [ [ Plain [ Str "subitemA" ] ] , [ Plain [ Str "subitemB" ] ] ] ] ] ] shows the following output for show_level: MetaMap Str Space Str Para Str Plain ListItem Str Plain Str Plain ListItem Str Plain ListItem BulletList ListItem BulletList Doc and the following for str_in_listitem: item1 item2 subitemA subitemB
tagged with: pandoc
has answer: http://stackoverflow.com/a/78951550
answer count: 3
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/78878580
has comment: http://stackoverflow.com/comment/139065551
tagged with: lua

printing
tag name: printing
tags question: http://stackoverflow.com/q/78787625
type: Tag

http://stackoverflow.com/q/78884405
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78886093
tagged with: lua
has body: 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: task.wait(5) script.Parent.Anchored = false 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 "Anchored" keyword allowed?
has title: Why isn't the "Anchored" keyword working on grouped parts?
score: 0
type: Question
has answer: http://stackoverflow.com/a/78890730
answer count: 2
tagged with: roblox

http://stackoverflow.com/comment/138982613
score: 0
comment on: http://stackoverflow.com/a/78829658
type: AnswerComment
has text: Hi, i tried inserting you code, but nothing happens, the clone is invisible.
type: Comment

http://stackoverflow.com/q/78766168
answer count: 0
has title: Premake5 - cppdialect is ignored while creating project for VS2022
tagged with: lua
has comment: http://stackoverflow.com/comment/138945181
tagged with: premake
tagged with: project
type: UnansweredQuestion
tagged with: c++
has comment: http://stackoverflow.com/comment/138945625
has comment: http://stackoverflow.com/comment/138873418
has comment: http://stackoverflow.com/comment/138884855
has comment: http://stackoverflow.com/comment/138873270
has comment: http://stackoverflow.com/comment/138880319
score: 0
type: Question
tagged with: visual-studio-2022
has comment: http://stackoverflow.com/comment/138878665
has body: 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. However Sciter needs to be compiled with C++17. Premake5 provides a cppdialect option to configure that. But this option is completely ignored while my projects are generated. Below is the Lua code I'm using with Premake5: newoption { trigger = "device", value = "DESKTOP|HANDHELD|IOT", description = "target device", default = "DESKTOP", allowed = { { "DESKTOP", "Desktop machine" }, { "HANDHELD", "Mobile device" }, { "IOT", "IoT device" } } } newoption { trigger = "OPENGL", value = "GL|GLES", description = "OpenGL support", default = "GL", allowed = { { "GL", "OpenGL" }, { "GLES", "OpenGLES" } } } newoption { trigger = "VULKAN", description = "VULKAN support", } newoption { trigger = "METAL", description = "METAL support (MacOS/iOS)", } newoption { trigger = "DX12", description = "DX12 support (Windows)", } SDKDIR = "sdk.js" BUILDDIR = "build.js" defines { "SCITERJS", "SCRIPT_JS", "JS_STRICT_NAN_BOXING", "CONFIG_BIGNUM", "CONFIG_UNITS", "CONFIG_JSX", "CONFIG_JSX_SCITER", "CONFIG_DEBUGGER", "CONFIG_STORAGE", "CONFIG_OBJECT_LITERAL_CALL" } filter { "options:VULKAN" } defines {"USE_VULKAN", "SK_VULKAN"} includedirs { "$(VK_SDK_PATH)/Include" } filter { "options:METAL" } defines {"USE_METAL", "SK_METAL"} filter { "options:DX12" } defines {"USE_DX12", "SK_DIRECT3D"} filter { "options:OPENGL=GL" } defines {"USE_OPENGL", "SK_GL"} filter { "options:OPENGL=GLES" } defines {"USE_OPENGLES", "SK_GL"} filter {} MONOLITHIC = true -- by design USE_SKIA_BY_DEFAULT = true -- only rendering option on devices WINDOWLESS = true defines { "WINDOWLESS", "MONOLITHIC", "SCITER_BUILD", "DEVICE=" .. _OPTIONS["device"] } include "premake5-modules.lua" configurations { "Debug", "Release" } platforms { "x32", "x64","arm32", "arm64" } function osabbr() return os.target() end filter "system:windows" preferredtoolarchitecture "x86_64" …

http://stackoverflow.com/q/78767348
type: UnansweredQuestion
score: 0
tagged with: case-insensitive
has comment: http://stackoverflow.com/comment/138881481
tagged with: inheritance
answer count: 0
has body: I've been trying to wrap my head around utilizing inheritance with Lua (https://www.lua.org/pil/16.2.html and Case insensitive array in Lua 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. However, I've been unable to get anything working. Can anyone help? Thanks. In case the question arises on what I'm trying to achieve: 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. 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. 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?) In any case, some responders may shred my query to bits, so be gentle please.
tagged with: meta-method
type: Question
has comment: http://stackoverflow.com/comment/138884144
has comment: http://stackoverflow.com/comment/138877245
has title: Lua: Assistance Needed in Using Inheritance in conjunction with case-insensitive metatables/metamethods? Doable?
linked to: http://stackoverflow.com/q/7313794
tagged with: lua
tagged with: metatable

http://stackoverflow.com/a/78845484
type: Answer
has body: 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: elseif changeName == "Skin" then if character:FindFirstChild("BodyColors") then character.BodyColors:Destroy() end local BodyColors = v2:Clone() BodyColors.Name = "BodyColors" BodyColors.Parent = character --What I added local humanoid = character:FindFirstChild("Humanoid") local description = humanoid:GetAppliedDescription() description.HeadColor = BodyColors.HeadColor3 description.LeftArmColor = BodyColors.LeftArmColor3 description.LeftLegColor = BodyColors.LeftLegColor3 description.RightArmColor = BodyColors.RightArmColor3 description.RightLegColor = BodyColors.RightLegColor3 description.TorsoColor = BodyColors.TorsoColor3 humanoid:ApplyDescription(description) This uses humanoid:ApplyDescription to update the skin color after changing replacing the BodyColors instance within the character, so when updating the face via the same method the skin color no longer gets reset.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/78845403
answers question: http://stackoverflow.com/q/78845403

http://stackoverflow.com/comment/139205023
type: QuestionComment
has text: 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**?
comment on: http://stackoverflow.com/q/78760581
type: Comment
score: 0

http://stackoverflow.com/comment/139023405
type: Comment
has text: how can i add a unit popup to my orb, what am I missing in adding a player menu popup
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78852175

http://stackoverflow.com/q/78804245
type: UnansweredQuestion
favorite count: 0
has title: Error with the Lua File System(LFS), when importing the library
linked to: http://stackoverflow.com/q/68092319
tagged with: backend
score: 0
tagged with: orthanc-server
type: Question
has answer: http://stackoverflow.com/a/78805597
tagged with: lua
has body: 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 In my Lua code: -- Define the path to the LuaFileSystem library local lfs_path = "/usr/local/lib/lua/5.1/lfs.so" -- Update this path to the actual location of lfs.so -- Add the path to package.cpath package.cpath = package.cpath .. ";" .. lfs_path -- Load the LuaFileSystem library local lfs = require("lfs") local function isOlderThanTwoDays(path) local attr = lfs.attributes(path) if attr and attr.mode == "directory" then local age = os.difftime(os.time(), attr.modification) return age > 2 * 24 * 60 * 60 end return false end local function archiveFolder(path) local archiveName = path .. ".tar.gz" os.execute(string.format("tar -czf %s %s", archiveName, path)) os.execute(string.format("rm -rf %s", path)) end local function checkAndArchiveFolders(dirs) for _, dir in ipairs(dirs) do for file in lfs.dir(dir) do if file ~= "." and file ~= ".." then local fullPath = dir .. "/" .. file if isOlderThanTwoDays(fullPath) then archiveFolder(fullPath) end end end end end -- Usage local directoriesToCheck = { "/etc/orthanc/ClientRpts/IVH" -- "/path/to/your/second_directory", -- Add more directories as needed } This code gives me an error while loading the lfs library the error said: 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': /usr/local/lib/lua/5.1/lfs.so: undefined symbol: lua_gettop E0728 12:51:42.508185 MAIN ServerIndex.cpp:348] INTERNAL ERROR: ServerIndex::Stop() should be invoked manually to avoid mess in the destruction order! at first which is the start i ran luarocks install luafilesystem in the console/terminal to install lfs and then i got prompted with the error I mentioned above so i tried to add local lfs_path = "/usr/local/lib/lua/5.1/l…
downvote count: 1
upvote count: 1
answer count: 1

global-variables
tag name: global-variables
tags question: http://stackoverflow.com/q/78831240
type: Tag

http://stackoverflow.com/comment/138931803
has text: @AndrewYim yes they are
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78800396

http://stackoverflow.com/comment/138873418
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/78766168
score: 0
type: QuestionComment

http://stackoverflow.com/q/78845415
tagged with: lazyvim
upvote count: 2
tagged with: neovim-plugin
has body: I reinstalled neovim and followed the suggestions in this video. Lua syntax highlighting worked perfectly fine, until I added the following file lazy.lua file (and a require in my init.lua) local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) require("lazy").setup("my.plugins") It is this last line that breaks things. If I comment it out, things work as before. If I leave it uncommented then: I get this error whenever I open a Lua file: Error detected while processing function <SNR>22_NetrwBrowseChgDir[194]..<SNR>22_NetrwEditFile[10]..BufRea dPost Autocommands for "*": Error executing lua callback: /usr/share/nvim/runtime/filetype.lua:36: function <SNR>22_NetrwBrowseChgDir[ 194]..<SNR>22_NetrwEditFile[10]..BufReadPost Autocommands for "*"..FileType Autocommands for "*"..function <SNR>1_LoadFTPlugin[20]..script /usr/share/nvim/runtime/ftplugin/lua.lua: Vim(runtime):E5113: Error while calling lua chunk: /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:107: no parser for 'lua' langu age, see :help treesitter-parsers stack traceback: [C]: in function 'error' /usr/share/nvim/runtime/lua/vim/treesitter/language.lua:107: in function 'add' /usr/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:111: in function 'new' /usr/share/nvim/runtime/lua/vim/treesitter.lua:41: in function '_create_parser' /usr/share/nvim/runtime/lua/vim/treesitter.lua:108: in function 'get_parser' /usr/share/nvim/runtime/lua/vim/treesitter.lua:416: in function 'start' /usr/share/nvim/runtime/ftplugin/lua.lua:2: in main chunk [C]: in function 'nvim_cmd' /usr/share/nvim/runtime/filetype.lua:36: in function </usr/share/nvim/runtime/filetype.lua:35> [C]: in function 'pcall' vim/shared.lua: in function <vim/shared.lua:0> [C]: in function '_with' /usr/share/nvim/run…
score: 2
tagged with: neovim
has comment: http://stackoverflow.com/comment/139013279
tagged with: treesitter
has comment: http://stackoverflow.com/comment/139014578
type: UnansweredQuestion
favorite count: 0
has title: Treesitter says "No parser for Lua" after adding lazy.nvim to my config
has comment: http://stackoverflow.com/comment/139012298
has comment: http://stackoverflow.com/comment/139013538
answer count: 1
has comment: http://stackoverflow.com/comment/139013607
has answer: http://stackoverflow.com/a/78855512
has comment: http://stackoverflow.com/comment/139013546
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/139013262
has comment: http://stackoverflow.com/comment/139015337
has comment: http://stackoverflow.com/comment/139012789
tagged with: lua
has comment: http://stackoverflow.com/comment/139013349

http://stackoverflow.com/q/78766878
has body: 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 EnableRCS = true -- Quando definido como false, desativa o controle de recuo. RecoilControlMode = "High" -- Predefinições: "Low", "Medium", "High", "Ultra", "Insanity", "Custom" RcCustomStrength = 7 -- O valor DEVE ser ARREDONDADO! Sem valores decimais como 6.5! RequireToggle = true -- Mude para false se você quiser que ele esteja sempre ativado. ToggleKey = "CapsLock" -- Teclas utilizáveis: "CapsLock", "NumLock", "ScrollLock" DelayRate = 7 -- NÃO ALTERE SE VOCÊ NÃO SABE O QUE ESTÁ FAZENDO. -- Predefinições de Recuo -- if RecoilControlMode == "Low" then RecoilControlStrength = 8 elseif RecoilControlMode == "Medium" then RecoilControlStrength = 10 elseif RecoilControlMode == "High" then RecoilControlStrength = 14 end -- Predefinições de Recuo -- EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) OutputLogMessage("Event: %s, Arg: %d\n", event, arg) -- Adiciona depuração if EnableRCS then if RequireToggle then if IsKeyLockOn(ToggleKey) then if IsMouseButtonPressed(3) then -- Botão direito do mouse repeat if IsMouseButtonPressed(1) then -- Botão esquerdo do mouse repeat MoveMouseRelative(0, RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end else if IsMouseButtonPressed(3) then -- Botão direito do mouse repeat if IsMouseButtonPressed(1) then -- Botão esquerdo do mouse repeat MoveMouseRelative(0, RecoilControlStrength) Sleep(DelayRate) until not IsMouseButtonPressed(1) end until not IsMouseButtonPressed(3) end end end end OutputLogMessage("Script Loaded\n") 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 d…
score: 0
type: Question
answer count: 0
tagged with: lua
has title: Ghub buggy on g600?
tagged with: logitech-gaming-software
type: UnansweredQuestion

http://stackoverflow.com/q/78805862
has answer: http://stackoverflow.com/a/78806414
accepted answer: http://stackoverflow.com/a/78806414
answer count: 1
has body: The wiki page in question. The presence of &lt;div style=&gt; inside a Lua template's variable (content or args[1]) renders the entire variable nil. Template and module used: Module:BubbleBox/hex: A Lua module to sandwich content/args[1] between a preset div class and style. Template:BubbleBox/hex: Mediawiki template that invokes the aforementioned Module. Screenshot of expected vs. result Expected (how it should look): The image and caption shows and centered properly. Result: Said &lt;div style=&gt; makes the entire args[1] variable nil.
score: 1
favorite count: 0
type: AnsweredQuestion
upvote count: 1
tagged with: scribunto
type: Question
downvote count: 0
has title: Mediawiki Scribunto: renders the entire variable it is a part of nil
tagged with: lua
tagged with: mediawiki

http://stackoverflow.com/q/78852175
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/139023337
answer count: 0
has comment: http://stackoverflow.com/comment/139023405
has body: 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 blizzard_menu framework. Addon looks like orbs from diablo and my original code looks like: orb:SetScript("OnClick",function () if GetMouseButtonClicked() == "RightButton" then ToggleDropDownMenu(1, 1, PlayerFrameDropDown, "cursor", 0, 0) end end) and I have no idea how can i rewrite this to new framework. I tried to recreate it with guides on wiki and implementation_guide but nothing i tried works (get unit menumanager and then open it).
type: Question
upvote count: 1
tagged with: world-of-warcraft
tagged with: lua
has title: WOW addon unit frame menu
tagged with: add-on
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/138907373
type: AnswerComment
score: 0
has text: What did you change? Can you provide more explanation to aid future readers with similar problems?
type: Comment
comment on: http://stackoverflow.com/a/78781505

http://stackoverflow.com/comment/138873793
has text: 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.
score: 5
type: QuestionComment
comment on: http://stackoverflow.com/q/78765913
type: Comment

wikia
type: Tag
tags question: http://stackoverflow.com/q/78779863
tag name: wikia

http://stackoverflow.com/q/78860683
tagged with: luajit
favorite count: 0
has body: I recently published an application development toolkit written in lua. Here's a link to it: https://github.com/chris-montero/terra 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. 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 gdb -c core.12345 executable because there is no executable. How can I go about debugging a lua program that imports .so files that segfault at some point? Here's a link to the github issue, if you want more details: https://github.com/chris-montero/terra/issues/1
has comment: http://stackoverflow.com/comment/139043443
score: 2
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/78865607
accepted answer: http://stackoverflow.com/a/78865607
tagged with: lua
has comment: http://stackoverflow.com/comment/139039664
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/139042362
upvote count: 2
tagged with: gdb
type: Question
has title: How do I debug a segfaulting lua program that imports .so files?

http://stackoverflow.com/q/78831240
tagged with: lua
has body: 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... Here's my file structure: root\ inv.lua chestAPI\ inv_list.lua inv_scan.lua So my inv_scan.lua file scans all my inventories and stores the data in a 2D array. My inv_list.lua file is supposed to take that data and print it to a monitor. 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. My listing script needs the scan script's variables to be able to print anything. The inv.lua 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. So I want the inv.lua 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. I could do everything in one file but it would be horribly organized. 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. 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. EDIT While writing the minimal example, I fixed my problem. Here's how I did it. Minimal example: scan.lua --some heavy scanning function scan() data1 = 1 + 1 data2 = 4/2 return data1, data2 end print.lua --printing the data function print(data1, data2) print(data1) print(data2) end main.lua local scanner = require("scan.lua") local printer = require("print.lua") --get the data data1, data2 = scanner.scan() --wait for user input and then print it while true do input = read() if input == "print" then printer.print(data1, data2) end end so with this, I can do the scan only when needed and I can print as m…
downvote count: 0
has comment: http://stackoverflow.com/comment/138991998
score: 2
has comment: http://stackoverflow.com/comment/138991948
type: UnansweredQuestion
favorite count: 0
tagged with: global-variables
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/138989459
type: Question
has title: Communicating global variables in Lua
tagged with: require

wikipedia
tags question: http://stackoverflow.com/q/78827670
type: Tag
tag name: wikipedia

type-conversion
type: Tag
tag name: type-conversion
tags question: http://stackoverflow.com/q/78791470

http://stackoverflow.com/q/78896730
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/139221638
favorite count: 0
has comment: http://stackoverflow.com/comment/139108644
has title: Confused about part of the Knuth-Liang algorithm for hyphenation
tagged with: hyphenation
type: Question
upvote count: 1
has body: 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 pyhyphen readme: 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: . e x a m p l e . x1a x a m3 4m1p 1p2l2 ----------------- . e x1a4m3p2l2e . Finally, hyphens are placed wherever odd numbers appear Why only odd numbers?
answer count: 0
tagged with: lua
tagged with: tex
downvote count: 0

http://stackoverflow.com/q/78767378
tagged with: lua
has title: Lua scripting being used in mouse macro. (logitech)
upvote count: 1
score: 1
tagged with: logitech-gaming-software
type: UnansweredQuestion
downvote count: 0
has body: 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. The following script works perfectly as is (MB4 move mouse): MoveAmount = -900 function OnEvent(event, arg) OutputLogMessage("event = %s, arg = %d\n", event, arg) if (event == "PROFILE_ACTIVATED") then EnablePrimaryMouseButtonEvents(true) elseif event == "PROFILE_DEACTIVATED" then ReleaseMouseButton(4) -- to prevent it from being stuck on end if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then for x=1,10,1 do MoveMouseRelative(MoveAmount, 0) Sleep(5) But I want to use that in a macro, which isn't picking it up. How can I bind this to a macro?
tagged with: macros
tagged with: logitech
favorite count: 0
type: Question
answer count: 0

http://stackoverflow.com/a/78838511
answers question: http://stackoverflow.com/q/78836865
score: 1
type: Answer
downvote count: 0
has body: 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: "numical for" and "table for". The latter matches this question's for key, value in table and is described in https://www.lua.org/manual/4.0/manual.html#4.4 as: The table for statement traverses all pairs (index,value) of a given table. It has the following syntax: stat ::= for name `,' name in exp1 do block end A for statement like for index, value in exp do block end is equivalent to the code: do local _t = exp local index, value = next(t, nil) while index do block index, value = next(t, index) end end Note the following: _t is an invisible variable. The name is here for explanatory purposes only. The behavior is undefined if you assign to index inside the block. The behavior is undefined if you change the table _t during the traversal. The variables index and value are local to the statement; you cannot use their values after the for ends. You can use break to exit a for. If you need the value of index or value, assign them to other variables before breaking. 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. This means that for key, value in table is a special form of the for loop, explicitly for tables, called "table for", introduced with Lua 4.0. In Lua 5.0, another, more powerful form of for loop was introduced: the "generic for". It has a different syntax in that it expects an iterator instead of simply a table. (Refer to "generic for" in the Lua 5.0 manual for more information about iterators.) As to what happened to "table for", chapter "Incompatibilities with Previous Versions" in https://www.lua.org/manual/5.0/manual.html mentions: The old construction for k,v in t, where t is a table, is deprecated (although it is still supported). Use for …
upvote count: 1

http://stackoverflow.com/q/78760581
has comment: http://stackoverflow.com/comment/139205023
answer count: 0
type: Question
has body: 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. Folders hud |---lua | |---autorun | |---client | |---cl_hud.lua |---materials | |---gui | |---add.png cl_hud.lua surface.CreateFont("HUDFont", { font = "Roboto Medium", size = 30, weight = 1200, antialias = true, shadow = true }) hook.Add("HUDPaint", "CustomDarkRPHUD", function() local client = LocalPlayer() if not IsValid(client) then return end local health = client:Health() local armor = client:Armor() local maxArmor = 100 local maxHealth = client:GetMaxHealth() local money = client:getDarkRPVar("money") local salary = client:getDarkRPVar("salary") local job = client:getDarkRPVar("job") local license = client:getDarkRPVar("HasGunlicense") and "Yes" or "No" local wanted = client:getDarkRPVar("wanted") and "In wanted" or "Not in wanted" local time = os.date("%H:%M:%S", os.time()) local width = 350 local height = 35 --BG draw.RoundedBox(10, 20, ScrH() - 230, 400, 200, Color(100, 100, 100, 150)) local iconMaterial = Material("gui/add.png", "noclamp smooth") if not iconMaterial:IsError() then surface.SetDrawColor(255, 255, 255, 255) surface.SetMaterial(iconMaterial) surface.DrawTexturedRect(20, ScrH() - 500, 20, 20) else print("IMG error!") print(iconMaterial) -- console log >> Material [___error] end -- HP bar local healthWidth = (health / maxHealth) * width draw.RoundedBox(8, 29, ScrH() - 80, healthWidth, height, Color(255, 0, 0, 220)) -- AR bar local armorWidth = (armor / maxArmor) * width draw.RoundedBox(8, 29, ScrH() - 120, armorWidth, height, Color(58, 138, 219, 220)) if armor == 0 then draw.SimpleText("HP: " .. health .. "%", "HUDFont", 32, ScrH() - 80, Color(255, 255, 255), 0) draw.SimpleText("Cash: " .. money .. "$" .. " | +".. salary .. "$", "HUDFont", 32, ScrH() - 120, Color(50, 200, 0), 0) else draw.SimpleText("HP: " .. health .. "%", "HUDFont", 32, ScrH() - 80, Color(255, 255, 255), 0) draw.S…
tagged with: garrys-mod
tagged with: lua
type: UnansweredQuestion
has title: Img loading error | GLua | Garrys mod HUD
score: 0

http://stackoverflow.com/q/78866660
favorite count: 0
downvote count: 3
has comment: http://stackoverflow.com/comment/139050214
has body: 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. The program should take a single integer argument n. In Python: If n is even, print "Even in Python". If n is odd, print "Odd in Python". In Lua: If n is even, print "Even in Lua". If n is odd, print "Odd in Lua". The program should be valid syntax in both languages and produce the correct output when run with a Python interpreter or a Lua interpreter. _=1 n=... _=1 if n==nil then n=int(input()) end if n%2==0 then print("Even in "..(_ and "Python" or "Lua")) else print("Odd in "..(_ and "Python" or "Lua")) end i tried various other progrAams too but couldn't compile in both the compilers
has comment: http://stackoverflow.com/comment/139049034
type: Question
tagged with: python
tagged with: lua
score: -3
has comment: http://stackoverflow.com/comment/139048833
upvote count: 0
has title: how to write polyquine program for both python and lua?
has comment: http://stackoverflow.com/comment/139048795
answer count: 1
has answer: http://stackoverflow.com/a/78896853
type: UnansweredQuestion

http://stackoverflow.com/comment/139050214
has text: 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).
type: Comment
comment on: http://stackoverflow.com/q/78866660
score: 1
type: QuestionComment

http://stackoverflow.com/q/78898300
has title: 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?
has body: 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: function BlockQuote(elem) return pandoc.Div (elem.content, {["custom-style"] = "Displayed quotation"}) end 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.) However, the "Para" 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? And how can I test for whether a paragraph comes after a paragraph, a heading, or a blockquote? I also have general beginner questions about the syntax, and would like to see if I get it. "elem" is a variable that holds the content of the BlockQuote element. That content is a "block" (as opposed to an inline element), or in Lua terms, a table (but everything is a table in Lua?). 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. What is the meaning of this syntax: variable_name.field_name (elem.content)? Where can I look up what fields are available? And where can I find the most beginner-friendly Lua tutorial, ideally with a focus on Pandoc? I know these are many questions, but the first one is the most important (actual one). Any help or input is greatly appreciated! I don't even know where to begin.
answer count: 0
upvote count: 3
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/139128712
tagged with: lua
type: UnansweredQuestion
favorite count: 0
score: 3
tagged with: pandoc

http://stackoverflow.com/q/78890100
has comment: http://stackoverflow.com/comment/139092499
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/78890243
has comment: http://stackoverflow.com/comment/139099373
has answer: http://stackoverflow.com/a/78890243
tagged with: arrays
type: Question
downvote count: 0
has title: Creating separate lua tables for each object in an array
tagged with: lua
tagged with: lua-table
has body: 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. 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.
has comment: http://stackoverflow.com/comment/139091444
upvote count: 1
answer count: 1
score: 1
favorite count: 0

http://stackoverflow.com/comment/139117059
type: Comment
has text: Thanks, but I'd rather continue using `re` and not change how I implement the quoted rule.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78895246

http://stackoverflow.com/comment/139116108
type: AnswerComment
has text: 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 <- '"' [^"]* '"'`.
comment on: http://stackoverflow.com/a/78903262
type: Comment
score: 0

http://stackoverflow.com/q/78765913
tagged with: luajit
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/138873793
has body: I is possible to change the default hash function that lua (or luajit) uses for the HashTable part of a talbe ? I want to speedup table access in pure Lua. I saw that: The Default hash function for lua is not exposed There is no metatable value for the hashing (not mentionned in the documentation, and by any chance __hash does not work)
type: Question
downvote count: 0
tagged with: lua
answer count: 0
has title: Can I change the default hash function?
tagged with: lua-table
score: 2
tagged with: hashtable
type: UnansweredQuestion

http://stackoverflow.com/a/78881805
answers question: http://stackoverflow.com/q/78881717
upvote count: 3
has comment: http://stackoverflow.com/comment/139078365
type: Answer
score: 3
downvote count: 0
has body: string.gsub() returns two values. Therefore, table.insert() sees three arguments: table.insert(tab, 'b', 1). Three-argument call is supposed to be table.insert(t, pos, value) but pos here is a string, so it fails. You have to embrace gsub in order to get rid of that extra value: table.insert(tab, (str:gsub('a', 'b')))

http://stackoverflow.com/q/78845403
type: AnsweredQuestion
has title: Can I avoid humanoid:ApplyDescription resetting previous changes made to humanoid?
score: 0
tagged with: roblox
type: Question
tagged with: lua
has answer: http://stackoverflow.com/a/78845484
accepted answer: http://stackoverflow.com/a/78845484
has body: 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 humanoid:ApplyDescription. Here's how I'm currently using it: elseif changeName == "Face" then local humanoid = character:FindFirstChild("Humanoid") local description = humanoid:GetAppliedDescription() description.Face = v2.Value -- Id of the face humanoid:ApplyDescription(description) 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: elseif changeName == "Skin" then if character:FindFirstChild("BodyColors") then character.BodyColors:Destroy() end local bodyColors = v2:Clone() bodyColors.Name = "BodyColors" bodyColors.Parent = character I'm pretty sure that this resets the skin color because I'm not using humanoid:ApplyDescription 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). I've tried using humanoid:ApplyDescriptionReset 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.
answer count: 1

http://stackoverflow.com/q/78855024
score: 0
has body: Here is the code: --Esentials local tool = script.Parent repeat wait() until tool.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(tool.Parent) local animator = tool.Parent:FindFirstChild("Humanoid").Animator local dmgM = player.PlayerGui.Stats.DamageMultiplier.DMGmultiplier.Value local dmgMT = player.PlayerGui.Stats.DamageMultiplier tool.Activated:Connect(function() holding = true if combo == 0 then idle:Stop() hold1:Play() dmgMT.Visible = true repeat dmgM += 0.01 dmgMT.Text = "x"..math.clamp(dmgM, 1, 2) wait(0.01) until holding == false or dmgM == 2 elseif combo == 1 then idle:Stop() hold2:Play() dmgMT.Visible = true repeat dmgM += 0.01 dmgMT.Text = "x"..math.clamp(dmgM, 1, 2) wait(0.01) until holding == false or dmgM == 2 end end) tool.Deactivated:Connect(function() holding = false hold1:Stop() hold2:Stop() if combo == 0 and holding == false then dmgMT.Visible = false dmgM = 1 tool.Enabled = false tool.Hitbox.CanTouch = true wait(0.3) idle:Play() tool.Enabled = true tool.Hitbox.CanTouch = false combo += 1 elseif combo == 1 and holding == false then dmgMT.Visible = false dmgM = 1 tool.Enabled = false tool.Hitbox.CanTouch = true wait(0.5) idle:Play() tool.Enabled = true tool.Hitbox.CanTouch = false end end) tool.Hitbox.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local tgrPlayer = game.Players:GetPlayerFromCharacter(hit.Parent) if not tgrPlayer then local hum = hit.Parent:FindFirstChild("Humanoid") local humRP = hit.Parent:FindFirstChild("HumanoidRootPart") humRP.AssemblyLinearVelocity = Vector3.new(50, 25, 0) tool.Handle.Hit:Play() local total = baseDMG * dmgM hum:TakeDamage(total) print(total) tool.Hitbox.CanTouch = false elseif tgrPlayer then return end end end) 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. For example: When I charge the tool until it hits the maximum, the base damage will be mul…
has comment: http://stackoverflow.com/comment/139030116
type: Question
tagged with: roblox
has title: Damage multiplier will not work on "BaseDamage"
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139028868
has comment: http://stackoverflow.com/comment/139032658
type: UnansweredQuestion

http://stackoverflow.com/comment/138996370
score: 0
has text: The `InspectPlayerFromHumanoid` method is no longer used.
type: QuestionComment
comment on: http://stackoverflow.com/q/78808593
type: Comment

http://stackoverflow.com/comment/139092646
has text: @Емил Славчев – Which version of LÖVE is it?
comment on: http://stackoverflow.com/q/78889559
type: QuestionComment
score: 1
type: Comment

http://stackoverflow.com/q/78830610
favorite count: 0
has body: 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 CFrame 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: I haven't tried a lot as I'm not sure where to start. Maybe something along these lines: local function position_wheel(object,wheel): if wheel:IsA("BasePart") and object:IsA("BasePart") then wheel.Position=object.PivotPoint.Position+Vector3(0,.2,0) for w in pairs(workspace) do if w:IsA("Model") or w:IsA("BasePart") then local objecT=w.Touched:Connect(function(part) position_wheel(object,w) Note: This code does not contain any name checks, this is purely for example. Do not copy and paste without editing the code! Any suggestions would be greatly appreciated.
type: Question
downvote count: 0
answer count: 0
tagged with: lua
tagged with: scripting
tagged with: roblox
upvote count: 1
type: UnansweredQuestion
has title: How to write a pathfinding script in Roblox?
score: 1

http://stackoverflow.com/a/78787925
has body: 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: local header = file:read():gsub("\r", "")
has comment: http://stackoverflow.com/comment/138915740
score: 0
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78787625
answers question: http://stackoverflow.com/q/78787625

http://stackoverflow.com/q/78808593
has comment: http://stackoverflow.com/comment/138996370
type: UnansweredQuestion
has body: 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) It's described abov all works fine besides the fact that I can't inspect other peoples avatars. e, it
has comment: http://stackoverflow.com/comment/138961679
has answer: http://stackoverflow.com/a/78808861
answer count: 1
score: 0
type: Question
tagged with: roblox
has title: How could I fix the InspectPlayerFromHumanoid issue? Roblox Studio
tagged with: lua

http://stackoverflow.com/comment/139092685
has text: It would be good to mark your answer as accepted, then folks will know you found a solution that works.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78865607

http://stackoverflow.com/q/78882864
tagged with: windows
answer count: 0
tagged with: windows-11
has body: Basically, I am trying to edit the vlcrc file(%APPDATA%\vlc\vlcrc) from within the VLC > View > Edit the path for saving recordings menu item by running the below extension code file: function descriptor() return { title = "VLC Edit Record Dir"; version = "0.0.1"; author = "vicky-dev"; shortdesc = "&Edit the path for saving recordings"; } end function main_fn() local id = vlc.playlist.current() local item = (vlc.player or vlc.input).item() local uri = item:uri() vlc.msg.dbg("[VLC Playing] Write File!") local fname_tmp = item:uri():match("([^/\\]*)$") local file_name = vlc.strings.decode_uri(fname_tmp) write_file(vlc.config.userdatadir().."\n") edit_vlcrc_file(file_name) end function activate() main_fn() end function deactivate() vlc.deactivate() end function close() deactivate() end function write_file(data) local file = vlc.config.userdatadir() .. "/VLC_Current_Playing.txt" assert(os.remove(file)) vlc.msg.dbg("[VLC Playing] Write File!") local VLCPlayingFile = vlc.config.userdatadir() .. "/VLC_Current_Playing.txt" local file = io.open(VLCPlayingFile, "a+") file:write('Current Media File: '..data) file:close() end function edit_vlcrc_file(videoName) local vlcRc = vlc.config.userdatadir() .. "\\vlcrc" write_file(vlcRc) local file = io.open(vlcRc, "w+") for line in io.lines(file) do line:gsub("input-record-path*", "input-record-path=C:\Users\<Username>\Videos\<CustomFolder>".."\\"..videoName) end -- file:write('Current Media File: '..data) file:close() end 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 write_file() method. But the code when trying to open vlcrc file for write mode (w+), it throws this error: <codefile>.lua:47: bad argument #1 to 'lines' (string expected, got userdata) Can anyone help out in understanding why it's throwing that error on for line in io.lines(file) do and fixing it therein ?
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139085025
tagged with: vlc
score: 0
type: Question
has comment: http://stackoverflow.com/comment/139099719
has title: Lua + VLC Media Player: Error when trying to edit the "vlcrc" file from VLC Lua Extension
tagged with: plugins

http://stackoverflow.com/a/78880558
upvote count: 1
answers question: http://stackoverflow.com/q/78874062
downvote count: 0
has body: 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. We take the middle road: we still let pandoc do most 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: -- The level counter. Modified as we traverse the AST local level = 0 -- A filter to bump the level. It's used recursively, -- so it's only declared here, but defined later. local bump_level_filter -- Print the element tag, indented by `level` spaces. -- Calls the `bump_level_filter` recursively local print_tag = function (elem) print(string.rep(' ', level) .. elem.t) return elem:walk(bump_level_filter) end local bump_level = function (elems) level = level + 1 local result = elems:map(print_tag) level = level - 1 -- Return the elements unchanged, but DON'T continue -- walking to deeper levels. That's done manually -- in `print_tag`. return result, false end bump_level_filter = { traverse = 'topdown', Inlines = bump_level, Blocks = bump_level, } return {bump_level_filter} The result isn't quite correct though, because the code doesn't account for nesting in list items etc. That would have to happen manually. Using the input given above, the filter produces: Para Str Space Str BulletList Plain Str Plain Str BulletList Plain Str Plain Str
type: Answer
has comment: http://stackoverflow.com/comment/139076369
score: 1

http://stackoverflow.com/q/78765047
tagged with: neovim
score: 5
answer count: 0
has title: Neovim BiomeJS not using biome.json formatting
type: Question
tagged with: biomejs
has body: My lsp.lua is as follows: local util = require("lspconfig.util") return { { "williamboman/mason.nvim", opts = function(_, opts) vim.list_extend(opts.ensure_installed, { "biome", "stylua", "selene", "luacheck", "shellcheck", "shfmt", "tailwindcss-language-server", "typescript-language-server", "css-lsp", }) end, }, { "neovim/nvim-lspconfig", opts = { --- other options servers = { tsserver = { on_attach = function(client) client.server_capabilities.documentFormattingProvider = false end, }, biome = { cmd = { "biome", "lsp-proxy" }, filetypes = { "javascript", "javascriptreact", "json", "jsonc", "typescript", "typescript.tsx", "typescriptreact", "astro", "svelte", "vue", "css", }, root_dir = util.root_pattern("biome.json"), }, }, }, }, } So in my project, I have a biome.json 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 biome.json configuration and hence resulting in different formatting everytime I save a file. What is it I'm missing here?
favorite count: 0
downvote count: 0
upvote count: 5
tagged with: lua
type: UnansweredQuestion
tagged with: neovim-plugin

http://stackoverflow.com/a/78890243
has comment: http://stackoverflow.com/comment/139091778
has body: Let's say your array looks like this (and keep in mind that lua arrays are tables with numeric indexes): monsters = {[1] = "orc", [2] = "troll", [3] = "ogre"} yeah, you'll get into trouble if you try to create a single "stats" table template and assign it to each monster name in the array: stats = {["strength"] = 15, ["health"] = 10} monster_stats = {} -- initialize new table for stats for k,v in ipairs(monsters) do monster_stats[v] = stats end monster_stats["orc"].strength = 10 -- change strength print(monster_stats["orc"].strength) print(monster_stats["troll"].strength) output: 10 10 We want to only change the orc's strength, but we end up changing everyone's strength. That's because both monster_stats["orc"] and monster_stats["troll"] point at the same table in memory. What you want is a way to clone a table -- and there is an example at lua.org[0]. 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 "stats" variable points to a different table in memory. function clone (t) -- t is a table local new_t = {} -- create a new table local i, v = next(t, nil) -- i is an index of t, v = t[i] while i do new_t[i] = v i, v = next(t, i) -- get next index end return new_t end monsters = {[1] = "orc", [2] = "troll", [3] = "ogre"} stats = {["strength"] = 15, ["health"] = 10} monster_stats = {} -- initialize new table for stats for k,v in ipairs(monsters) do monster_stats[v] = clone(stats) end monster_stats["orc"].strength = 10 -- change strength print(monster_stats["orc"].strength) print(monster_stats["troll"].strength) output: 10 15 You can see that the tables are now all separate by printing out the values of the tables themselves: print(monster_stats["orc"]) print(monster_stats["troll"]) print(monster_stats["ogre"]) output: table: 0x55be070536b0 table: 0x55be07053bc0 table: 0x55be07053c80 References: [0] https://www.lua.org/manual/2.4/node31.html
score: 0
accepted answer of: http://stackoverflow.com/q/78890100
has comment: http://stackoverflow.com/comment/139092047
has comment: http://stackoverflow.com/comment/139092990
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78890100
has comment: http://stackoverflow.com/comment/139099363

http://stackoverflow.com/comment/139044361
type: QuestionComment
comment on: http://stackoverflow.com/q/78863937
has text: Are you really using Lua 5.0??
type: Comment
score: 4

http://stackoverflow.com/q/78883172
answer count: 1
type: UnansweredQuestion
score: 0
type: Question
has body: https://pastebin.com/vPgjPdnK local Players = game:GetService("Players") local pointPart1 = game.Workspace.PointsPlaceFolder.PointPart1 local function onCharacterAdded(character, player) player:SetAttribute("IsAlive", true) local humanoid = character:WaitForChild("Humanoid") humanoid.Died:Connect(function() local points = player.leaderstats.Points points.Value = 0 player:SetAttribute("IsAlive", false) end) end local function onPlayerAdded(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local points = Instance.new("IntValue") points.Name = "Points" points.Value = 0 points.Parent = leaderstats player:SetAttribute("IsAlive", false) player.CharacterAdded:Connect(function(character) onCharacterAdded(character, player) end) end Players.PlayerAdded:Connect(onPlayerAdded) while true do task.wait(1) local playerList = Players:GetPlayers() for i = 1, #playerList do local player = playerList[i] if player:GetAttribute("IsAlive") then local points = player.leaderstats.Points points.Value += 1 end end end 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.
has title: 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
tagged with: lua
tagged with: scripting
has answer: http://stackoverflow.com/a/78895254

http://stackoverflow.com/a/78826958
score: 0
has comment: http://stackoverflow.com/comment/138978199
has body: You can not do an assignment inside an if condition in lua. I dont really see the point, you could just run the function and assignment before your if condition. local matches = Regex("THIS IS a TEST", "%a") if matches then print "is a match" end 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. local regex = { matches = {} } local mt = { match = function(self, str, pattern) found = false for w in string.gmatch(str, pattern) do self.matches[w] = true; -- or like whatever you want to do here. found = true end return found end } mt.__index = mt setmetatable(regex, mt) if (regex:match("THIS IS a TEST", "%a"))then print("is a match") end
type: Answer
answers question: http://stackoverflow.com/q/78826881

http://stackoverflow.com/a/78827939
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78827670
has body: Line 567 of https://es.wikipedia.org/wiki/M%C3%B3dulo:Ficha?oldid=155034254 is local entidad = args.entidad or mw.wikibase.getEntityIdForCurrentPage(). The problem is that mw.wikibase is undefined on your wiki, probably because your Miraheze wiki doesn't have https://www.mediawiki.org/wiki/Extension:Wikibase_Client enabled. https://meta.miraheze.org/wiki/Extensions 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 hacerBarraWikidata() on line 638, since it's the only function that references mw.wikibase, and without that it doesn't have anything useful to do.
score: 0
accepted answer of: http://stackoverflow.com/q/78827670

http://stackoverflow.com/a/78891135
has body: Rig:CreateHumanoidModelFromUserId(UserID) --Make this the dummy would be best way
has comment: http://stackoverflow.com/comment/139128652
score: 0
answers question: http://stackoverflow.com/q/78891008
type: Answer

http://stackoverflow.com/comment/139013546
type: QuestionComment
comment on: http://stackoverflow.com/q/78845415
type: Comment
score: 0
has text: @KyleF.Hartzenberg, edited my answer for the `checkhealth`. There seems to be something there.

http://stackoverflow.com/a/78836162
has comment: http://stackoverflow.com/comment/138994193
has comment: http://stackoverflow.com/comment/138995682
type: Answer
upvote count: 1
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/138995679
has body: MouseButton1Click is not a boolean, it's an Event. That means instead of continually checking whether button.MouseButton1Click is true, you should just define a function with the same functionality and bind it to the event in question using the Connect() method. Additionally, MouseButton1Click is probably the wrong choice here. Activated will perform a similar function, but with more cross-compatibility. This LocalScript should do the trick: local button = script.Parent local main_menu = script.Parent.Parent.Parent.Parent local main_menu_frame = script.Parent.Parent.Parent main_menu.Enabled = true -- This function defines what should happen when the button gets clicked local function onClick() game.Lighting.Blur.Enabled = false main_menu.Enabled = false main_menu_frame.Active = false main_menu_frame.Transparency = 1 main_menu_frame.Visible = false end -- And this line ensure the function is called every time the button is activated button.Activated:Connect(onClick)
has comment: http://stackoverflow.com/comment/138995351
answers question: http://stackoverflow.com/q/78832294

http://stackoverflow.com/a/78846143
downvote count: 0
type: Answer
upvote count: 1
has body: Firstly, the "rocks" check health error is likely because you don't have LuaRocks installed on your system. LuaRocks is a requirement for lazy.nvim so that it can install rockspecs. You can either install it, or disable its use in lazy.nvim by uncommenting the line rocks = { enabled = false }, below. Secondly, by moving lazy.lua from ~/.config/nvim/lua/config to ~/.config/nvim/lua, you've inadvertently created a name clash between your lazy.lua file and the lazy module ~/.local/share/nvim/lazy. The solution is to rename ~/.config/nvim/lua/lazy.lua to something other than lazy.lua, or put it in some {name} directory like you've done prior. Renaming the file to something simple and read-able like lazy-config.lua will suffice. More concretely, assuming you want the following structured setup, you need the three things listed below. ~/.config/nvim ├── init.lua └── lua ├── lazy-config.lua └── plugins ├── spec1.lua ├── ** └── spec2.lua Ensure the ~/.config/nvim/init.lua file exists, and calls the following function: require("lazy-config") Ensure the directory ~/.config/nvim/lua directory exists, and within that directory, there is the lazy-config.lua file which contains at least the following code: -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then local lazyrepo = "https://github.com/folke/lazy.nvim.git" local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) if vim.v.shell_error ~= 0 then vim.api.nvim_echo({ { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, { out, "WarningMsg" }, { "\nPress any key to exit..." }, }, true, {}) vim.fn.getchar() os.exit(1) end end vim.opt.rtp:prepend(lazypath) -- Make sure to setup `mapleader` and `maplocalleader` before -- loading lazy.nvim so that mappings are correct. -- This is also a good place to setup other settings (vim.opt) vim.g.mapleader = " " vim.g.maplocalleader = "\\" -- Setup lazy.nvim require(…
score: 1
answers question: http://stackoverflow.com/q/78831855

http://stackoverflow.com/q/78839148
type: UnansweredQuestion
has title: VScode: inserting new line inside an array suddenly changes spacing
answer count: 0
score: 0
type: Question
has comment: http://stackoverflow.com/comment/138999657
has comment: http://stackoverflow.com/comment/138999692
tagged with: lua
has body: it seems that the behavior only occurs while there is already a entry defined in the array, not while it is empty but 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) inserting another new line after that will remove all indentation entirely for context, it is only a new behavior and has never happened in the past 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 i searched inside vscode's editor settings, however i was unable to find the exact setting that could cause such a specific problem edit: i notice another related problem that has started happening at the same time i noticed this behavior, instead the editor entirely refuses to add any indentation upon pressing enter
tagged with: visual-studio-code

http://stackoverflow.com/q/78828662
score: 1
has body: The Problem I would like to automatically set the scroll offset to half the value of vim.opt.lines (see :help lines). I Tried I tried the following: vim.opt.scrolloff = vim.opt.lines // 2 I Expected I expected this to retrieve the current value of vim.opt.lines, divide it by 2, and assign the result to vim.opt.scrolloff. Results This is what happened instead (upon reopening NeoVim): Error detected while processing C:\Users\&lt;user&gt;\AppData\Local\nvim\init.lua: E5112: Error while creating lua chunk: C:\&lt;user&gt;\AppData\Local\nvim\init.lua:24: unexpected symbol near '/' Press ENTER or type command to continue My Questions Is this a syntax error? Is there any way to access vim.opt.lines or an equivalent value? 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 init.lua is being processed? Note I have previously just used vim.opt.scrolloff = 26 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.
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/138980908
answer count: 1
tagged with: neovim
tagged with: terminal
tagged with: scroll-offset
has answer: http://stackoverflow.com/a/78830039
type: Question
downvote count: 0
tagged with: lua
accepted answer: http://stackoverflow.com/a/78830039
has title: Can I automatically set the scroll offset to half of the terminal height?
has comment: http://stackoverflow.com/comment/138980934
upvote count: 1

http://stackoverflow.com/q/78822833
type: Question
has comment: http://stackoverflow.com/comment/138972530
tagged with: garrys-mod
tagged with: lua
has body: I have written logs for the server Garry's mod but I do not display information in the parameters "Damage" and "Connect" anyone can say what is wrong with the script? I would like to add more logs of profession change how can it be done? local logs = { kill = {}, damage = {}, changename = {}, connect = {}, disconnect = {}, Kd = nil } -- Entity killed logging gameevent.Listen("entity_killed") hook.Add("entity_killed", "", function(data) if not logsEnabled then return end local victim = "unknown" local attacker = "map" local weapon = "Unknown gun" for _, ply in pairs(player.GetAll()) do if ply:EntIndex() == data.entindex_killed then victim = ply:Nick() end if ply:EntIndex() == data.entindex_attacker then attacker = ply:Nick() local weaponEntity = ply:GetActiveWeapon() if IsValid(weaponEntity) then weapon = weaponEntity:GetPrintName() end end end table.insert(logs.kill, "[" .. os.date("%H:%M:%S") .. "] " .. attacker .. " killed player " .. victim .. " weapon " .. weapon) end) -- Entity damage logging hook.Add("EntityTakeDamage", "", function(target, dmginfo) if not logsEnabled then return end if not target:IsPlayer() then return end local attacker = dmginfo:GetAttacker() local attackerName = "Unknown" local weapon = "Unknown gun" if attacker:IsPlayer() then attackerName = attacker:Nick() local weaponEntity = attacker:GetActiveWeapon() if IsValid(weaponEntity) then weapon = weaponEntity:GetPrintName() end end table.insert(logs.damage, "[" .. os.date("%H:%M:%S") .. "] " .. attackerName .. " did damage to a player " .. target:Nick() .. " на " .. dmginfo:GetDamage() .. " HP" .. " weapon " .. weapon) end) -- Chat name change and connect/disconnect logging hook.Add("ChatText", "", function(index, name, text, type) if not logsEnabled then return end if type == "namechange" then table.insert(logs.changename, "[" .. os.date("%m/%d/%Y-%H:%M:%S") .. "] " .. name) elseif type == "joinleave" then local nickname, steamID = text:match("([^#]+)#([^%(]+)%(%d+:.-%)(.-)joined") if nickna…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139204989
answer count: 0
has title: I wanted to write logs for the garry's mod server, but I have a problem
score: 0

http://stackoverflow.com/comment/138884144
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78767348
has text: @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)?
score: 0

mediawiki-api
tags question: http://stackoverflow.com/q/78779863
tag name: mediawiki-api
type: Tag

visual-studio-2022
tags question: http://stackoverflow.com/q/78766168
type: Tag
tag name: visual-studio-2022

http://stackoverflow.com/comment/138991998
score: 0
type: QuestionComment
has text: that's something that happens a lot. reducing the complexity is the key to solving problems.
comment on: http://stackoverflow.com/q/78831240
type: Comment

http://stackoverflow.com/q/78858251
tagged with: lua
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78865143
accepted answer: http://stackoverflow.com/a/78865143
type: Question
upvote count: 1
favorite count: 0
tagged with: pandoc
has title: Pandoc Lua filter matching all element types
downvote count: 0
score: 1
answer count: 1
has body: How to write a Pandoc Lua filter with a function matching all elements despite of its node type? With a Python panflute filter I would do it as follows: # Python filter from panflute import * def action(elem, doc): debug(type(elem)) def main(doc=None): return run_filter(action, doc=doc) if __name__ == &quot;__main__&quot;: main() With Lua I'd like to have somethig like the following: -- Lua filter function action(elem) print(pandoc.utils.type(elem)) end return { {Inline = action}, {Block = action}, -- {* = action}, -- this is no valid Lua -- how many types must be added here to cover all the types? } If every element type has to be explicitly added. Where can I get the List of all element types?

http://stackoverflow.com/a/78865607
upvote count: 2
answers question: http://stackoverflow.com/q/78860683
score: 2
has body: I found out how to solve my own issue. compile your .so files with debug symbols by passing the -g option to gcc (or whatever compiler you use) open up gdb. In gdb: (gdb) set debug jit 1 (gdb) target exec /usr/bin/luajit (gdb) run ./your_program_name.lua
accepted answer of: http://stackoverflow.com/q/78860683
downvote count: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/139092685

http://stackoverflow.com/q/78899163
type: Question
upvote count: 1
has body: Using the multibib filter, it is possible to insert several bibliographies in a Quarto document, like this: --- format: pdf filters: - multibib title: "Test" csl: elsevier-harvard.csl # Turn off YAML validation validate-yaml: false bibliography: main: references.bib lit: literature.bib # Disable citeproc citeproc: false --- # Main text @bb @aa # Bibliography ::: {#refs-main} ::: # Appendix ::: {#refs-lit} ::: with references.bib containing: @Article{aa, author = {Author, A.}, title = {Title}, journal = {Journal}, year = 2000 } and literature.bib containing; @Article{bb, author = {Brother, B.}, title = {Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling Titling}, journal = {Ann. J.}, year = 2002 } 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. 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? Maybe that would be only possible with a more elaborate approach with LaTeX?
tagged with: lua
tagged with: quarto
score: 1
accepted answer: http://stackoverflow.com/a/78918226
has title: Quarto - Apply different styles to different bibliographies
downvote count: 0
favorite count: 0
type: AnsweredQuestion
tagged with: bibliography
tagged with: pandoc
answer count: 1
has answer: http://stackoverflow.com/a/78918226

http://stackoverflow.com/a/78837343
answers question: http://stackoverflow.com/q/78836411
has comment: http://stackoverflow.com/comment/139001827
score: 0
type: Answer
has body: You're indexing a nil value with CombatStatus. That means you need to look for something.CombatStatus something:CombatStatus or something["CombatStatus"] in your code. You'll find game.Players:FindFirstChild(Hit.Parent.Name).CombatStatus.Value So game.Players:FindFirstChild(Hit.Parent.Name) returns nil. Indexing nil does not make any sense and his hence not allowed and prompted with an error. Find out why the function returns nil and fix the cause. If you cannot ensure that a value is indexable, you should not index it without checking.

http://stackoverflow.com/comment/139044363
comment on: http://stackoverflow.com/q/78863937
has text: 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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/78878580
downvote count: 0
type: Answer
upvote count: 1
has body: 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. @tarleb: please feel free to copy or adopt this to an own answer. I would then mark it accepted and delete my answer. function uppercase_str_in_bullet_list(bullet_list) return bullet_list:walk{ Str = function(str) str.text = pandoc.text.upper(str.text) return str, false end } end return {{ BulletList = uppercase_str_in_bullet_list }} [ Para [ Str "some" , Space , Str "text" ] , BulletList [ [ Plain [ Str "ITEM1" ] ] , [ Plain [ Str "ITEM2" ] , BulletList [ [ Plain [ Str "SUBITEMA" ] ] , [ Plain [ Str "SUBITEMB" ] ] ] ] ] ]
score: 1
answers question: http://stackoverflow.com/q/78874062

http://stackoverflow.com/comment/139039664
comment on: http://stackoverflow.com/q/78860683
score: 1
type: Comment
has text: 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.
type: QuestionComment

http://stackoverflow.com/q/78778829
type: Question
downvote count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/79011154
has title: Work-around for co-socket api's not being available in log_by_lua giving 404 error
has body: 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. Context: 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. High level solution: 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. The Problem: So, from what I've found, the phase in which I can catch the nginx response status at the end of the request is log_by_lua (specifically in my case, log_by_lua_file). The problem is that log_by_lua_file does not have access to cosocket apis, as per these docs, 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 ngx.timer.at (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 resty-http, 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 endpo…
has comment: http://stackoverflow.com/comment/139313261
tagged with: openresty
upvote count: 1
type: UnansweredQuestion
score: 1
tagged with: nginx
favorite count: 0
tagged with: lua-ngx-module
answer count: 1
has comment: http://stackoverflow.com/comment/139083420
tagged with: nginx-config

http://stackoverflow.com/comment/138945181
score: 0
type: QuestionComment
type: Comment
has text: @Jarod42 no unfortunately, I checked the includes and there are no `cppdialect` hidden in them.
comment on: http://stackoverflow.com/q/78766168

http://stackoverflow.com/a/78918226
accepted answer of: http://stackoverflow.com/q/78899163
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78899163
has body: It seems it is not possible at the moment with the multibib filter only and a full markdown/quarto solution. I was able to get two bibliographies with different styles using: multibib with markdown citations (@aa) for one type of citation (numbered refs in the capture below), using the .csl file loaded in the YAML header. LaTeX citations (\cite{bb}) using the citation-style-language LaTeX package to load the second .csl file. The different style can be applied to a section of the document using the newrefsection tag. the lualatex engine --- format: pdf: keep-tex: true include-in-header: text: | \usepackage{citation-style-language} \addbibresource{references.bib} pdf-engine: lualatex filters: - multibib title: "Test" csl: american-chemical-society.csl # Turn off YAML validation validate-yaml: false bibliography: lit: literature.bib # Disable citeproc citeproc: false --- \newrefsection[style = elsevier-harvard, bib-resource = references] # Main text Citation with author-year \cite{bb}. Numbered citation. @aa # Bibliography \printbibliography[heading=none] \endrefsection # Appendix ::: {#refs-lit} ::: Not a perfect solution because of the two types of citation systems, but quite easy to use.

lua-ngx-module
tag name: lua-ngx-module
type: Tag
tags question: http://stackoverflow.com/q/78778829
tags question: http://stackoverflow.com/q/79474052

http://stackoverflow.com/comment/139048795
has text: Is this the complete code, the visual inspection shows there are some syntactical problems
type: Comment
comment on: http://stackoverflow.com/q/78866660
type: QuestionComment
score: 0

http://stackoverflow.com/a/78758468
has body: As long as the module is in your LUA_PATH (see The require function in Programming in Lua), you can just require it and execute the function: local yes_no = require("yesno") print(yes_no("y")) -- should print true It all comes down to where you're putting the module and how you intend to use it. If it's available on LuaRocks (though I couldn't find it there), you can just install it globally. You may also just copy-paste the code into any directory that's part of your LUA_PATH (or you can add a custom directory to your LUA_PATH), if you're only planning on using it in your CLI. 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).
answers question: http://stackoverflow.com/q/78746601
score: 0
type: Answer

http://stackoverflow.com/q/78826653
tagged with: haproxy
tagged with: lua
type: UnansweredQuestion
tagged with: luasocket
upvote count: 1
score: 0
favorite count: 0
type: Question
has body: i am new to lua and haproxy and have been experiencing a strange problem. I am using haproxy 2.7.3 lua 5.3.6 luarocks 3.9.1 When haproxy calls my function created in Lua the https.request call (in lua script) always comes back with the response code "Device or Resource busy" and the response body is empty. When i run the same lua script standalone without haproxy everything works fine and the response comes back. The error in haproxy logs: This is output of the core.Debug(respcode) Aug 1 22:37:14 localhost haproxy[58794]: Device or resource busy files: Haproxy.cfg global lua-load /opt/haproxy/redirect_http.lua log 127.0.0.1 local2 chroot /var/lib/haproxy pidfile /var/run/haproxy.pid maxconn 4000 user haproxy group haproxy daemon # turn on stats unix socket stats socket /var/lib/haproxy/stats defaults mode http log global option httplog option dontlognull option http-server-close option forwardfor except 127.0.0.0/8 option redispatch retries 10 timeout http-request 60s timeout queue 2m timeout connect 60s timeout client 2m timeout server 2m timeout http-keep-alive 60s timeout check 30s maxconn 9000 frontend proxy bind *:80 bind *:443 ssl crt /opt/haproxy/certs/haproxy.pem mode http acl getdemo path_beg /test/v2/p/me backend test mode http http-request use-service lua.redirect resolvers mydns parse-resolv-conf hold valid 10s redirect_http.lua local http = require"ssl.https" local socket = require"socket" local ltn12 = require"ltn12" local function main(applet) local reqbody = "grant_type=client_credentials" local respbody = {} local result, respcode, respheaders, respstatus = http.request { method = "POST", url = "https://example.com/oauth/token", source = ltn12.source.string(reqbody), headers = { ["Host"] = "example.com", ["Authorization"] = "Basic SOMEVALUE", ["Accept"] = "*/*", ["Connection"] = "keep-alive", ["Content-Type"] = "application/x-www-form-urlencoded", ["content-length"] = tostring(#reqbody) }, sink = ltn12.sink.table(respbody) } respbody = table.concat(…
downvote count: 1
tagged with: luasec
has title: Haproxy with LuaSocket Device or resource busy error
answer count: 0

http://stackoverflow.com/q/78831881
type: Question
has body: 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. I tried deleting and adding back the pack, reopening the project and restarting Roblox studio, but it didn't help. How can i fix this?
tagged with: lua
has answer: http://stackoverflow.com/a/78832783
downvote count: 3
favorite count: 0
score: -1
has title: I can't add admin HD properly in Roblox Studio
type: AnsweredQuestion
answer count: 1
upvote count: 2
accepted answer: http://stackoverflow.com/a/78832783

http://stackoverflow.com/a/78832783
answers question: http://stackoverflow.com/q/78831881
upvote count: 2
has comment: http://stackoverflow.com/comment/138997026
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78831881
downvote count: 0
has body: Drag the pack in the ServerScriptServer folder. Make sure none of the scripts are disabled. Make sure you have the right pack, some are scams. Search HD ADMIN in the explorer and delete anything with the name. Make sure no parts have the name HD ADMIN. 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!
score: 2

http://stackoverflow.com/q/78863937
has comment: http://stackoverflow.com/comment/139044361
has comment: http://stackoverflow.com/comment/139044363
upvote count: 1
answer count: 1
type: UnansweredQuestion
tagged with: performance
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/139044357
has title: Performance of calling a function, passing multiple return values from another function call?
tagged with: function
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/78866514
tagged with: lua
has body: A function f() returns multiple values, which are to be fed into a second function g(). I cannot change f(), but I can change g() and all calls to it. I'm wondering if it's possible to say which variant performs best? What does it depend on? Function header with one table argument function g(arg) --code end and function call with table constructor g({f()}) Function header with variable number of arguments function g(...) --code end and regular function call g(f()) Function header with multiple variables (assuming number of f() return values is known) function g(x, y, z) --code end and regular function call g(f()) A completely different variant?
tagged with: lua-table

http://stackoverflow.com/a/78800463
type: AcceptedAnswer
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78800396
has body: 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 Backpack docs). 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 LocalScript docs). You should run it on a regular script in ServerScriptService instead. The following script will add a tool named "Tool" to each player's StarterGear when they join the game: local replicatedStorage = game:GetService("ReplicatedStorage") local assets = replicatedStorage:WaitForChild("Assets") local function addItem(player, itemName) local item = assets:FindFirstChild(itemName) if not item then return end item:Clone().Parent = player:WaitForChild("StarterGear") end game:GetService("Players").PlayerAdded:Connect(function(player) addItem(player, "Tool") end) (Of course, you can achieve a similar effect just by putting Tool into the StarterPack folder.)
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/78800396

http://stackoverflow.com/q/78888787
type: Question
has answer: http://stackoverflow.com/a/78907314
accepted answer: http://stackoverflow.com/a/78907314
tagged with: lua
has body: 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 Ctrl+n / Ctrl+p to move or down. In the current code here: vim.api.nvim_set_keymap("n", "<leader>a", ":e <C-R>=expand('%:h')<CR>/", { noremap = true, silent = true }) I have to press the shortcut and <Tab> 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 vim.api.nvim_set_keymap("n", "<leader>e", ":e <C-R>=expand('%:p:h')<CR>/<CR>", { noremap = true, silent = true }) which is very similar.
type: AnsweredQuestion
tagged with: neovim
has title: Neovim shortcut to provide file choice from current file without plugins?
answer count: 1
score: 0

http://stackoverflow.com/q/78781305
favorite count: 0
has answer: http://stackoverflow.com/a/78781505
answer count: 1
tagged with: user-interface
tagged with: roblox
type: Question
upvote count: 1
accepted answer: http://stackoverflow.com/a/78781505
has body: 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. Where the code starts (Local script attached to a text button): local expManager = require(game.ReplicatedStorage.ExpManager) expManager.expGui.addExp.MouseButton1Click:Connect(function() expManager.addExp(25) end) Where that code leads (Module script within ReplicatedStorage, along with a RemoteEvent): ExpManager.expEvent = game.ReplicatedStorage:WaitForChild("ExpEvent") function ExpManager.addExp(expAmount) ExpManager.expEvent:FireServer("addExp", expAmount) end Where that leads (Server script within ServerScriptService that handles stat values and saving local expEvent = game.ReplicatedStorage:WaitForChild("ExpEvent") expEvent.OnServerEvent:Connect(function(plr, eventtype, amount) local character = plr.Character if eventtype == "addLevel" then plr.Stats.Level.Value += amount expEvent:FireClient(plr, "updateExp") end if eventtype == "addExp" then plr.Stats.expPoints.Value += amount expEvent:FireClient(plr, "updateExp") end end) Where that leads (Local script within StarterCharacterScripts): local expManager = require(game.ReplicatedStorage.ExpManager) local expEvent = game.ReplicatedStorage:WaitForChild("ExpEvent") expEvent.OnClientEvent:Connect(function(eventtype) if eventtype == "updateExp" then expManager.updateExpBar() end end) 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): ExpManager.expGui = ExpManager.playerGui:WaitForChild("expGui") ExpManager.expText = ExpManager.expGui.expBackground:WaitForChild("expText") ExpManager.exp = ExpManager.player.Stats.expPoints.Value ExpManager.level = ExpManager.player.Stats.Level.Value ExpManager.expNeeded = math.round(100 * (ExpManager.level / 2)) function ExpManager.updateExpB…
has title: Exp bar Gui not updating
tagged with: lua
score: 1
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/78779863
tagged with: templates
tagged with: lua
has body: 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. I'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'. I will paste the most well worded request I've put below: local p = {} function p.calculateAlchValue(frame) local shop_value_str = frame.args[1] or "" local shop_value = tonumber(shop_value_str) -- Check if the conversion was successful if not shop_value then return "Error: Invalid or missing shop_value. Received: " .. tostring(shop_value_str) end local percentage = 1.3754 local result = math.ceil(shop_value * percentage) return tostring(result) end return 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 When I open the visual editor, I get the actual answer of 1582. But only in the visual editor... If I send the code: It returns the correct value of 1582. The code I'm using on the page: {{Item | Item name = {{PAGENAME}} | Item Image = | tradeable = Yes | stackable = No | examine = It is a(n) {{PAGENAME}}. | shop_value = 1150 | alch_value = {{#invoke:CalcAlchValue|calculateAlchValue|{{{shop_value}}}}} | noteable = Yes }} 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. Links to the fandom pages: https://…
has answer: http://stackoverflow.com/a/78780526
type: AnsweredQuestion
has title: I am attempting to pass an infobox value into a LUA module that outputting an answer based on the infobox value (FANDOM WIKIA)
tagged with: mediawiki-api
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/78780526
tagged with: module
tagged with: wikia
type: Question

http://stackoverflow.com/q/78770057
answer count: 0
type: Question
downvote count: 0
has title: redis lua script can't call on global
tagged with: lua
type: UnansweredQuestion
score: 1
tagged with: redis
upvote count: 1
has body: local function get_cur_time() local current_time = redis.call('TIME')[1] local current_minute_start = math.floor(current_time / 60) * 60 return current_minute_start end -- add below line would failed -- local CURRENT_TIME = get_cur_time() redis.register_function('get_cur_time', get_cur_time) I'd like reuse CURRENT_TIME in many place in my script, but once I added it to global scope, raise error: redis.exceptions.ResponseError: Error registering functions: ERR user_function:6: Script attempted to access nonexistent global variable 'call' Anyway to get around?
favorite count: 0

http://stackoverflow.com/comment/139023337
has text: 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?
comment on: http://stackoverflow.com/q/78852175
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139065551
comment on: http://stackoverflow.com/q/78874062
type: Comment
score: 0
type: QuestionComment
has text: 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`

http://stackoverflow.com/q/78885569
favorite count: 0
has body: 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. Here's my LocalScript, which binds the creation and movement of a Part to a TextButton. local tweenService = game:GetService("TweenService") local runService = game:GetService("RunService") local player = game.Players.LocalPlayer local RunServiceEvent = nil local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut) function SpawnPart() local part = Instance.new("Part") part.Anchored = true part.Parent = game.Workspace.Clutter.Coins local startPos = Vector3.new(0, 2, 0) part.Position = startPos local TargetPosition = Vector3.new(5, 2, 0) local Tween = tweenService:Create(part, tweenInfo, {Position = TargetPosition}) Tween:Play() local StartTime = tick() RunServiceEvent = runService.RenderStepped:Connect(function() local Time = (tick() - StartTime) / tweenInfo.Time if part == nil then return end if Time > 1 then part.Position = TargetPosition return end end) task.spawn(function() Tween.Completed:Wait() task.wait() RunServiceEvent = nil end) end player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("TextButton").Activated:Connect(SpawnPart) To reproduce, create the following structure, then play the game and click the GUI button. ├── StarterGui │ ├── ScreenGui │ │ ├── TextButton ├── StarterPlayer │ ├── StarterPlayerScripts │ │ ├── LocalScript After the Tween finishes, the move tool (or trying to move via script) no longer has any affect on the new part. You can also download this .rbxl file: TestPlace
type: AnsweredQuestion
tagged with: luau
tagged with: tween
has comment: http://stackoverflow.com/comment/139084278
downvote count: 0
has answer: http://stackoverflow.com/a/78885599
accepted answer: http://stackoverflow.com/a/78885599
has comment: http://stackoverflow.com/comment/139090943
has comment: http://stackoverflow.com/comment/139084552
tagged with: roblox
type: Question
tagged with: lua
has title: Part’s position is locked after playing a Tween
upvote count: 2
score: 2
answer count: 1

http://stackoverflow.com/q/78789894
downvote count: 0
answer count: 0
tagged with: lua
type: Question
type: UnansweredQuestion
score: 1
upvote count: 1
has body: 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. This is my code, feel free to read it and torn it apart if you need it. Also, all credits go to catinsurance on yt whose tutorial did this. local mod = RegisterMod("More food!", 1) local clownBurger = Isaac.GetItemIdByName("Clown's Burger!") local clownBurgerDamage = 3 local clownBurgerSpeed = 0.5 local clownBurgerSize = 100 --tried with 2 at first but nothing really changed function mod:EvaluateCacheDmg(player, cacheFlags) if cacheFlags & CacheFlag.CACHE_DAMAGE == CacheFlag.CACHE_DAMAGE then local itemCount = player:GetCollectibleNum(clownBurger) local damageToAdd = clownBurgerDamage * itemCount player.Damage = player.Damage + damageToAdd end end mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, mod.EvaluateCacheDmg) function mod:EvaluateCacheSpd(player, cacheFlags) if cacheFlags & CacheFlag.CACHE_SPEED == CacheFlag.CACHE_SPEED then local itemCount = player:GetCollectibleNum(clownBurger) local speedToDecrease = clownBurgerSpeed * itemCount player.MoveSpeed = player.MoveSpeed - speedToDecrease end end mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, mod.EvaluateCacheSpd) function mod:EvaluateCacheSize(player, cacheFlags) if cacheFlags & CacheFlag.CACHE_SIZE == CacheFlag.CACHE_SIZE then local itemCount = player:GetCollectibleNum(clownBurger) local sizeToAdd = clownBurgerSize * itemCount player.Size = player.Size + sizeToAdd end end mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, mod.EvaluateCacheSize)
favorite count: 0
has title: Need the right flag, im not sure what it is

http://stackoverflow.com/q/78794166
tagged with: luau
answer count: 1
has title: ClickDetector not detecting input
has answer: http://stackoverflow.com/a/78802278
has body: 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? Code: local ts = game:GetService("TweenService") local labdoor = script.Parent.Parent["Laboratory door"] local cframe = labdoor.CFrame local goal = {Position = Vector3.new(484.15, 67.44, 188.125)} local tweeninfo = TweenInfo.new(1) local tween = ts:Create(labdoor, tweeninfo, goal) script.Parent.MouseClick:Connect(function(plr) print(plr.Name, " pressed the button!") tween:Play() end) 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. 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 ClickDetector works on the same door, same everything, I just straight up can copy and paste from 1 experience to other, and it'll work. ClickDetector parent is the part that is the button, and the scripts parent is the ClickDetector.
score: 0
tagged with: roblox
type: Question
tagged with: lua
has comment: http://stackoverflow.com/comment/138930147
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138988670

http://stackoverflow.com/a/78976393
has body: session:getState(); or execute_on_ring execute_on_media execute_on_answer
type: Answer
answers question: http://stackoverflow.com/q/78779955
has comment: http://stackoverflow.com/comment/139328324
score: 0

http://stackoverflow.com/comment/138988674
type: Comment
type: AnswerComment
has text: 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.
score: 0
comment on: http://stackoverflow.com/a/78802278

http://stackoverflow.com/q/78858627
tagged with: luarocks
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/139035008
type: Question
has title: 'luarocks' doesnt find the executable even if i specify
tagged with: lua
downvote count: 1
has body: I've already searched everywhere nothing helped me literally nothing Like, I've never programmed in LUA before, but I'm having trouble installing luarocks on Windows luarocks is not finding the executable, as mentioned in the title Error: Lua 5.4 interpreter not found at C:\Program Files (x86)\Lua\5.1 Please set your Lua interpreter with: luarocks --local config variables.LUA <d:\path\lua.exe> I have already specified the path several times and still nothing I noticed two files were missing, in different directories I wrote them both in --local and normal luarocks config variables.LUA "C:\Program Files (x86)\Lua\5.1\lua.exe" and it appears Wrote variables.LUA = "C:\\Program Files (x86)\\Lua\\5.1\\lua.exe" to C:\Program Files\luarocks\config-5.4.lua same as local Wrote variables.LUA = "C:\\Program Files (x86)\\Lua\\5.1\\lua.exe" to C:\Users\POSITO\AppData\Roaming\luarocks\config-5.4.lua the files luarocks.exe and luarocks admin.exe are in the folder along with the interpreter even with all this, there is still the error Error: Lua 5.4 interpreter not found at C:\Program Files (x86)\Lua\5.1 Please set your Lua interpreter with: luarocks --local config variables.LUA <d:\path\lua.exe> is the same error and yes, i typed luarocks for see and i always see this part Configuration: Lua: Version : 5.4 LUA : (interpreter not found) **************************************** Use the command luarocks config variables.LUA <d:\path\lua.exe> to fix the location **************************************** LUA_INCDIR : (lua.h not found) LUA_LIBDIR : (Lua library itself not found) Configuration files: System : C:\Program Files\luarocks\config-5.4.lua (ok) User : C:\Users\POSITO\AppData\Roaming\luarocks\config-5.4.lua (ok) Rocks trees in use: C:\Users\POSITO\AppData\Roaming\luarocks ("user") 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
upvote count: 0
has answer: http://stackoverflow.com/a/78858720
answer count: 1
type: UnansweredQuestion
favorite count: 0
score: -1

http://stackoverflow.com/comment/139221638
type: Comment
score: 0
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/78896730

http://stackoverflow.com/comment/139233199
type: Comment
score: 0
has text: @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/
type: AnswerComment
comment on: http://stackoverflow.com/a/78922257

http://stackoverflow.com/comment/138982905
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78829658
type: AnswerComment
has text: 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 `.

http://stackoverflow.com/comment/139028868
type: Comment
has text: 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.
score: 0
comment on: http://stackoverflow.com/q/78855024
type: QuestionComment

http://stackoverflow.com/comment/139065536
comment on: http://stackoverflow.com/q/78874062
type: Comment
score: 0
type: QuestionComment
has text: 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.

http://stackoverflow.com/a/78829658
accepted answer of: http://stackoverflow.com/q/78829514
answers question: http://stackoverflow.com/q/78829514
has comment: http://stackoverflow.com/comment/138982628
score: 0
has body: I recommend reading StackOverflow's article on how to produce a Minimal and Reproducible Sample. Regardless, Roblox's documentation on PivotTo 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. 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. for i = 1, finaldiffsubs do local clone = game.Workspace.Noob:Clone() clone.Parent = game.Workspace local ogposition = script.Parent clone:PivotTo( ogposition.PrimaryPart.CFrame * CFrame.new(0, 4 * (i + diffsubs), 0) ) -- You can continue the code you had in the for loop here... end 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 ogposition 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: clone:PivotTo( CFrame.new( ogposition.PrimaryPart.Position + Vector3.new(0, 4 * (i + diffsubs), 0) ) )
has comment: http://stackoverflow.com/comment/138982619
has comment: http://stackoverflow.com/comment/138982613
type: Answer
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/138982663
has comment: http://stackoverflow.com/comment/138982905

http://stackoverflow.com/comment/138995642
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78836411
score: 0
has text: The error means you attempted to get an object that doesn't exist or an attribute that doesn't exist.

http://stackoverflow.com/q/78846295
upvote count: 1
answer count: 1
type: Question
tagged with: httprequest
has answer: http://stackoverflow.com/a/78846539
downvote count: 0
tagged with: lua
accepted answer: http://stackoverflow.com/a/78846539
score: 1
has title: Can I perform a GET request / fetch inside of a neovim plugin?
tagged with: neovim-plugin
tagged with: neovim
favorite count: 0
has body: 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. Ideally I'd like to write something like (psuedo-code INCOMING!): local http = require('http') local json = require('json') local latest = http.request("/url/to/latest/version") print(json.parse(latest)) I've gotten relatively 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 "just work." Any information provided would be extremely helpful! Thanks for your time.
type: AnsweredQuestion

http://stackoverflow.com/comment/139085025
type: QuestionComment
comment on: http://stackoverflow.com/q/78882864
score: 1
type: Comment
has text: 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

http://stackoverflow.com/q/78782966
accepted answer: http://stackoverflow.com/a/78791526
type: Question
tagged with: lua
score: 0
has body: I try to use JSON in Lua - I am completely new to Lua. My code (test.lua) local json = require ("json") print "hello" My install (Debian 12) # luarocks install luajson Installing https://luarocks.org/luajson-1.3.4-1.src.rock luajson 1.3.4-1 depends on lua >= 5.1 (5.1-1 provided by VM) luajson 1.3.4-1 depends on lpeg >= 0.8.1 (1.1.0-1 installed) Do not use 'module' as a build type. Use 'builtin' instead. luajson 1.3.4-1 is now installed in /usr/local (license: MIT/X11) My output after # lua test.lua is this lua: /usr/local/share/lua/5.1/json/decode/util.lua:97: attempt to call field 'version' (a string value) stack traceback: /usr/local/share/lua/5.1/json/decode/util.lua:97: in main chunk [C]: in function 'require' /usr/local/share/lua/5.1/json/decode.lua:12: in main chunk [C]: in function 'require' /usr/local/share/lua/5.1/json.lua:5: in main chunk [C]: in function 'require' awattar.lua:6: in main chunk [C]: ? Whats the problem here?
has title: Lua: How to load/install module json?
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/78791526

http://stackoverflow.com/comment/138985021
type: Comment
has text: 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?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78829791

http://stackoverflow.com/comment/139328324
type: AnswerComment
comment on: http://stackoverflow.com/a/78976393
has text: You can improve your answer by explaining it. Pretend you are a teacher.
type: Comment
score: 0

http://stackoverflow.com/comment/139525531
has text: 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?
type: AnswerComment
comment on: http://stackoverflow.com/a/78842059
type: Comment
score: 0

http://stackoverflow.com/comment/139091444
type: Comment
has text: 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.
score: 3
comment on: http://stackoverflow.com/q/78890100
type: QuestionComment

http://stackoverflow.com/comment/138930147
score: 0
type: QuestionComment
has text: Do you have any errors?
comment on: http://stackoverflow.com/q/78794166
type: Comment

http://stackoverflow.com/q/78774815
has answer: http://stackoverflow.com/a/78775571
has title: Building Visual Studio solution with C and C++
tagged with: c++
score: 1
has comment: http://stackoverflow.com/comment/138887590
upvote count: 1
has body: 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? project"Particles" kind "ConsoleApp" language "C++" targetdir "../build/%{prj.name}/%{cfg.buildcfg}" includedirs { "../include", "../deps/include", "../include/engine", "../deps/include/stb", "../deps/include/imgui", "../deps/include/tests" } conan_config_exec() debugargs { _MAIN_SCRIPT_DIR .. "/examples/data" } files { "../deps/src/**", "../deps/include/**", "../src/**", "../include/**", "../tests/particles_test.cpp", "../assets/**", } filter "files:**.obj" flags { "ExcludeFromBuild" }
answer count: 1
has comment: http://stackoverflow.com/comment/138887553
tagged with: conan
favorite count: 0
tagged with: visual-studio
type: AnsweredQuestion
downvote count: 0
tagged with: http://stackoverflow.com/tag/c
accepted answer: http://stackoverflow.com/a/78775571
tagged with: lua
type: Question

http://stackoverflow.com/a/78866514
answers question: http://stackoverflow.com/q/78863937
downvote count: 0
has body: First of all, beware of premature optimization. If g(f()) calls are relatively infrequent then the difference might be negligible. Next, creating an extra table takes time, so option (1) is always slower than (3). Concerning option (2), it really depends on what g() actually does with the arguments. local args = {...} is an equivalent of option (1), while local x, y, z = ... is the same as (3).
type: Answer
score: 1
upvote count: 1

httprequest
tag name: httprequest
type: Tag
tags question: http://stackoverflow.com/q/78846295

http://stackoverflow.com/comment/138881481
has text: @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.
comment on: http://stackoverflow.com/q/78767348
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/78836907
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/78836865
type: AcceptedAnswer
upvote count: 5
type: Answer
has body: Lua 5.0 introduced the more powerful generic for statement which works over functions and can be used to implement generic iterators. Lua 5.0 kept "for k,v in t" for compatibility but marked it deprecated. As such, it was removed in Lua 5.1. See the section "Incompatibilities with version 4.0" in the Lua 5.0 Reference Manual. In Lua 5.0+, you can use "for k,v in next,t", which is equivalent to "for k,v in pairs(t)".
accepted answer of: http://stackoverflow.com/q/78836865

http://stackoverflow.com/comment/139014578
type: QuestionComment
has text: 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).
comment on: http://stackoverflow.com/q/78845415
type: Comment
score: 0

wikidata-api
type: Tag
tags question: http://stackoverflow.com/q/78827670
tag name: wikidata-api

http://stackoverflow.com/comment/139020078
type: Comment
comment on: http://stackoverflow.com/q/78846464
score: 0
type: QuestionComment
has text: 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

http://stackoverflow.com/a/78903262
has comment: http://stackoverflow.com/comment/139116122
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78894927
answers question: http://stackoverflow.com/q/78894927
score: 1
has body: Turns out that the "%1" 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. local re = require "re" local pattern = re.compile([[ line <- {~ (quoted / 'a'->'' / .)* ~} quoted <- '"' rest rest <- '"' / . rest ]]) Pay attention to operator precedence, because '->' binds tightly ('a' 'b')->''
has comment: http://stackoverflow.com/comment/139116108
type: AcceptedAnswer
type: Answer
upvote count: 1

http://stackoverflow.com/a/78858720
has body: Ok I just unninstalled Lua and Luarocks anyways and worked too. This forum was completely unnecessary to post &gt;:(
answers question: http://stackoverflow.com/q/78858627
has comment: http://stackoverflow.com/comment/139128666
score: 0
type: Answer

http://stackoverflow.com/q/78863482
has answer: http://stackoverflow.com/a/78937804
answer count: 1
type: UnansweredQuestion
has body: Well, I've been reading Luajit ffi's documents for several days and knew how to use it basically. Define symbols(ffi.cdef(xxx)), then load libraries(a = ffi.load(xxx)), and simply call them(a.xxx(...)). All amazed e a lot. But there's one thing confusing me is that ffi.cdef is a "static"(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. Let's show an example. Tow C source files a.c and b.c In a.c: void func(int p1){} In b.c: void func(int p1, int p2){} Build them separately to liba.so and libb.so In lua: ffi.cdef "void func(int)" local lib = ffi.load("a") lib.func(1) -- Succeeded ffi.cdef "void func(int,int)" lib = ffi.load("b") lib.func(1,2) -- Failed: wrong number of arguments for function call I tried to set lib = nil and call collectgargarbage("collect") before loading libb.so because I read Luajit keeps caches of every symbols with its parameters and return type, until it has no reference. But failed... And many other tries also didn't work. Help!
tagged with: lua
tagged with: ffi
has title: Can undefine a symbol defined by ffi.cdef in Luajit?
score: 0
type: Question
has comment: http://stackoverflow.com/comment/139187588
tagged with: luajit

http://stackoverflow.com/comment/139228419
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78882803
score: 0
type: QuestionComment

orthanc-server
type: Tag
tags question: http://stackoverflow.com/q/78804245
tag name: orthanc-server

http://stackoverflow.com/comment/138884855
type: QuestionComment
has text: 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`?
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78766168

http://stackoverflow.com/comment/138915740
score: 0
comment on: http://stackoverflow.com/a/78787925
has text: Oh my god, you’re such an angel! That's really the reason—it’s working great now!!!
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/139128461
type: QuestionComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/78881717
score: 0

http://stackoverflow.com/comment/138910051
has text: You can even reproduce it with a simple CSV like this: a,b,c 1,2,3 4,5,6 7,8,9 !!!
comment on: http://stackoverflow.com/q/78787625
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139049034
type: QuestionComment
comment on: http://stackoverflow.com/q/78866660
type: Comment
score: 1
has text: 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.

http://stackoverflow.com/comment/138995682
type: AnswerComment
has text: @CarlosAranas yea u need a local script
score: 1
type: Comment
comment on: http://stackoverflow.com/a/78836162

http://stackoverflow.com/comment/139021691
type: Comment
has text: 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
comment on: http://stackoverflow.com/q/78846464
type: QuestionComment
score: 0

conan
type: Tag
tag name: conan
tags question: http://stackoverflow.com/q/78774815

channel
tag name: channel
tags question: http://stackoverflow.com/q/78779955
type: Tag

http://stackoverflow.com/comment/139001827
comment on: http://stackoverflow.com/a/78837343
has text: Thank you SO MUCH for responding, this is the only error I've had the entire time ;-;
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/78791526
accepted answer of: http://stackoverflow.com/q/78782966
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/78782966
has comment: http://stackoverflow.com/comment/138916594
type: AcceptedAnswer
type: Answer
has body: There was a bug in luajson, that was fixed in the source code at GitHub but not in the luarocks package. Installing from GitHub (e.g., 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 or using sparse checkout) may help.
has comment: http://stackoverflow.com/comment/138916677
downvote count: 0

http://stackoverflow.com/a/78842059
has comment: http://stackoverflow.com/comment/139525531
has comment: http://stackoverflow.com/comment/139525691
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/78839677
has body: 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, struct foo bar(...); is almost the same as struct foo* bar(struct foo*, ...); Or, from ffi's POV, local foo = bar(...) is equivalent to local foo = ffi.new(...); bar(foo, ...). So no extra precautions needed.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/78839677

templates
tag name: templates
type: Tag
tags question: http://stackoverflow.com/q/78779863
tags question: http://stackoverflow.com/q/79190029

http://stackoverflow.com/q/78829791
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/138985021
score: 0
tagged with: lua
tagged with: roblox
type: Question
answer count: 0
has body: local UIS = game:GetService('UserInputService') local Player = game.Players.LocalPlayer local Character = Player.Character UIS.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A then Character.Humanoid.WalkSpeed = 22 --run speed local Anim = Instance.new('Animation') Anim.AnimationId = 'rbxassetid://18686242456' PlayAnim = Character.Humanoid:LoadAnimation(Anim) PlayAnim:Play() end end) UIS.InputEnded:connect(function(input) if input.KeyCode == Enum.KeyCode.W or input.KeyCode == Enum.KeyCode.A then Character.Humanoid.WalkSpeed = 16 --default walk speed PlayAnim:Stop() end end) I'm not sure how to fix this.
has title: Pressing "W" or "A" makes me run but pressing both stops the animation

http://stackoverflow.com/q/78746601
tagged with: lua
has answer: http://stackoverflow.com/a/78758468
has title: How can I run the Wikipedia Module Yesno.lua from the lua cli?
answer count: 1
type: UnansweredQuestion
score: 0
tagged with: command-line-interface
has body: Wikipedia has lua modules. One of them is the Yesno module. Its Yesno.lua file has these contents. return function (val, default) -- If your wiki uses non-ascii characters for any of "yes", "no", etc., you -- should replace "val:lower()" with "mw.ustring.lower(val)" in the -- following line. val = type(val) == 'string' and val:lower() or val if val == nil then return nil elseif val == true or val == 'yes' or val == 'y' or val == 'true' or val == 't' or val == 'on' or tonumber(val) == 1 then return true elseif val == false or val == 'no' or val == 'n' or val == 'false' or val == 'f' or val == 'off' or tonumber(val) == 0 then return false else return default end From the lua cli prompt, I would like to load that function definition and execute it.
type: Question

http://stackoverflow.com/a/78792799
type: Answer
has body: You can set the keyword to the door: door.Keyword = "sesame" And than just check it: if (msg == door.Keyword) then -- open the door for 4 seconds See also: https://stackoverflow.com/a/10158547/12968803
answers question: http://stackoverflow.com/q/78791003
score: 0

biomejs
tags question: http://stackoverflow.com/q/78765047
type: Tag
tag name: biomejs

http://stackoverflow.com/a/78802278
has body: 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 PlayerGui or PlayerScripts, which can be done through parenting them to StarterPlayeScripts or StarterGui. 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. Note: Having doors open on the server is still bad, and in the ideal case, you would want to register the MouseClick 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. Anyway, your script accesses the click detector through script.Parent, 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. 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.
score: 0
answers question: http://stackoverflow.com/q/78794166
type: Answer
has comment: http://stackoverflow.com/comment/138988674

hashtable
type: Tag
tags question: http://stackoverflow.com/q/78765913
tag name: hashtable

http://stackoverflow.com/q/78791003
tagged with: lua
has answer: http://stackoverflow.com/a/78792799
favorite count: 0
linked to: http://stackoverflow.com/q/10158450
type: Question
upvote count: 1
has body: I got this script door = script.Parent function onChatted(msg, recipient, speaker) source = string.lower(speaker.Name) msg = string.lower(msg) -- thecharacter = script.Parent.TheCharacter if (msg == string.match(File.name)) then door.CanCollide = false door.Transparency = 0.7 wait(4) door.CanCollide = true door.Transparency = 0 end end game.Players.ChildAdded:connect(function(plr) plr.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, plr) end) end) Is it possible to match the user msg with an image name instead of a character? I m new to lua and can t seem to find anything about this.
type: UnansweredQuestion
tagged with: image
score: 1
answer count: 2
has answer: http://stackoverflow.com/a/78791747
downvote count: 0
has title: Is it possible to Lua match string with an image name?

http://stackoverflow.com/comment/138878665
comment on: http://stackoverflow.com/q/78766168
type: QuestionComment
score: 1
has text: `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`
type: Comment

http://stackoverflow.com/comment/139013349
type: Comment
has text: 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?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78845415

http://stackoverflow.com/comment/139042362
score: 0
type: QuestionComment
has text: @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.
comment on: http://stackoverflow.com/q/78860683
type: Comment

http://stackoverflow.com/comment/138994193
type: AnswerComment
has text: @histrueandfalse's comment applies here, too - everything after `main_menu.Enabled = false` is redundant. But that's not particularly important for this post.
score: 1
type: Comment
comment on: http://stackoverflow.com/a/78836162

http://stackoverflow.com/comment/139092499
comment on: http://stackoverflow.com/q/78890100
score: 0
type: QuestionComment
has text: 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, ...
type: Comment

http://stackoverflow.com/comment/139021650
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78846464

http://stackoverflow.com/comment/139099363
has text: Thanks! That clarifies what I was wondering about, thank you for explaining!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/78890243

http://stackoverflow.com/comment/139013262
has text: How did you go about installing Neovim? If it was installed via some package manager, which one and with which command?
type: Comment
comment on: http://stackoverflow.com/q/78845415
score: 0
type: QuestionComment

http://stackoverflow.com/a/78937804
upvote count: 1
has body: At the time of writing this, LuaJIT's ffi.cdef ignores redeclarations. Source: https://github.com/LuaJIT/LuaJIT/issues/28.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/78863482
score: 1

http://stackoverflow.com/q/78827670
answer count: 1
tagged with: wikibase
tagged with: wikidata-api
type: Question
upvote count: 1
tagged with: lua
has answer: http://stackoverflow.com/a/78827939
score: 1
tagged with: mediawiki
tagged with: wikipedia
accepted answer: http://stackoverflow.com/a/78827939
has body: I have imported to my Miraheze site the Módulo:Ficha from the Spanish Wikipedia but I get this error: Lua error on line 567: attempt to index field 'wikibase' (a nil value). Reverse trace: Module:File:567: in the "makeWikidataBar" function Module:File:638: ? (tail call): ? mw.lua:527: ? [C]: ? In line 567 I have this code: (Spanish)=local function hacerBarraWikidata(nule)-- Crea en la parte inferior un enlace al ítem de Wikidata (English)=local function makeWikidataBar(nule)-- Creates a link to the Wikidata item at the bottom In line 638 I have this code: (Spanish)=hacerBarraWikidata() (English)=makeWikidataBar() 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.
downvote count: 0
favorite count: 0
has title: I have a Script error in Miraheze, I want to try to index the field 'wikibase' (a null value)
type: AnsweredQuestion

http://stackoverflow.com/q/78881717
answer count: 1
has title: Lua table.insert refuses to work unless the expression given as second arg is saved to a var first
type: Question
upvote count: 1
linked to: http://stackoverflow.com/q/74916455
has answer: http://stackoverflow.com/a/78881805
has comment: http://stackoverflow.com/comment/139128461
tagged with: lua
downvote count: 0
has body: Observe the behavior from the repl: ❯ lua Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio &gt; tab={}; str='a'; z=str:gsub('a', 'b'); table.insert(tab, z); print(tab[1]) b &gt; tab={}; str='a'; table.insert(tab, str:gsub('a', 'b')); print(tab[1]) stdin:1: bad argument #2 to 'insert' (number expected, got string) stack traceback: [C]: in function 'table.insert' stdin:1: in main chunk [C]: in ? &gt;
type: UnansweredQuestion
score: 1
favorite count: 0

http://stackoverflow.com/a/78907314
accepted answer of: http://stackoverflow.com/q/78888787
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78888787
has body: This has done it for me. function files_inside_directory() local cmd = ":e <C-R>=expand('%:h')<CR>/" local termcode = vim.api.nvim_replace_termcodes(cmd, true, false, true) vim.api.nvim_feedkeys(termcode, 'n', false) vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<C-z>", true, false, true), 'n', false) end vim.api.nvim_set_keymap('n', '<leader>e', ':lua files_inside_directory()<CR>', {noremap = true, silent = true, desc="Open popupmenu inside file directory."}) Since <Tab> only inserts a ^I character, this is a slight workaround to trigger the popupmenu.

http://stackoverflow.com/comment/139015337
has text: @KyleF.Hartzenberg, so how is it possible that lua is still correctly parsed when I don't include `require("lazy").setup("my.plugins")`?
type: Comment
comment on: http://stackoverflow.com/q/78845415
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139030116
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78855024
has text: Does this work?

http://stackoverflow.com/q/78891008
type: Question
has answer: http://stackoverflow.com/a/78891135
tagged with: lua
tagged with: roblox
has title: How can I "ApplyDescription()" locally?
has answer: http://stackoverflow.com/a/78899797
answer count: 2
has body: 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 ApplyDescription() 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? TLDR: How can I make a Dummy in Workspace look like each player's character only for themselves in Roblox Studio? Here is the LocalScript I tried to use from StarterPlayerScripts: local players = game:GetService("Players") local rig = workspace:WaitForChild("Rig") local humanoid = rig:WaitForChild("Humanoid") task.wait(10) local desc = players:GetHumanoidDescriptionFromUserId(game.Players.LocalPlayer.UserId) humanoid:ApplyDescription(desc) I was expecting it to work without any problem. After the wait, the script should work, right? No, of course not. ApplyDescription() can only be called by the backend server.
possible better answer: http://stackoverflow.com/a/78891135
score: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/78899797

http://stackoverflow.com/comment/138945625
comment on: http://stackoverflow.com/q/78766168
score: 0
type: QuestionComment
has text: 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).
type: Comment

http://stackoverflow.com/comment/139099373
type: Comment
comment on: http://stackoverflow.com/q/78890100
score: 0
type: QuestionComment
has text: 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.

http://stackoverflow.com/comment/138999657
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/78839148
score: 0
has text: for my case, it seems that it is caused by some setting inside the Lua extension (by sumneko)

http://stackoverflow.com/comment/138980934
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78828662
has text: @romainl Integer division. E.g. `10 // 3` results in 3, and `11 // 2` results in 5.
type: Comment

http://stackoverflow.com/a/78769472
type: Answer
has body: 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 :)
answers question: http://stackoverflow.com/q/78758535
score: 0

http://stackoverflow.com/comment/139092789
has text: You should follow the examples on the wiki: https://www.love2d.org/wiki/love.keypressed
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78889559
type: QuestionComment

http://stackoverflow.com/comment/138995351
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78836162
has text: 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.

http://stackoverflow.com/a/78780526
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78779863
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78779863
has body: 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 Chrysopoeia Value {{#invoke:CalcAlchValue|calculateAlchValue|{{{shop_value}}}}} Doing it inside the Template:Item itself, magically fixed the issue. Gotta love AI not knowing how to do stuff all the way ^^
score: 1
upvote count: 1

http://stackoverflow.com/comment/138988670
type: Comment
comment on: http://stackoverflow.com/q/78794166
has text: No, there is no Output from the door whatsoever.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/138972530
type: QuestionComment
has text: this is not a debugging service, narrow down your problem. There is no need to bother us with > 200 lines of code.
type: Comment
comment on: http://stackoverflow.com/q/78822833
score: 2

http://stackoverflow.com/a/78808861
has body: LocalScripts execute on each individual client, and objects created in LocalScripts are not replicated to other players. 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. 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. That way, every player will be able to see and interact with each other's prompts : -- get services local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") -- find the RemoteEvent in ReplicatedStorage local CharacterProximityPromptActivated : RemoteEvent = ReplicatedStorage.CharacterProximityPromptActivated -- when a player joins the game, create the proximity prompt in the player's torso Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) -- check if they have an R6 or R15 character model local torso = character.Torso if not torso then torso = character.UpperTorso end local prompt : ProximityPrompt = Instance.new("ProximityPrompt", torso) prompt.Triggered:Connect(function(activator) -- tell the player that activated the prompt to do something... CharacterProximityPromptActivated:FireClient(activator, player) end) end) end) Then, in your LocalScript, listen for when the RemoteEvent tells you that you've activated a ProximityPrompt : local GuiService = game:GetService("GuiService") local ReplicatedStorage = game:GetService("ReplicatedStorage") -- find the RemoteEvent in ReplicatedStorage local CharacterProximityPromptActivated : RemoteEvent = ReplicatedStorage.CharacterProximityPromptActivated CharacterProximityPromptActivated.OnClientEve…
type: Answer
downvote count: 0
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/78808593

backend
tags question: http://stackoverflow.com/q/78804245
tag name: backend
type: Tag

http://stackoverflow.com/q/78894422
tagged with: lua
type: UnansweredQuestion
tagged with: keyboard-events
tagged with: key-bindings
tagged with: macros
tagged with: logitech
has body: I want to create simple lua script in Logitech G Hub for quick looking behind in the game. I manage to make it work using mouse button to trigger it: --Script -> MMB - look back EnablePrimaryMouseButtonEvents(true) function OnEvent(event, arg) if (event == "MOUSE_BUTTON_PRESSED" and arg == 3) then PressKey("lctrl") for i = 0, 96 do MoveMouseRelative (-25,0) Sleep (1) end elseif (event == "MOUSE_BUTTON_RELEASED" and arg == 3) then ReleaseKey("lctrl") end end 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. However, I would like to change triggering of that script to use for it only modifier lctrl without pressing mmiddle mouse button. I'm trying different configurations with IsModifierPressed("lshift") 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 ;)
answer count: 0
score: 0
has title: Trigger a Lua script when pressing a modifier on a keyboard in Logitech G Hub
type: Question

http://stackoverflow.com/a/78865143
type: AcceptedAnswer
type: Answer
has body: Lua filters support filtering on Inline, Block, Meta, and Pandoc elements. Thus this should work: return {{ Block = action, Inline = action, Meta = action, Pandoc = action, }} The docs could probably be a little clearer on that point.
upvote count: 1
score: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78858251
answers question: http://stackoverflow.com/q/78858251

project
type: Tag
tags question: http://stackoverflow.com/q/78766168
tag name: project

http://stackoverflow.com/comment/139048833
type: Comment
type: QuestionComment
score: 0
has text: 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. I tried various other codes, but none of them worked.
comment on: http://stackoverflow.com/q/78866660

http://stackoverflow.com/a/78745513
accepted answer of: http://stackoverflow.com/q/78745464
answers question: http://stackoverflow.com/q/78745464
has body: 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 "StarterCharacter" instead of "NewSkinModel". This is because when Roblox chooses a character model, it doesn't just choose the first Model that contains a Humanoid object. It specifically looks for one named "StarterCharacter", ignoring anything that doesn't have that name. If you rename your model and drag it back into StarterPlayer, your game should work as expected.
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/78779955
has body: Using Freeswitch, I am desperately trying to get the channel Call State value in Lua. The Lua script is executed by posting an HTTP request to Verto.. This is the Lua code I have, so far: api = freeswitch.API() uuid = api:executeString("create_uuid") [... some blablabla code....] dialstr = "{uuid=" ... uuid ...",caller_id_number=" ... callerId ... " ....." and so on ret = api:execute("originate", dialstr) con = freeswitch.EventComsumer("all") check = true while check do event = con:pop(1) event_name = event:getHeader("Event-Name") print(event_name) event_state = event:getHeader("Channel-Call-State") print(event_state) end -- end while The above lines will fail when printing event_state because event_state is nil, but event_name will correctly show up. Changing to: event_state = api:execute_string("eval uuid:" .. uuid .. " ${Channel-Call-State}" Will always return early! 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).
answer count: 1
tagged with: channel
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/78976393
has title: Freeswitch Lua API - how to get Channel State?
tagged with: freeswitch
score: 0
type: Question
tagged with: lua

http://stackoverflow.com/comment/138982628
comment on: http://stackoverflow.com/a/78829658
type: Comment
has text: 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.
score: 0
type: AnswerComment

http://stackoverflow.com/a/79011154
type: Answer
answers question: http://stackoverflow.com/q/78778829
has body: For those interested, I was able to resolve the issue by 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.
score: 0

http://stackoverflow.com/comment/138907639
comment on: http://stackoverflow.com/a/78781505
type: AnswerComment
type: Comment
score: 1
has text: @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

http://stackoverflow.com/comment/138931802
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78800396
has text: Are the things you're adding to the backpack `Tool` objects?

http://stackoverflow.com/q/78889559
has answer: http://stackoverflow.com/a/78895181
score: 0
has comment: http://stackoverflow.com/comment/139092646
type: Question
has body: 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. I want my function to detect only once so I can make my dash.enter image description here function love.load() player = {} player.x = 400 player.y = 500 player.speedY = 3 player.speedX = 4 player.sprite = love.graphics.newImage('sprites/Spaceship.PNG') player.lives = 5 player.points = 0 background = love.graphics.newImage('sprites/SpaceBackground.png') asteroid = {} asteroid.x = {200, 460, 630} asteroid.y = {0, 0, 0} asteroid.speedY = 4 asteroid.sprite = love.graphics.newImage('sprites/Asteroid.png') asteroid.number = 3 asteroid.missed = 1 bullet = {} bullet.x = {} bullet.y = {} bullet.speed = 11 bullet.sprite = love.graphics.newImage('sprites/bullet.png') bullet.number = 0 heart = {} heart.x = {200} heart.y = {-200} heart.speed = 4 heart.sprite = love.graphics.newImage('sprites/Heart.png') heart.number = 1 whenIshotLast = 0 updates = 0 updates2 = 0 updates3 = 0 didAnewAsteroidSpawnSoon = 0 updatesFromLastDashF = 0 didWePressF = 0 end function areColliding(x1, y1, sx1, sy1, x2, y2, sx2, sy2) if x2 <= x1 + sx1 and x1 <= x2 + sx2 and y2 <= y1 + sy1 and y1 <= y2 + sy2 then return true else return false end end function love.update(dt) if(player.lives > 0) then updates = updates + 1 updates2 = updates2 + 1 updates3 = updates3 + 1 if updates3 > 200 then player.points = player.points + 1 updates3 = 0 end if(didWePressF == 1) then updatesFromLastDashF = updatesFromLastDashF + 1 end -- Player movement controls if love.keyboard.isDown("right") or love.keyboard.isDown("d") then player.x = player.x + player.speedX end if love.keyboard.isDown("left") or love.keyboard.isDown("a") then player.x = player.x - player.speedX end if love.keyboard.isDown("down") or love.keyboard.isDown("s") then player.y = player.y + player.speedY end if love.keyboard.isDown("up") or love.keyboard.isDown("w") then player.y = player.y - player.speedY end if(love.keypressed("up", f…
has title: 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
tagged with: lua
has comment: http://stackoverflow.com/comment/139092789
has comment: http://stackoverflow.com/comment/139091015
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/78781505
has comment: http://stackoverflow.com/comment/138907639
has body: Module script change that fixed the problem: function ExpManager.updateExpBar() ExpManager.exp = ExpManager.player.Stats.expPoints.Value ExpManager.level = ExpManager.player.Stats.Level.Value ExpManager.expNeeded = math.round(100 * (ExpManager.level / 2)) ExpManager.expGui.expBackground.expBar:TweenSize(UDim2.new(ExpManager.exp / ExpManager.expNeeded, 0, 1, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Sine, 0.15, true) ExpManager.expText.Text = math.round(ExpManager.exp).. &quot;/&quot; .. math.round(ExpManager.expNeeded) end 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.
answers question: http://stackoverflow.com/q/78781305
has comment: http://stackoverflow.com/comment/138907373
accepted answer of: http://stackoverflow.com/q/78781305
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/138902571
has text: _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.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/78783308

http://stackoverflow.com/a/78829370
answers question: http://stackoverflow.com/q/78828816
has body: 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. The Roblox documentation has articles on Remote Events and Callbacks and on Data Stores. Here is some code that I wrote up that handles saving and retrieving data from data-stores through a remote event called GetTheme and a remote function called UpdateTheme, both of which are inside ReplicatedStorage. The script itself should be in ServerScriptService as a server-sided script. local THEME_DATASTORE_NAME = "Themes" local DataStoreService = game:GetService("DataStoreService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local themeDataStore = DataStoreService:GetDataStore(THEME_DATASTORE_NAME) local getThemeRemoteEvent = ReplicatedStorage.GetTheme local updateThemeRemoteFunction = ReplicatedStorage.UpdateTheme -- We want to return true if this was successful, and false if it was not, -- so that the client can display an appropriate error to the user. updateThemeRemoteFunction.OnServerInvoke = function(player, theme) if theme == "default" or theme == "green" then local wasSuccess, result = pcall(function() themeDataStore:SetAsync(player.UserId, theme) end) if not wasSuccess then print("Unable to save data to data-store: " .. result) end return wasSuccess end return false end getThemeRemoteEvent.OnServerEvent:Connect(function(player) -- Retrieve the theme that the user saved return themeDataStore:GetAsync(player.UserId) or "default" end) 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 ma…
score: 0
type: Answer

case-insensitive
tags question: http://stackoverflow.com/q/78767348
tag name: case-insensitive
type: Tag

wikibase
type: Tag
tags question: http://stackoverflow.com/q/78827670
tag name: wikibase

http://stackoverflow.com/a/78855512
answers question: http://stackoverflow.com/q/78845415
type: Answer
downvote count: 0
has body: Neovim doesn't like it when it can't access language parsers for a few languages. According to the docs, lazy.nvim "resets the runtime path to $VIMRUNTIME and your config directory". 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 nvim-treesitter plugin. Here is how I do it: local opts = { ensure_installed = { 'c', 'lua', 'vim', 'vimdoc', 'query', 'markdown', 'markdown_inline', }, } local function config() require('nvim-treesitter.configs').setup(opts) end return { 'nvim-treesitter/nvim-treesitter', config = config, build = ':TSUpdate', }
score: 1
upvote count: 1

http://stackoverflow.com/comment/138999692
score: 0
type: Comment
has text: 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
type: QuestionComment
comment on: http://stackoverflow.com/q/78839148

http://stackoverflow.com/a/78885599
upvote count: 2
answers question: http://stackoverflow.com/q/78885569
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: The problem is in the work you're doing with RunServiceEvent. It seems like you're trying to make sure the part is at its target position once the Tween is over, then deleting the RenderStepped. Unfortunately, RunServiceEvent = nil won't delete it for you - it unbinds the object from that name, but it doesn't delete the object from memory. This means that after one second, your script will constantly move the part to your target position, effectively locking it in place. The good news is, you don't need that bit at all! Your Script works fine if you just remove that bit entirely: local tweenService = game:GetService("TweenService") local runService = game:GetService("RunService") local player = game.Players.LocalPlayer local RunServiceEvent = nil local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut) function SpawnPart() local part = Instance.new("Part") part.Anchored = true part.Parent = game.Workspace.Clutter.Coins local startPos = Vector3.new(0, 2, 0) part.Position = startPos local TargetPosition = Vector3.new(5, 2, 0) local Tween = tweenService:Create(part, tweenInfo, {Position = TargetPosition}) Tween:Play() end player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("TextButton").Activated:Connect(SpawnPart) 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 task.delay: local tweenService = game:GetService("TweenService") local runService = game:GetService("RunService") local player = game.Players.LocalPlayer local RunServiceEvent = nil local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut) function SpawnPart() local part = Instance.new("Part") part.Anchored = true part.Parent = game.Workspace.Clutter.Coins local startPos = Vector3.new(0, 2, 0) part.Position = startPos local TargetPosition = Vector3.new(5, 2, 0) local Tween = tweenService:Create(part, tweenInfo, {Position = TargetPosition}) Twee…
score: 2
accepted answer of: http://stackoverflow.com/q/78885569

http://stackoverflow.com/comment/139035008
has text: i will try unninstall and install it again
score: 0
comment on: http://stackoverflow.com/q/78858627
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/139092990
type: Comment
comment on: http://stackoverflow.com/a/78890243
score: 0
type: AnswerComment
has text: your clone function does not "clone" the table. it completely ignores a possible metatable.

http://stackoverflow.com/comment/138989572
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78832294
has text: 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.
type: Comment

format
tag name: format
type: Tag
tags question: http://stackoverflow.com/q/78783308

visual-studio
tag name: visual-studio
type: Tag
tags question: http://stackoverflow.com/q/78774815

http://stackoverflow.com/comment/139012789
type: QuestionComment
has text: @KyleF.Hartzenberg, yes I've done that now.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78845415

http://stackoverflow.com/comment/138982619
has text: 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.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78829658
type: Comment

http://stackoverflow.com/comment/139013607
has text: @KyleF.Hartzenberg, by the way, how did you learn about checkhealth? I never seem to be able to find useful things like that.
type: Comment
comment on: http://stackoverflow.com/q/78845415
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139099719
has text: ^ just noticed I wrote file.open instead of io.open but its the same point anyway. Just use io.lines with the path
type: QuestionComment
comment on: http://stackoverflow.com/q/78882864
score: 2
type: Comment

http://stackoverflow.com/a/78791618
answers question: http://stackoverflow.com/q/78791470
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78791470
has body: I managed to workaround the issue by using the rawget global. Here's how I assigned the variables I needed: local expType = tostring(xpType) local expTypeStat = expType:gsub("Exp", "") local profileDataExpType = rawget(profile.Data, expTypeStat) local profileDataExp = rawget(profile.Data, expType) rawget gets the value of the profile.Data table and returns the value of the index you give it, in this case expTypeStat and expType. If you then want to change the value, you can use the rawset global. Here's an example: rawset(profile.Data, expType, (0 + leftoverExp))
score: 0

http://stackoverflow.com/a/78886093
type: Answer
downvote count: 0
has body: 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. 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. So you can do something like this. local model : Model = script.Parent wait(5.0) -- remove the anchors and welds holding the thing together local children = model:GetDescendants() for i, child in ipairs(children) do if child:IsA("Weld") then child:Destroy() elseif child:IsA("BasePart") then child.Anchored = false end end -- if your building needs a little... convincing to fall apart... local force = Instance.new("Explosion") force.BlastRadius = model:GetExtentsSize().Magnitude force.Position = model:GetPivot().Position force.TimeScale = 1 force.Visible = false force.ExplosionType = Enum.ExplosionType.NoCraters force.Parent = model
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/78884405

http://stackoverflow.com/comment/139043443
has text: You just need `gdb -c ./core.13456 /usr/bin/luajit`
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78860683
type: QuestionComment

inheritance
tag name: inheritance
tags question: http://stackoverflow.com/q/78767348
type: Tag
tags question: http://stackoverflow.com/q/79234692

http://stackoverflow.com/a/78783951
score: 5
accepted answer of: http://stackoverflow.com/q/78783308
answers question: http://stackoverflow.com/q/78783308
downvote count: 0
has body: 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 string to be in scope. If myWord 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. As for the nitty-gritty details: string.format(myWord, "World") looks string up in _ENV (typically _G, the global table), then accesses the format field of that, then calls that with myWord and "World" as arguments. myWord:format("World") indexes myWord, then it accesses the format field and calls that with arguments myWord, "World". If myWord is a string, indexing myWord will hit the metatable, which has the string table set as __index, unless someone did getmetatable"".__index = {} or similar tampering with the string metatable. (An oversight that happens sometimes in Lua sandboxes is to forget to make the string metatable inaccessible.) Perhaps the most relevant subtle difference in behavior is that string.func(s, ...) will coerce s to a string if it is a number, whereas s:func(...) will throw an "attempt to index a number value". This may be relevant if you're maintaining a legacy Lua API and "refactoring" it to use the latter style, accidentally breaking the code of API users who relied on the implicit number to string coercion. Another maybe-relevant difference is that s:func(...) would let you supply a table s with a metatable set such that s:func(...) does something sensible: It plays better with polymorphism. For example you could have a GraphemeString "class" which supports (its own version of) s:sub, but operates on graphemes rather than bytes. If you're using the "OOP" style, you could easily swap one for the other. (If you're using the "imperative" style, you could still monkey-patch string.format etc., but that would be messy.)
type: AcceptedAnswer
type: Answer
upvote count: 5

runtime-error
type: Tag
tags question: http://stackoverflow.com/q/78858627
tag name: runtime-error

http://stackoverflow.com/comment/138916677
type: Comment
score: 0
type: AnswerComment
has text: So I did not test your suggestion but it sounds legit.
comment on: http://stackoverflow.com/a/78791526

http://stackoverflow.com/a/78896853
has body: One boring solution would be n = 1 --1; """ print((n % 2 == 0 and "Even" or "Odd") .. " in Lua") --1; """ --1; print(("Even" if n % 2 == 0 else "Odd") + " in Python") --1; is a safe comment for Lua, and within Python it was easier to "disable" Lua code by wrapping it into a multi line string. But I feel like this question belongs into https://codegolf.stackexchange.com/
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78866660

http://stackoverflow.com/q/78882803
answer count: 1
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/78922257
has comment: http://stackoverflow.com/comment/139079006
tagged with: luau
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/139079782
tagged with: roblox
has title: How to go about making hitboxes in Roblox
has body: Lately, I had been trying to figure out how to make a decent hitbox system for my game. My inspiration is "Item Asylum". 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. Or, do I just make it move with the character (which will probably a worse decision since exploiters can use that to their advantage.)
has comment: http://stackoverflow.com/comment/139228419

http://stackoverflow.com/comment/138989459
type: Comment
score: 0
has text: what is your actual question? add a [mcve]
type: QuestionComment
comment on: http://stackoverflow.com/q/78831240

http://stackoverflow.com/q/78850469
answer count: 1
has answer: http://stackoverflow.com/a/78851335
type: AnsweredQuestion
has title: why is part:GetTouchingParts() returning parts when no parts are touching
tagged with: game-development
score: 0
tagged with: roblox
has body: I was trying to debug this code local bird = script.Parent bird.Anchored = true local uis = game.UserInputService local player = game.Players.LocalPlayer local gravity = -1 local Parts = bird:GetTouchingParts() local bird_flap = bird.Position + Vector3.new(0, 10, 0) local script_start = false uis.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then script_start = true end if script_start then while not Parts do task.wait(0.5) gravity = gravity * 2 uis.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then bird.Position = bird_flap gravity = -1 end end) bird.Position = bird.Position + Vector3.new(0, gravity, 0) task.wait(0.1) end end end) so i tried putting another script in the bird to try to see if something was wrong and tried this code: local bird = script.Parent local parts = bird:GetTouchingParts() if not parts then print("no parts") else print("parts touching") end it returned with parts touching even though the bird was visibly floating not touching anything
type: Question
tagged with: lua
accepted answer: http://stackoverflow.com/a/78851335

http://stackoverflow.com/a/78951550
type: Answer
has body: There is now a new Lua library that allows to do this: jog is a Lua-only reimplementation of pandoc's walk method. It is conceptually similar to panflute and such libraries, but also tries to stay close and mostly compatible with walk. Jog allows to enable element contexts, which is then passed in as a second function argument: --- show level local jog = require 'jog' --- Return the tag (e.g., `Str`) or type (e.g. `Meta`) of an element. local function tag_or_type (x) return x.t or pandoc.utils.type(x) end local function print_context(element, context) print(table.concat(context:map(tag_or_type), '-&gt;')) end local show_level_filter = { context = true, -- enable element contexts List = print_context, Inline = print_context, Block = print_context, Meta = print_context, Para = print_context, } function Pandoc(doc) return jog(doc, show_level_filter) end
answers question: http://stackoverflow.com/q/78874062
score: 0

http://stackoverflow.com/comment/139078365
has text: I figured it out while I was preparing for bed. Yeah, it's two return values. Damn Lua, this feature is kinda naughty.
comment on: http://stackoverflow.com/a/78881805
score: 1
type: Comment
type: AnswerComment

lua-4.0
tag name: lua-4.0
tags question: http://stackoverflow.com/q/78836865
type: Tag

http://stackoverflow.com/comment/139083420
type: Comment
score: 0
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/78778829

http://stackoverflow.com/comment/138916594
comment on: http://stackoverflow.com/a/78791526
type: AnswerComment
score: 0
has text: I changed from Lua5.1 to Lua5.4 and is did work there out of the box.
type: Comment

http://stackoverflow.com/comment/139187588
type: QuestionComment
comment on: http://stackoverflow.com/q/78863482
score: 0
has text: 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.
type: Comment

http://stackoverflow.com/comment/138977899
type: QuestionComment
has text: I did not realize python let you do an assignment inside of a if condition, but no lua does not allow that.
type: Comment
comment on: http://stackoverflow.com/q/78826881
score: 0

http://stackoverflow.com/comment/138996492
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78836411

clone
tag name: clone
tags question: http://stackoverflow.com/q/78800396
type: Tag

http://stackoverflow.com/comment/139090943
type: QuestionComment
has text: 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
comment on: http://stackoverflow.com/q/78885569
type: Comment
score: 0

http://stackoverflow.com/comment/139079006
type: QuestionComment
has text: 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].
comment on: http://stackoverflow.com/q/78882803
type: Comment
score: 0

http://stackoverflow.com/comment/139015491
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78846464
score: 0
type: QuestionComment

http://stackoverflow.com/a/79016460
has body: 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: local button = script.Parent local main_menu = script.Parent.Parent.Parent.Parent local main_menu_frame = script.Parent.Parent.Parent main_menu.Enabled = true game.Lighting.Blur.Enabled = true button.Clicked:Connect(function() --Insert code when the button is clicked here end)
answers question: http://stackoverflow.com/q/78832294
score: 0
type: Answer

http://stackoverflow.com/comment/138887590
score: 0
type: QuestionComment
has text: that's probably true I wasn't entirely sure so just added it just in case
comment on: http://stackoverflow.com/q/78774815
type: Comment

add-on
tag name: add-on
type: Tag
tags question: http://stackoverflow.com/q/78852175
tags question: http://stackoverflow.com/q/79206391

http://stackoverflow.com/comment/139012298
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78845415
has text: 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.
type: Comment

http://stackoverflow.com/comment/139128712
type: Comment
comment on: http://stackoverflow.com/q/78898300
has text: A good place for general support is over at the pandoc [Discussions](https://github.com/jgm/pandoc/discussions) board on GitHub.
score: 0
type: QuestionComment

http://stackoverflow.com/a/78899797
has body: 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.
accepted answer of: http://stackoverflow.com/q/78891008
answers question: http://stackoverflow.com/q/78891008
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/78895246
type: Answer
has comment: http://stackoverflow.com/comment/139117059
answers question: http://stackoverflow.com/q/78894927
score: 0
has body: Yes, you need substitution captures. You don't need re, though: -- Localisations for syntactic sugar and performance: local lpeg = require 'lpeg' local P, Cs = lpeg.P, lpeg.Cs local any = P(1) -- A string quoted with quote1 and quote2 (also quote1 if not set): local function quoted (quote1, quote2) return P (quote1) * (any - P (quote2 or quote1)) ^ 0 * P (quote2 or quote1) end -- The whole grammar. tbl is the replacement table: local function replace_unquoted (tbl) return Cs ((quoted'"' + any / tbl) ^ 0) * -1 end print (replace_unquoted { a = 'o' }:match 'abcd "abcd" abcd')

http://stackoverflow.com/comment/139079782
type: Comment
has text: 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?
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78882803

http://stackoverflow.com/a/78890730
score: 0
answers question: http://stackoverflow.com/q/78884405
type: Answer
has body: Instead of calling the Model.Anchored property, make a part of your model the PrimaryPart. Then use the code like this Model.PrimaryPart.Anchored=false. This means all of the parts of the model revolve around the PrimaryPart, including the descendants, and they all follow the part's copyable properties. This means I don't have to manually set each part to anchored if I have two parts in a model. Here's a quick example: (This code makes use of a model with multiple parts) local model=script.Parent model.PrimaryPart.Anchored=false Hope this helped!

http://stackoverflow.com/comment/139021180
comment on: http://stackoverflow.com/a/78846539
type: Comment
has text: you absolute legend.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/138997026
comment on: http://stackoverflow.com/a/78832783
type: AnswerComment
type: Comment
has text: @den4ik_here np!
score: 0

http://stackoverflow.com/comment/139084278
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78885569
has text: What was the purpose of the RunServiceEvent code? Did you receive it from a programming guide?

http://stackoverflow.com/comment/138995679
type: Comment
comment on: http://stackoverflow.com/a/78836162
has text: this code didnt work maybe it's because i didnt use a local script
score: 0
type: AnswerComment

http://stackoverflow.com/comment/138991948
has text: Whoops while making the minimal example, I answered my question. I will edit my post and include it.
comment on: http://stackoverflow.com/q/78831240
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/139076369
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/78880558
has text: 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.
type: Comment

http://stackoverflow.com/comment/138978199
score: 2
type: Comment
comment on: http://stackoverflow.com/a/78826958
type: AnswerComment
has text: "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`).

http://stackoverflow.com/a/78895181
answers question: http://stackoverflow.com/q/78889559
upvote count: 2
type: Answer
downvote count: 0
has body: love.keypressed does not actually return anything, according to this it is a callback function. every time any key is pressed, it will trigger. -- old if(love.keypressed("up",false) or love.keypressed("w",false))then didWePressF = 1 if(updatesFromLastDashF<30)then player.y = player.y-50 didWePressF = 0 updatesFromLastDashF = 0 end end --new function love.keypressed(key,code,isrepeat){ -- key:character of the key, code:scancode of the key,isrepeat:if the key is held down if(not isrepeat) then --only runs if the keys arent being held if(code=="up" or code=="w")then didWePressF = 1 if(updatesFromLastDashF<30)then player.y = player.y-50 didWePressF = 0 updatesFromLastDashF = 0 end end end }
score: 2

http://stackoverflow.com/comment/138887553
type: QuestionComment
score: 1
has text: It doesn't seem that ``conan`` is related to this question, it seems it is only about premake project configuration.
type: Comment
comment on: http://stackoverflow.com/q/78774815

http://stackoverflow.com/comment/139222148
comment on: http://stackoverflow.com/q/78832294
has text: [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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/138982663
type: Comment
has text: 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.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/78829658

http://stackoverflow.com/comment/139313261
type: QuestionComment
score: 0
has text: 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.
comment on: http://stackoverflow.com/q/78778829
type: Comment

http://stackoverflow.com/a/78851335
accepted answer of: http://stackoverflow.com/q/78850469
answers question: http://stackoverflow.com/q/78850469
has body: According to the documentation BasePart.GetTouchingParts() Returns a table of all parts that are physically interacting with this part. So if no parts are touching you'll get an empty table. Check the number of table elements instead.
type: AcceptedAnswer
score: 0
type: Answer

scroll-offset
type: Tag
tag name: scroll-offset
tags question: http://stackoverflow.com/q/78828662

http://stackoverflow.com/comment/139084552
score: 0
type: QuestionComment
has text: @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.
comment on: http://stackoverflow.com/q/78885569
type: Comment

http://stackoverflow.com/comment/139013279
type: Comment
has text: @KyleF.Hartzenberg, I used `sudo apt install neovim`. I am on Ubuntu.
comment on: http://stackoverflow.com/q/78845415
score: 0
type: QuestionComment

http://stackoverflow.com/a/78791747
answers question: http://stackoverflow.com/q/78791003
score: 0
type: Answer
has body: If in msg you have the file name, and in File.name the full name of the file and you want to shorten it, then try extracting the name like this: string.match(File.name,&quot;([^/]*)$&quot;) It matches: a string, starting from the end, and then captures any characters that's not /.

variables
type: Tag
tag name: variables
tags question: http://stackoverflow.com/q/78791470

http://stackoverflow.com/a/78832846
answers question: http://stackoverflow.com/q/78832294
accepted answer of: http://stackoverflow.com/q/78832294
score: 0
has body: Edit: I confused the bool with the event, my bad! Connect a function to the event then run your code. Change your code to: local button = script.Parent local main_menu = script.Parent.Parent.Parent.Parent local main_menu_frame = script.Parent.Parent.Parent main_menu.Enabled = true game.Lighting.Blur.Enabled = true button.MouseButton1Click:Connect(function() game.Lighting.Blur.Enabled = false main_menu.Enabled = false main_menu_frame.Active = false main_menu_frame.Transparency = 1 main_menu_frame.Visible = false task.wait(0.1) end) The code you wrote looped while waiting for the button.MouseButton1Click event to finish. This caused an endless loop of the button triggering and then waiting for the loop to finish. You do not need a loop to check for the event. Instead, just check if the button MouseButton1Down event is triggered then run your code, as the task.wait() function acts as a debounce without the loop.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/139128652
type: AnswerComment
comment on: http://stackoverflow.com/a/78891135
has text: 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).
type: Comment
score: 0

http://stackoverflow.com/comment/139091778
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78890243
has text: 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.
type: Comment

http://stackoverflow.com/comment/139116122
has text: 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. :)
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/78903262
type: Comment

http://stackoverflow.com/comment/139044357
type: Comment
comment on: http://stackoverflow.com/q/78863937
score: 3
type: QuestionComment
has text: You'll have to define "performs best" and measure.

http://stackoverflow.com/a/78775571
score: 3
upvote count: 3
downvote count: 0
type: AcceptedAnswer
has body: 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). If you are not using PCH at all then you will not need to perform any manual override. And also note that you will need the usual 'extern "C"' wrapping, ensuring that the declarations match between the two parts.
type: Answer
accepted answer of: http://stackoverflow.com/q/78774815
answers question: http://stackoverflow.com/q/78774815

http://stackoverflow.com/comment/138961679
has text: Could you share the code you have?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78808593
type: QuestionComment

http://stackoverflow.com/comment/139128666
type: Comment
has text: 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).
comment on: http://stackoverflow.com/a/78858720
score: 0
type: AnswerComment

keyboard-events
tags question: http://stackoverflow.com/q/78894422
type: Tag
tag name: keyboard-events
tags question: http://stackoverflow.com/q/79289046

gdb
tags question: http://stackoverflow.com/q/78860683
type: Tag
tag name: gdb

http://stackoverflow.com/comment/139204989
type: Comment
comment on: http://stackoverflow.com/q/78822833
type: QuestionComment
score: 0
has text: 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 . As for connection logs, it would be simpler to use the player connect event- https://wiki.facepunch.com/gmod/gameevent/player_connect

http://stackoverflow.com/a/78805597
score: 0
type: Answer
has body: You usually get this error when the Lua interpreter executable you're loading a Lua module from doesn't export any symbols (so lua_gettop is not found). See this SO answer for details and a potential solution.
answers question: http://stackoverflow.com/q/78804245

bibliography
type: Tag
tags question: http://stackoverflow.com/q/78899163
tag name: bibliography

http://stackoverflow.com/comment/138880319
type: Comment
comment on: http://stackoverflow.com/q/78766168
type: QuestionComment
score: 0
has text: @prapin @Jarod42 unfortunately your suggestions doesn't resolve the issue. After my projects are generated they contain the following option: ` stdcpplatest `. However I need this option to be configured this way: ` stdcpp17 `. I tried your suggestions, but they had no impact at all on the generated projects, and the `cppdialect` option definitively don't work.

luasec
type: Tag
tag name: luasec
tags question: http://stackoverflow.com/q/78826653

http://stackoverflow.com/comment/139091015
type: Comment
score: 1
comment on: http://stackoverflow.com/q/78889559
type: QuestionComment
has text: 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).

http://stackoverflow.com/comment/138980908
type: Comment
score: 0
has text: Why the double slash?
type: QuestionComment
comment on: http://stackoverflow.com/q/78828662

hyphenation
tag name: hyphenation
type: Tag
tags question: http://stackoverflow.com/q/78896730

freeswitch
type: Tag
tag name: freeswitch
tags question: http://stackoverflow.com/q/78779955
tags question: http://stackoverflow.com/q/79374805
tags question: http://stackoverflow.com/q/79246582

windows-11
type: Tag
tag name: windows-11
tags question: http://stackoverflow.com/q/78882864

command-line-interface
type: Tag
tags question: http://stackoverflow.com/q/78746601
tag name: command-line-interface

http://stackoverflow.com/comment/139271215
type: QuestionComment
comment on: http://stackoverflow.com/q/78987682
type: Comment
has text: @DavidvonTamar it works with 2.0.5 and without the extensionPath.
score: 0

http://stackoverflow.com/comment/139186868
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78912520
type: QuestionComment
has text: 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.

http://stackoverflow.com/comment/139150884
has text: You've never popped the created thread.
type: Comment
comment on: http://stackoverflow.com/q/78922796
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139234920
comment on: http://stackoverflow.com/a/78954198
type: AnswerComment
type: Comment
has text: I guess you tried to do something like this: `{ "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" })`.
score: 0

http://stackoverflow.com/q/78954455
type: Question
accepted answer: http://stackoverflow.com/a/79024942
tagged with: protocol-buffers
has title: Aerospike Lua Protobuf pb.so: undefined symbol: lua_settop
score: 0
type: AnsweredQuestion
tagged with: lua
has answer: http://stackoverflow.com/a/79024942
tagged with: aerospike
has body: I try to run simple lua udf in docker and keep getting this error: ERROR lua create error: error loading module 'protobuf.pb' from file '/usr/local/lib/lua/5.1/protobuf/pb.so': /usr/local/lib/lua/5.1/protobuf/pb.so: undefined symbol: lua_settop 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: Here is Dockerfile where I test it FROM rockylinux:8.9 # install requirements RUN dnf update -y && \ dnf install -y git gcc make findutils wget unzip readline-devel python3 python3-pip && \ ln -sf /usr/bin/python3 /usr/bin/python ## install aerospile RUN mkdir -p aerospike \ && wget -qO- "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" | tar -xvzf - -C ./aerospike --strip-components=1 \ && cd ./aerospike && ./asinstall && cd ../ && rm -rf ./aerospike # https://aerospike.com/developer/udf/knowing_lua#lua-version ARG LUA_VERSION=5.1.4 # Use latest ARG LUAROCKS_VERSION=3.11.1 # install lua RUN mkdir -p lua && \ wget -qO- https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | tar -xvzf - -C ./lua --strip-components=1 && \ cd ./lua && CFLAGS="-fPIC -Wall -Wextra" LIBFLAGS="-shared" make -j $(nproc) linux && make -j $(nproc) install && \ cd ../ && rm -rf ./lua && \ lua -v && \ # install luarocks mkdir -p ./luarocks && \ wget -qO- luarocks https://luarocks.org/releases/luarocks-${LUAROCKS_VERSION}.tar.gz | tar -xvzf - -C ./luarocks --strip-components=1 && \ cd luarocks && ./configure && make -j $(nproc) && make -j $(nproc) install && cd .. && rm -rf luarocks && \ luarocks && \ # install protobuf luarocks install protobuf && \ luarocks install lua-protobuf && \ pip3 install protobuf && \ dnf install -y protobuf-compiler && \ # clean up dnf clean all COPY ./proto /proto COPY ./udf /udf ENTRYPOINT ["asd"] CMD ["…
answer count: 1
tagged with: linux

http://stackoverflow.com/comment/139384691
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/79049201
score: 0
has text: Wrong tool, for stuff like this you might want to take a look at AutoHotkey and co

http://stackoverflow.com/comment/139310069
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/79009035
has text: 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.
type: Comment

http://stackoverflow.com/q/78938722
tagged with: variable-assignment
has body: In Python, obviously it's possible to assign to names, e.g. a = 1. It's also valid to assign to attributes (a.b = 1 - AFAIK this corresponds to the __setattr__ special method) and indexing operations (a[b] = 1, which corresponds to __setitem__). In Lua, those are the only valid assignment targets - the language's grammar enforces that restriction: var ::= Name | prefixexp '[' exp ']' | prefixexp '.' Name. Are those three forms also an exhaustive list of valid assignment targets in Python or are there others? (For example, according to this answer, it's not valid to assign to a function call: f() = 1 is invalid.) Also, is the restriction to valid assignment targets enforced by the grammar as in Lua, or later in the source =&gt; bytecode compilation process?
has comment: http://stackoverflow.com/comment/139180750
upvote count: 1
has comment: http://stackoverflow.com/comment/139182435
has title: What are valid assignment targets in Python?
tagged with: lua
type: Question
type: UnansweredQuestion
tagged with: python
has comment: http://stackoverflow.com/comment/139181229
score: 1
linked to: http://stackoverflow.com/q/74453371
downvote count: 0
favorite count: 0
answer count: 0

http://stackoverflow.com/a/78939478
has comment: http://stackoverflow.com/comment/139183726
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/78931550
accepted answer of: http://stackoverflow.com/q/78931550
upvote count: 2
type: AcceptedAnswer
has body: (answer by OP) After some hacking around, I managed to change my data structure to something that looks overkill, but at least it works Don't take that as an optimal solution... Instead of this (which does not sort, see answers) local dic = {} dic[1] = {t="foo"} dic[25] = {t="bar"} dic[-30] = {t="negative"} -- try to sort that ... which gives an unsorted and unsortable { { t = "foo" }, [-30] = { t = "negative" }, [25] = { t = "bar" } } I finally used local dic = {} table.insert(dic, {key=1, value={t="foo", ...}} ) table.insert(dic, {key=25, value={t="bar", ...}} ) table.insert(dic, {key=-30, value={t="negative", ...}} ) -- sort with an explicit function table.sort(thresholds, function(kv1,kv2) return kv1.k < kv2.k end ) for _,kv in pairs(dic) do -- processing end which gives a more complex, and sortable { { key=1, value= { t = "foo", ...} }, ... }
type: Answer

http://stackoverflow.com/q/79059156
accepted answer: http://stackoverflow.com/a/79069564
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/79069564
tagged with: lua
type: AnsweredQuestion
tagged with: sol3
has body: I can implement a Lua C module in pure C by exporting a function luaopen_mymodule that calls luaL_newlib. How can I do the equivalent in C++, using the sol2 (sol 3) library?
linked to: http://stackoverflow.com/q/65657883
score: 0
has title: How to write a Lua C module with sol2?

http://stackoverflow.com/q/79049201
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/139384691
has body: 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? 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.
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/139387428
has title: How can I make a simple automation with lua?
score: 0

http://stackoverflow.com/q/79016532
answer count: 0
tagged with: lua
has title: Animation on roblox problems
type: Question
tagged with: roblox-studio
score: 0
type: UnansweredQuestion
has body: My friend used the script on Roblox Studio: local cas = game:GetService("ContextActionService") local rs = game:GetService("ReplicatedStorage") local events = rs:WaitForChild("Events") local hitboxEvent = events:WaitForChild("Hitbox") local plr = game.Players.LocalPlayer local character = plr.Character or plr.CharacterAdded:Wait() local hum = character:WaitForChild("Humanoid") local animator = hum:WaitForChild("Animator") local rightPunch = animator:LoadAnimation(script:WaitForChild("RightPunch")) local currentPunch = 0 local debounce = false local function punch() if debounce then return end debounce = true if currentPunch == 0 then rightPunch:Play() hitboxEvent:FireServer(Vector3.new(1,1,1), Vector3.new( 5), 50, 0.3) task.wait(0.4) debounce = false elseif currentPunch == 1 then rightPunch:Play() hitboxEvent:FireServer(Vector3.new(1,1,1), Vector3.new(2,5), 50, 0.3) debounce = false elseif currentPunch == 2 then rightPunch:Play() hitboxEvent:FireServer(Vector3.new(1,1,1), Vector3.new(2,5), 50, 0.3) debounce = false end if currentPunch == 2 then currentPunch = 0 else currentPunch += 1 end end cas:BindAction("Punch", punch, true, Enum.UserInputType.MouseButton1) Screenshot The 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) 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)

http://stackoverflow.com/a/78978267
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78974887
answers question: http://stackoverflow.com/q/78974887
has body: Just concat it: tabl = {"File", "Documents", "txt_page"} path = table.concat(tabl, "/") print(path) -- "File/Documents/txt_page" For Lua table: local new_txt_Page = 3 local str = "Files['" .. table.concat(tabl, "']['") .. "'] = " .. new_txt_Page print (str) -- Files['File']['Documents']['txt_Page'] = 3 load(str)() -- execute the string If your strings have no spaces dashes etc., then you can make it just like: str = "Files."..table.concat(tabl, ".").." = ".. new_txt_Page print (str) -- Files.File.Documents.txt_Page = 3 load(str)()
score: 0

http://stackoverflow.com/q/78929050
tagged with: pandoc
upvote count: 1
answer count: 1
linked to: http://stackoverflow.com/q/75837284
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/78934473
has answer: http://stackoverflow.com/a/78934473
downvote count: 0
score: 1
type: AnsweredQuestion
has body: 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 this question/answer. Now, I would like to do two things to make the answer stand out: I would like to prepend the text "ANSWER: " as the first element in both the Span and Div I would like to render the text inside each Span and Div using strong. This Lua filter works to show/hide the solutions: -- A lua filter to render answers based on YAML block entry `show-answers` -- -- The class `.answers` will render when `show-answers` is True and not if -- `show-answers` option is False (note captialization) -- -- Barely adapted from: https://stackoverflow.com/a/75837627/12586249 local show_answers = nil function Pandoc (doc) show_answers = doc.meta['show-answers'] return doc end function Span (span) if span.classes:includes 'answer' then return show_answers and span.content or {} end end function Div (div) if div.classes:includes 'answer' then return show_answers and div.content or {} end end return { {Pandoc = Pandoc}, {Div = Div}, {Span = Span} } I have tried to add text (like this solution suggests), but that removes inline math and code blocks also need to be included in the answers. I tried prepending the string "ANSWER: " to the content of the span: function Span (span) if span.classes:includes 'answer' then new_content = {{"ANSWER: "} .. span.content} return show_answers and new_content or {} end end but I received the following error: Inline, list of Inlines, or string expected, got table. Here is a minimal markdown example that would use the filter: --- title: A Test of Answer Reveal show-answers: True --- ## Question 1 What is the equatio of a line? [A line follows the formula $y = mx + b$]{.answer} ## Question 2 Randomly generate a normally distributed population of weights with a mean weight among women of 150 pounds and 190 pounds among men with standard devi…
tagged with: lua
has title: Add text to start of Lua pandoc Span and Div when I show/hide solutions
linked to: http://stackoverflow.com/q/72127544

http://stackoverflow.com/a/78980576
type: Answer
has body: In the function you don't check if the driveSeat parameter is a seat object. Nestle the rest of your code with if if driveseat:IsA("Seat") then. Also you don't connect the function in your code. Connect the function via this seat.Sat:Connect(OnDriveSeatChanged). Make sure your code is called correctly and that unknown parameters are not used as objects.
answers question: http://stackoverflow.com/q/78970599
score: 0

http://stackoverflow.com/a/78988659
score: 1
type: AcceptedAnswer
type: Answer
has body: I don't know lua, but can give you a function that works with the equivalent nested python list. Make the array with broadcasted arrays: In [303]: res = (np.arange(5)[:,None,None,None] - np.arange(2))/(np.arange(4)[:,None,None] + np.arange(3)[:,None]+1) In [304]: res.shape Out[304]: (5, 4, 3, 2) Make a nested list from that: In [305]: lres = res.tolist() In [306]: len(lres), len(lres[0][0]) Out[306]: (5, 3) An iterative function to apply successive indices: def foo(a, idx): res = a if len(idx)==0: return res for i in idx: res = res[idx[0]] idx = idx[1:] return res testing with index: In [311]: index = (4,3,2,1) The array version: In [312]: res[index] Out[312]: 0.5 trying the tuple on the nested list: In [313]: lres[index] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[313], line 1 ----&gt; 1 lres[index] TypeError: list indices must be integers or slices, not tuple But the function: In [314]: foo(lres, index) Out[314]: 0.5 it also works on the array (but not quite as fast): In [315]: foo(res, index) Out[315]: 0.5 A recursive equivalent: def foor(a, idx): if len(idx)==0: return a else: return foor(a[idx[0]], idx[1:]) In [317]: foor(lres, index) Out[317]: 0.5 From the little I've seen about lua you should be able to translate one or both without too much trouble. Looks like its table is similar to list. There are about 300 questions/answers on SO with searching for [lua] array. So people have been working with some sort of arrays in lua - though in many cases that may be just another name for table. In python deeply nested lists are not common. One level of nesting is common enough. There are even tricks for 'transposing` such a list In [318]: alist = [[1,2,3],[4,5,6]]; alist Out[318]: [[1, 2, 3], [4, 5, 6]] In [319]: list(zip(*alist)) Out[319]: [(1, 4), (2, 5), (3, 6)] Under the covers, numpy stores all the values in a flat (1d) array ('C'), and uses shape and strides to treat it as a mul…
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78985612
answers question: http://stackoverflow.com/q/78985612

http://stackoverflow.com/q/79037409
has answer: http://stackoverflow.com/a/79038795
tagged with: roblox
has body: 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) edit: changed out h.Position for root.Position, still broken edit 2: tried different way to define root but still broken (no errors) local Tool = script.Parent; enabled = true function onActivated() if not enabled then return end enabled = false Tool.GripForward = Vector3.new(0,-.759,-.651) Tool.GripPos = Vector3.new(1.5,-.5,.3) Tool.GripRight = Vector3.new(1,0,0) Tool.GripUp = Vector3.new(0,.651,-.759) Tool.Handle.DrinkSound:Play() wait(3) local h = Tool.Parent:FindFirstChild("Humanoid") if (h ~= nil) then if (h.MaxHealth > h.Health + 5) then h.Health = h.Health + 0 else h.Health = h.Health + 0 end end --I think the script breaks here local Player = game.Players.LocalPlayer local character = Player.Character or Player.CharacterAdded:Wait() local root = character:WaitForChild("HumanoidRootPart") Tool.GripForward = Vector3.new(-.976,0,-0.217) Tool.GripPos = Vector3.new(0.03,0,0) Tool.GripRight = Vector3.new(.217,0,-.976) Tool.GripUp = Vector3.new(0,1,0) local e = Instance.new("Explosion") e.BlastRadius = 16 e.BlastPressure = 1000000 e.Position = root.Position e.Parent = game.Workspace enabled = true end function onEquipped() Tool.Handle.OpenSound:play() end script.Parent.Activated:connect(onActivated) script.Parent.Equipped:connect(onEquipped)
type: Question
upvote count: 1
downvote count: 0
answer count: 1
has title: Attempting to find character position by defining player/character/root breaks script but has no errors
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139361155
score: 1
favorite count: 0
tagged with: lua

numpy
tags question: http://stackoverflow.com/q/78985612
type: Tag
tag name: numpy

http://stackoverflow.com/comment/139374928
has text: 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.
comment on: http://stackoverflow.com/q/79024260
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/78919595
downvote count: 1
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/78952439
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139148695
has title: LUA ERROR i can't find the malicious endpoint
favorite count: 0
score: 0
has body: I'm working on my Gmod DarkRP server and I have the following error. [ERROR] Attempted request to known malicious code endpoint 'https://kvac.cz/f.php?key=ZEhWgVuEB4ZMnSPCH0dl'! Blocking! 1. Fetch - lua/includes/modules/http.lua:42 2. unknown - DRME:1 But I can't find the malicious endpoint in the different addon that I have. Does anyone have an idea where I can find it ? I try to find it using the search tool of visual studio code
tagged with: garrys-mod
tagged with: lua
has comment: http://stackoverflow.com/comment/139145051

http://stackoverflow.com/comment/139268894
has text: This isn't the default value, maybe you have defined environment variables LUA_PATH or LUA_PATH_5_4.
type: QuestionComment
score: 1
type: Comment
comment on: http://stackoverflow.com/q/78985193

http://stackoverflow.com/a/79004096
has body: We create an command for the BufWritePre event. When this event triggers, we retrieve the buffer being written, then loop through its lines. Once we find a line starting with Date: we replace it with current date and then its saved. vim.api.nvim_create_autocmd( "BufWritePre", { pattern = "*.md", callback = function() local bufnr = vim.api.nvim_get_current_buf() for line_num = 0, vim.api.nvim_buf_line_count(bufnr) - 1 do local line = vim.api.nvim_buf_get_lines(bufnr, line_num, line_num + 1, false)[1] if line:match("Date:") then local new_date = os.date("Date: %Y/%m/%d") vim.api.nvim_buf_set_lines(bufnr, line_num, line_num + 1, false, { new_date }) break end end end })
accepted answer of: http://stackoverflow.com/q/79002050
score: 1
answers question: http://stackoverflow.com/q/79002050
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/139304554
type: Answer
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/139219190
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/78959883
has text: "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 ?

http://stackoverflow.com/q/78978616
type: UnansweredQuestion
has title: Lua module luaossl installed successfully with luarocks, stilll require("luaossl") fails
score: 0
has body: I installed "luaossl" using luarocks. Also installed "http". But Cannot import either from lua prompt. require("http") fails too. I tried eval "$(luarocks path)" but that didn't help either. Here is a screenshot. # luarocks install http Warning: falling back to curl - install luasec to get native HTTPS support Installing https://luarocks.org/http-0.4-0.all.rock http 0.4-0 depends on lua >= 5.1 (5.3-1 provided by VM) http 0.4-0 depends on compat53 >= 0.3 (0.14.3-1 installed) http 0.4-0 depends on bit32 (5.3.5.1-1 installed) http 0.4-0 depends on cqueues >= 20161214 (20200726.53-0 installed) http 0.4-0 depends on luaossl >= 20161208 (20220711-0 installed) http 0.4-0 depends on basexx >= 0.2.0 (0.4.1-1 installed) http 0.4-0 depends on lpeg (1.1.0-1 installed) http 0.4-0 depends on lpeg_patterns >= 0.5 (0.5-0 installed) http 0.4-0 depends on binaryheap >= 0.3 (0.4-1 installed) http 0.4-0 depends on fifo (0.2-0 installed) http 0.4-0 is now installed in /usr (license: MIT) [root@ip-146-69-43-165 ~]# lua Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio > luaossl = require("luaossl") stdin:1: module 'luaossl' not found: no field package.preload['luaossl'] no file '/usr/share/lua/5.3/luaossl.lua' no file '/usr/share/lua/5.3/luaossl/init.lua' no file '/usr/lib64/lua/5.3/luaossl.lua' no file '/usr/lib64/lua/5.3/luaossl/init.lua' no file './luaossl.lua' no file './luaossl/init.lua' no file '/usr/lib64/lua/5.3/luaossl.so' no file '/usr/lib64/lua/5.3/loadall.so' no file './luaossl.so' stack traceback: [C]: in function 'require' stdin:1: in main chunk [C]: in ? > require("http") stdin:1: module 'http' not found: no field package.preload['http'] no file '/usr/share/lua/5.3/http.lua' no file '/usr/share/lua/5.3/http/init.lua' no file '/usr/lib64/lua/5.3/http.lua' no file '/usr/lib64/lua/5.3/http/init.lua' no file './http.lua' no file './http/init.lua' no file '/usr/lib64/lua/5.3/http.so' no file '/usr/lib64/lua/5.3/loadall.so' no file './http.so' stack traceback: [C]: in function …
tagged with: lua
tagged with: http
answer count: 0
type: Question

http://stackoverflow.com/q/79063646
type: Question
has title: openresty lua-resty-core how set_current_peer works?
has body: 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 "no upstream found": 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 I followed up this guide when tried to configure https://kura.gg/2020/08/09/retrying-dynamically-configured-upstreams-with-openresty/ Openresty config - i've added upstream servers in init_by_lua_block and all logic in balancer_by_lua_file: http { resolver 8.8.8.8; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; log_by_lua_file /usr/local/openresty/nginx/conf/conter.lua; lua_package_path ";;/usr/local/openresty/lualib/resty/?.lua;"; lua_max_running_timers 1024; lua_shared_dict healthcheck 1m; lua_shared_dict log_dict 5M; lua_shared_dict my_shared_dict 10m; lua_socket_log_errors on; init_by_lua_block { upstream_servers = { "192.168.141.218:8080", "192.168.141.204:8080", } } upstream jenkins-uat { server 192.168.141.218:8080; balancer_by_lua_file /usr/local/openresty/nginx/conf/conter.lua; keepalive 32; } server { listen 80 default_server; server_name 192.168.141.218; location / { return 301 https://192.168.141.218$request_uri; } } server { listen 443 ssl http2; ssl_certificate /etc/ssl/private/fullchain.pem; ssl_certificate_key /etc/ssl/private/privkey.pem; server_name 192.168.141.218; access_log /var/log/jenkins-uat.access.log; error_log /var/log/jenkins-uat.error.log; ignore_invalid_headers off; location / { sendfile off; proxy_pass http://jenkins-uat; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_max_temp_file_size 0; add_header X-Upstream $upstream_addr a…
tagged with: jenkins
score: 0
tagged with: openresty
type: UnansweredQuestion
tagged with: failover
answer count: 0
tagged with: lua

http://stackoverflow.com/q/78922870
score: -1
type: Question
type: UnansweredQuestion
upvote count: 0
tagged with: lua
downvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/78925884
tagged with: roblox
has body: 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 beforeafter holding q 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!
favorite count: 0
has title: Move the object smoothly without using cframe or position in the direction of the mouse

http://stackoverflow.com/a/78984781
answers question: http://stackoverflow.com/q/78974545
score: 0
type: Answer
has body: Following the official example, I have resolved the issue myself, so I am posting the solution here. #include <sol/sol.hpp> int main() { sol::state lua; lua.open_libraries(sol::lib::base, sol::lib::coroutine); lua.set_function("run_coroutine", [&lua](sol::function f) { sol::thread runner_thread = sol::thread::create(lua); sol::state_view runner_thread_state = runner_thread.state(); sol::coroutine co(runner_thread_state, f); co(); co(); co(); }); lua.script(R"( function story() print("1") coroutine.yield() print("2") coroutine.yield() print("3") end run_coroutine(story) )"); } 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.

sol3
tags question: http://stackoverflow.com/q/78974545
tag name: sol3
type: Tag
tags question: http://stackoverflow.com/q/79059156

http://stackoverflow.com/q/78987682
tagged with: lua
has comment: http://stackoverflow.com/comment/139271215
has comment: http://stackoverflow.com/comment/139270065
tagged with: visual-studio-code
has body: I have created a folder users>user_name>lua_tests in which I have saved the following simple code A = {{1,2},{3,4}} io.write(#A,"\n") This executes successfully on a macOS terminal. I have installed the following extensions: Lua: Lua Language Server coded by Lua Lua Debug: VSCode debugger extension for Lua extensionPath When I select Run File there is no response. 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.
has comment: http://stackoverflow.com/comment/139271066
has title: Simple lua code does not run in Visual Studio Code
type: Question
upvote count: 1
downvote count: 0
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: macos
favorite count: 0

http://stackoverflow.com/q/79020824
tagged with: filter
has body: 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 The logic is VPN A Detection: MAC Address: 78:63:58:48:43:23 (gpon.net) Port: 443 or 88 Packet Length: 1482 bytes Protocol: UDP VPN B Detection: Source and Destination Ports: Must be the same and either 51820 or 5353 Packet Length: 1494 bytes Protocol: UDP VPN C Detection: MAC Address: 78:63:58:48:43:23 (gpon.net) Port: 51820 Packet Length: 1494 bytes Protocol: UDP lua script local udp_src_port_field = Field.new("udp.srcport") -- Extracts source UDP port local udp_dst_port_field = Field.new("udp.dstport") -- Extracts destination UDP port local eth_src_mac_field = Field.new("eth.src") -- Extracts source MAC address local eth_dst_mac_field = Field.new("eth.dst") -- Extracts destination MAC address local ipv4_proto_field = Field.new("ip.proto") -- Extracts IPv4 protocol local ipv6_proto_field = Field.new("ipv6.nxt") -- Extracts IPv6 next header local vpn_signatures = { A = { mac_address = "78:63:58:48:43:23", dst_ports = {443, 88}, packet_length = 1482 }, B = { src_dst_ports = {51820, 5353}, packet_length = 1494 }, C = { mac_address = "78:63:58:48:43:23", dst_port = 51820, packet_length = 1494 } } local function table_contains(tbl, element) for _, value in ipairs(tbl) do if value == element then return true end end return false end tap = Listener.new("ip") function tap.packet(pinfo, tvb) local packet_length = tvb:len() -- Get the packet length local src_port_value = udp_src_port_field() local dst_port_value = udp_dst_port_field() if src_port_value == nil or dst_port_value == nil then return end local src_port = tonumber(src_port_value.value) local dst_port = tonumber(dst_port_value.value) local src_mac_value = tostring(eth_src_mac_field()) local dst_mac_value = tostring(eth_dst_mac_field()) local proto_field_value = ipv4_proto_field() or ipv6_proto_field() if proto_field_value == nil then return end -- Skip if no protocol field …
score: 0
type: Question
type: UnansweredQuestion
tagged with: capture
tagged with: lua
answer count: 0
has title: Capture filter for VPN detection in Wireshark through lua script
tagged with: wireshark
tagged with: wireshark-dissector

http://stackoverflow.com/comment/139387428
comment on: http://stackoverflow.com/q/79049201
type: QuestionComment
score: 0
type: Comment
has text: Actually, I found a library called Lua Selenium that worked for me, anyways, thanks!

http://stackoverflow.com/q/79010976
tagged with: lua
tagged with: lua-scripting-library
has body: Is it possible to find a workaround for this? 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 I have no idea where to start to be honest. -- Variable to track the last key pressed local lastKeyPressed = nil function OnEvent(event, arg) if event == "G_PRESSED" then if arg == 77 then -- Direct key code for "M" lastKeyPressed = "m" elseif arg == 78 then -- Direct key code for "N" lastKeyPressed = "n" end end -- Check if the scroll wheel button is pressed to activate the macro if event == "MOUSE_BUTTON_PRESSED" and arg == 3 then -- Assuming middle mouse button (scroll wheel) is used QP() end end function QP() local leanDuration = 25 -- Duration to hold lean in milliseconds local pauseDuration = 40 -- Pause between actions in milliseconds if lastKeyPressed == "n" then -- If N was the last key, press M then N PressKey("m") Sleep(leanDuration) ReleaseKey("m") Sleep(pauseDuration) PressKey("n") Sleep(leanDuration) ReleaseKey("n") elseif lastKeyPressed == "m" then -- If M was the last key, press N then M PressKey("n") Sleep(leanDuration) ReleaseKey("n") Sleep(pauseDuration) PressKey("m") Sleep(leanDuration) ReleaseKey("m") else -- Default action if no key has been pressed yet (optional) PressKey("n") Sleep(leanDuration) ReleaseKey("n") Sleep(pauseDuration) PressKey("m") Sleep(leanDuration) ReleaseKey("m") end lastKeyPressed = nil end
has comment: http://stackoverflow.com/comment/139734509
answer count: 1
score: 0
tagged with: logitech-gaming-software
has answer: http://stackoverflow.com/a/79036808
has title: Logitech G-hub lua script
has comment: http://stackoverflow.com/comment/139313049
type: Question
type: UnansweredQuestion

http://stackoverflow.com/q/79059064
tagged with: lua
has answer: http://stackoverflow.com/a/79141374
answer count: 1
tagged with: powershell
tagged with: terminal
tagged with: windows
has title: Horizontal split in WezTerm and keep the current working directory. Possible?
has body: OS: Windows 10 | Shell: Powershell (7) 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. 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. 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: local wezterm = require 'wezterm' local act = wezterm.action local config = {} config.keys = { { key = '<', mods = 'CTRL|ALT', action = wezterm.action_callback(function(window, pane) local cwd_url = pane:get_current_working_dir() if cwd_url then window:perform_action(act.SplitHorizontal { cwd = cwd_url } ) else window:perform_action(act.SplitHorizontal { domain = 'CurrentPaneDomain' } ) end end), }, } 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. NOTE: action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, works on its own when testing it, but does not maintain the cwd. So, I also tried adding the following to my Powershell profile: function prompt { $loc = $executionContext.SessionState.Path.CurrentLocation; $out = "" if ($loc.Provider.Name -eq "FileSystem") { $out += "$([char]27)]9;9;`"$($loc.ProviderPath)`"$([char]27)\" } $out += "PS $loc$('>' * ($nestedPromptLevel + 1)) "; return $out } Unfortunately, nothing changed. Does anyone know how to get this to work?
type: Question
upvote count: 1
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139401970
score: 1
favorite count: 0
tagged with: wezterm

http://stackoverflow.com/q/78926822
score: 1
answer count: 1
type: Question
has title: Cant map <leader>c in a minimal init.lua
has answer: http://stackoverflow.com/a/78929652
type: UnansweredQuestion
has body: Here is my minimal init.lua -- Nixvim's internal module table -- Can be used to share code throughout init.lua local _M = {} -- Ignore the user lua configuration vim.opt.runtimepath:remove(vim.fn.stdpath("config")) -- ~/.config/nvim vim.opt.runtimepath:remove(vim.fn.stdpath("config") .. "/after") -- ~/.config/nvim/after vim.opt.runtimepath:remove(vim.fn.stdpath("data") .. "/site") -- ~/.local/share/nvim/site -- Set up globals {{{ do local nixvim_globals = { mapleader = " ", maplocalleader = " " } for k, v in pairs(nixvim_globals) do vim.g[k] = v end end -- }}} -- Set up keybinds {{{ do local __nixvim_binds = { { action = "gcc", key = "<leader>c", mode = "n", options = { noremap = true } } } for i, map in ipairs(__nixvim_binds) do vim.keymap.set(map.mode, map.key, map.action, map.options) end end -- }}} The above init.lua was generated by https://github.com/nix-community/nixvim. It looks valid to me. I am trying to map gcc to <leader>c. When using the built-in gcc in Neovim, it works. But <leader>c does not. Running :nmap shows that the mapping is there. Running :verbose nmap <buffer> <leader>c says: No mapping found. This is strange.
tagged with: neovim
favorite count: 0
upvote count: 2
tagged with: lua
downvote count: 1

saving-data
tags question: http://stackoverflow.com/q/78949402
tag name: saving-data
type: Tag

protocol-buffers
tag name: protocol-buffers
type: Tag
tags question: http://stackoverflow.com/q/78954455
tags question: http://stackoverflow.com/q/79397267

http://stackoverflow.com/q/78962708
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/78967045
has title: Roblox RemoveEvent Firing 2 times for some odd reason
tagged with: roblox
type: Question
has body: I'm making a Roblox code executor that is server sided but everytime I put in code like "print('Hello World!')" it runs that code two times for some reason. Here is the Client Code: local textbox = script.Parent local Attempts = 0 local event = game.ReplicatedStorage.FireCode local Debounce = false textbox.FocusLost:Connect(function(enterPressed) if enterPressed == true and Debounce ~= true then Debounce = true repeat Attempts += 1 print(Attempts) event:FireServer(textbox.Text) task.wait() until Attempts == 1 task.wait(1) Attempts = 0 else return end Debounce = false end) Here is the Server Code: local event = game.ReplicatedStorage.FireCode local debounce = false event.OnServerEvent:Connect(function(player, code) if player and player ~= nil and debounce ~= true then debounce = true loadstring(tostring(code))() task.wait(0.1) debounce = false end end) There are no errors with the code. I tried using the debounce method but it didn't work.
tagged with: lua
accepted answer: http://stackoverflow.com/a/78967045
type: AnsweredQuestion
tagged with: luau

http://stackoverflow.com/q/78974545
score: 1
tagged with: lua
tagged with: sol3
answer count: 1
upvote count: 1
favorite count: 0
has title: How to run a Lua coroutine in C++ with sol3?
tagged with: coroutine
tagged with: c++
has body: 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 sol::function to sol::coroutine are not working. Here is a minimal example that doesn't work: #include <sol/sol.hpp> int main() { sol::state lua; lua.open_libraries(sol::lib::base); lua.set_function("run_coroutine", [](sol::function func) { sol::coroutine co = func; co(); co(); co(); }); lua.script(R"( function story() print("1") coroutine.yield() print("2") coroutine.yield() print("3") end run_coroutine(story) )"); } The expected output is 1 2 3 but actually nothing is shown. How can I correctly run the Lua function as a coroutine in C++?
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/78984781
type: UnansweredQuestion

http://stackoverflow.com/a/79141374
has body: 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 current working directory is inferred through the OSC 7 value. Your prompt function is not setting the OSC 7 value correctly. This is the correct OSC 7 prompt according to the docs: function prompt { $p = $executionContext.SessionState.Path.CurrentLocation $osc7 = "" if ($p.Provider.Name -eq "FileSystem") { $ansi_escape = [char]27 $provider_path = $p.ProviderPath -Replace "\\", "/" $osc7 = "$ansi_escape]7;file://${env:COMPUTERNAME}/${provider_path}${ansi_escape}\" } "${osc7}PS $p$('>' * ($nestedPromptLevel + 1)) "; }
upvote count: 1
has comment: http://stackoverflow.com/comment/139575472
score: 1
answers question: http://stackoverflow.com/q/79059064
has comment: http://stackoverflow.com/comment/139563224
downvote count: 0
type: Answer

http://stackoverflow.com/comment/139202771
has text: 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.
comment on: http://stackoverflow.com/q/78951239
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/139361155
comment on: http://stackoverflow.com/q/79037409
has text: 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?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139263662
type: QuestionComment
has text: 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.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78983963

http://stackoverflow.com/q/78909274
tagged with: openresty
tagged with: redis
type: Question
type: UnansweredQuestion
tagged with: nginx
tagged with: lua
tagged with: video-streaming
has title: use lua script and redis for set pattern in location openresty
answer count: 0
has body: stream.conf.template: server { charset utf-8; client_max_body_size 128M; listen 80; listen 443 ssl http2; ssl_certificate /ssl/ssl.everything; ssl_certificate_key /ssl/ssl.key; server_name ${CDN_BASE_DOMAIN}; location ~ ^/${MULTI_PATTERN_NAMES}/.*\.(ts|mp4|vtt|jpg|webp|webm) { log_by_lua_file /traffic.lua; add_header Access-Control-Allow-Origin *; add_header X-App-Id streamer-nginx; add_header X-Server-Id ${CDN_SERVER_ID}; rewrite ^/${MULTI_PATTERN_NAMES}/(.*)$ /$2 break; root ${VIDEOS_PATH}; } location / { proxy_cache DISK_CACHE; proxy_cache_valid 404 10m; proxy_pass http://${CONTAINER_GO}:3000; } } .env file: CONTAINER_GO=cdn-golang-app-container CDN_BASE_DOMAIN=stream.sample.loc VIDEOS_PATH=/storage MULTI_PATTERN_NAMES=(serve-ts|sample-app|sample-pwa) I have a Dockerized application that includes Golang, OpenResty, Redis, and Postgres services. I had a problem before that was solved, which you can see in this link and finally added log_by_lua_file /traffic.lua; to stream.conf.template. Now I want to do something else. I should use Lua Script instead of ${MULTI_PATTERN_NAMES} environment variable. Suppose I have a variable in Redis named cdn_patterns=(serve-ts|sample-app|sample-pwa). Now I want to connect to redis in lua script 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? 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. With this method, I am looking to dynamically define the patterns in the panel without the need to up and down the app
linked to: http://stackoverflow.com/q/77270819
score: 0

http://stackoverflow.com/q/79062698
tagged with: out
score: 0
answer count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: sonarqube
tagged with: lua
type: Question
tagged with: sonarqube-scan
type: UnansweredQuestion
has body: I am using luacov to generate the code-coverage. I am able to see the coverage.out and using luacov-html I am able to get the index.html file as well. But when I tried to post the report to Sonar, it is asking for the .xml file. [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.
has title: Luacov is not generating the xml output for Sonar

http://stackoverflow.com/comment/139382155
score: 0
comment on: http://stackoverflow.com/q/79040796
has text: Thanks so much i will try that and inform you if it worked
type: QuestionComment
type: Comment

http://stackoverflow.com/a/79061220
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/79059982
downvote count: 0
type: Answer
has body: Since the init script works fine, you can append the directory of the init script to package.searchpath, so that lua is able to find the module from this directory. -- modulePath will be resolved as '~/.hammerspoon/Spoons/Foo.Spoon/init.lua' local modulePath = package.searchpath('Foo', package.path) -- Remove 'init.lua' modulePath = modulePath:match('(.*/)') -- Append ';~/.hammerspoon/Spoons/Foo.Spoon/?.lua' to package.path package.path = package.path .. ';' .. modulePath .. '?.lua' -- Now the following code will resolve the module path as -- '~/.hammerspoon/Spoons/Foo.Spoon/my/bar.lua' local bar = require("my.bar")

http://stackoverflow.com/a/78959883
answers question: http://stackoverflow.com/q/78959804
has comment: http://stackoverflow.com/comment/139219190
has comment: http://stackoverflow.com/comment/139219275
has comment: http://stackoverflow.com/comment/139219231
score: 2
has comment: http://stackoverflow.com/comment/139219242
downvote count: 0
has body: What you read is incorrect, self = setmetatable(args, self) doesn't change Button, it just overwrites the parameter self to the return value of setmetatable, so it is equivalent to the following code: local t = setmetatable(args, self) t.text = t.text or &quot;&quot; ... The implicit parameter self is dynamic, its value depends on how the function is invoked. For Account:new(....), self is Account, for AccountGold:new(....), self is AccountGold, so that you can achieve inheritance with a single function. self.__index = self is cheap, but if you need to strictly control the exposed members, you should create a separate metatable.
has comment: http://stackoverflow.com/comment/139219278
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/139219285
accepted answer of: http://stackoverflow.com/q/78959804

http://stackoverflow.com/q/78950971
type: Question
accepted answer: http://stackoverflow.com/a/78951467
downvote count: 0
has body: I'm rolling out my own LUA debugger for a C++ & 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 return(...) statement and running that. The exact line is: local func, res = mobdebug.loadstring("return(" .. exp .. ")") 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 return(...) expressions to certain tables and their fields. More specifically, I'm working with some LUA "classes" using the setmetatable / __index pattern, and, given access to the table (let's call it SomeClass) I'd like to be able to evaluate expressions such as self.mSomeVariable + self.mSomeOtherVariable - self:someOperation(...) where self is referring to SomeClass (i.e. there exists SomeClass:someOperation, etc). 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. > SomeClass = {} > SomeClass.DebugEval = function(self, chunk_str) return load("return(" .. chunk_str .. ")")() end > SomeClass.DebugEval(SomeClass, "print(1)") // 1 nil > SomeClass.DebugEval(SomeClass, "print(SomeClass)") // table: 0000000000CBB5C0 nil > SomeClass.DebugEval(SomeClass, "print(self)") // nil nil The fact that I cannot even reference the "class" via self by passing it in directly to the wrapping function's argument makes me suspicious that this might be a upvalue problem. That is, load(...) is creating a closure for the execution of this chunk that has no way of reaching the self argument... but why? It's quite literally there??? In any case, my debugger backend is already on C++, so I thought "no problem, I'll just manually set the upvalue. Again, I tried doing the following using …
score: 1
tagged with: upvalue
tagged with: lua
type: AnsweredQuestion
answer count: 1
upvote count: 1
favorite count: 0
tagged with: debugging
has answer: http://stackoverflow.com/a/78951467
has title: Manually setting upvalue variables for 'load'ed LUA chunk

http://stackoverflow.com/q/78936201
tagged with: lua
has body: as you know, in the setup factory software, you cannot apply a click code to the text. Now I need to solve this problem with a trick. 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. sorry my English was bad 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
tagged with: setup-factory
has title: Setup factory : add click to text
score: 0
type: Question
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/139291365
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78996339
has text: 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?

http://stackoverflow.com/comment/139202723
score: 0
has text: Have you considered writing a simple python decorator? That seems like an easier approach.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78951239

http://stackoverflow.com/q/78996339
has comment: http://stackoverflow.com/comment/139291365
type: UnansweredQuestion
answer count: 0
linked to: http://stackoverflow.com/q/2161912
duplicate of: http://stackoverflow.com/q/2161912
tagged with: evaluation
tagged with: lua
has comment: http://stackoverflow.com/comment/139287801
has body: 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. Consider the following code: function foo() return 1, 2 end print(foo()) print(foo(), foo()) When running this, I get the following output 1 2 1 1 2 So it seems that when a parameter evalutes to multiple values, only the first value is actually passed into the function unless that is the last parameter. I later looked into the Lua documentation and it clearly confirms that this is the expected behavior We get all results only when the call is the last (or the only) expression in a list of expressions. Source 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. 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: function foo(a, b, c) return a + b + c end function bar() return 1, 1 end foo(bar(), 1) -- throws error for trying to add nil foo(1, bar()) -- works as expected 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 bar and feed them into the first two arguments of foo?
has title: Why does Lua handle multiple function return values this way?
score: 0
has comment: http://stackoverflow.com/comment/139286415
type: Question

http://stackoverflow.com/comment/139266587
type: Comment
comment on: http://stackoverflow.com/q/78985193
type: QuestionComment
score: 0
has text: @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")

http://stackoverflow.com/comment/139627184
score: 0
type: AnswerComment
type: Comment
has text: yes, sorry for being inactive
comment on: http://stackoverflow.com/a/79038597

http://stackoverflow.com/a/79104868
score: 0
type: Answer
answers question: http://stackoverflow.com/q/79059982
has body: According to the Hammerspoon docs on spoon development you can not use require and should instead use the following: dofile(hs.spoons.resourcePath("someCode.lua"))

http://stackoverflow.com/q/78985193
linked to: http://stackoverflow.com/q/61039127
has comment: http://stackoverflow.com/comment/139265916
has comment: http://stackoverflow.com/comment/139272833
type: Question
upvote count: 1
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/139269032
score: 1
has comment: http://stackoverflow.com/comment/139268894
favorite count: 0
tagged with: lua-5.4
tagged with: lua
has comment: http://stackoverflow.com/comment/139266587
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78987341
linked to: http://stackoverflow.com/q/46024370
accepted answer: http://stackoverflow.com/a/78987341
has body: I see multiple questions here, that imply loading modules from the current directory should be the default behavior of Lua. See "selected answers" for these two questions: Why lua require won't search current directory? ("if you used lua test.lua then it shoud work") Lua: relative import fails from different working directory ("else cwd is . which works by default") But my experience with lua54 is that it doesn't: C:\Code\lua\testcwd>type hello.lua local function hello() print("Hello!") end return {hello=hello} C:\Code\lua\testcwd>type use_hello.lua hello = require("hello") hello.hello() C:\Code\lua\testcwd>type use_hello2.lua -- Util needed by requireLocal() local function get_directory_path(sep) local file_path = debug.getinfo(2, "S").source:sub(2) local dir_path = file_path:match("(.*" .. sep .. ")") if not dir_path then dir_path = "." .. sep end return dir_path end -- Enables calling require for current working directory local function requireLocal() local separator = package.config:sub(1,1) local dir_path = get_directory_path(separator) package.path = package.path .. ";" .. dir_path .. "?.lua" end requireLocal() hello = require("hello") hello.hello() C:\Code\lua\testcwd>lua54 use_hello.lua lua54: use_hello.lua:1: module 'hello' not found: no field package.preload['hello'] no file 'C:\lua\systree\share\lua\5.4\hello.lua' no file 'C:\lua\systree\share\lua\5.4\hello\init.lua' no file 'C:\lua\systree\lib\lua\5.4\hello.dll' stack traceback: [C]: in function 'require' use_hello.lua:1: in main chunk [C]: in ? C:\Code\lua\testcwd>lua54 use_hello2.lua Hello! C:\Code\lua\testcwd>lua54 -v Lua 5.4.2 Copyright (C) 1994-2020 Lua.org, PUC-Rio Why is "use_hello.lua" 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 "default". Just to load a module from the current directory, why do I need to perform this "crazy setup" of "use_hello2.lua"? Is that something that changed w…
has title: Why won't lua 5.4 load a module from the current directory by default?

http://stackoverflow.com/q/78951239
answer count: 1
has comment: http://stackoverflow.com/comment/139205723
has title: Neovim command to create print statement for Python function arguments
tagged with: neovim
has comment: http://stackoverflow.com/comment/139202723
has comment: http://stackoverflow.com/comment/139202738
has answer: http://stackoverflow.com/a/78954198
upvote count: 1
tagged with: treesitter
type: Question
downvote count: 0
tagged with: python
has body: 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. For example, take the Python function: def my_func(a: int, b: str) -> None: ... If my cursor is within the function definition and I run the command PythonPrintParams, I want to write the following to the first line of the function: print( f"a={a}, " f"b={b}" ) I want to write a Lua function that can do this using treesitter and then setup a Neovim autocommand. So far I have: local ts_utils = require('nvim-treesitter.ts_utils') local function list_fn_params() local node = ts_utils.get_node_at_cursor() while node and node:type() ~= 'function_definition' do node = node:parent() end if not node then print("Could not find params, cursor not inside a function.") return end local param_nodes = node:field('parameters') if param_nodes then for i, param_node in ipairs(param_nodes) do print(" Node", i, "type:", param_node:type()) print(" Node text:", vim.inspect(ts_utils.get_node_text(param_node))) end end end vim.api.nvim_create_user_command('PythonPrintParams', function() list_fn_params() end, {}) This ends up printing: Node 1 type: parameters Node text: { "(", " a: int, b: str", ")" } 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? I did spend time with the py-tree-sitter docs https://github.com/tree-sitter/py-tree-sitter/tree/master.
score: 1
accepted answer: http://stackoverflow.com/a/78954198
favorite count: 0
tagged with: parsing
tagged with: lua
has comment: http://stackoverflow.com/comment/139202771
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/139202788

http://stackoverflow.com/q/78959804
type: Question
has comment: http://stackoverflow.com/comment/139219292
has body: Sorry it's not quite a specific question. In the "Programming in Lua, 4th edition" one can see the following code : Account = {balance = 0} function Account:new (o) o = o or {} self.__index = self setmetatable(o, self) return o end My confusion is the line self.__index = self This means that Account becomes its own __index only on creation of an instance : a = Account:new() 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 : AccountGold = Account:new({cashBackPercentage = 5}) AccountPlatinum = AccountGold:new({personalSupport = true}) but to me this Account.__index = Account looks more readable. Even more confusing. For example, look at the yui library: local Button = setmetatable({ __call = function(cls, args) return cls:new(args) end }, Widget) Button.__index = Button function Button:new(args) self = setmetatable(args, self) self.text = self.text or "" self.align = self.align or 'center' self.valign = self.valign or 'center' self.active = false if not self.notranslate then self.text = T(self.text) end return self end Look at this : self = setmetatable(args, self) which reads to : Button = setmetatable(args, Button) which means that every time new instance is created the Button table is changed. Is it like a common practice ? Could you comment on this please ?
has title: self inside Lua constructors
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/78959883
upvote count: 2
type: AnsweredQuestion
tagged with: lua
tagged with: oop
score: 1
tagged with: factory
has answer: http://stackoverflow.com/a/78959883
tagged with: constructor
downvote count: 1

http://stackoverflow.com/a/79518449
type: Answer
has body: 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. https://github.com/Spenhouet/confluence-markdown-exporter You can install it via pip: pip install confluence-markdown-exporter Set your API data as environment variable: Set ATLASSIAN_USERNAME to your Atlassian account email address (e.g. mike.meier@company.de) Set ATLASSIAN_API_TOKEN to your Atlassian token that can be created on https://id.atlassian.com/manage-profile/security/api-tokens Set ATLASSIAN_URL to your Atlassian instance URL (e.g. https://company.atlassian.net) export ATLASSIAN_USERNAME="work mail address" export ATLASSIAN_API_TOKEN="API token Test" export ATLASSIAN_URL="https://company.atlassian.net" And then you can export a single Confluence page: confluence-markdown-exporter page <page-id e.g. 645208921> Export a Confluence page and all it's descendants: confluence-markdown-exporter page-with-descendants <page-id e.g. 645208921> Export all Confluence pages of a single Space: confluence-markdown-exporter space <space-key e.g. MYSPACE> Export all Confluence pages across all spaces: confluence-markdown-exporter all-spaces I hope this might help you.
answers question: http://stackoverflow.com/q/78941149
score: 0

http://stackoverflow.com/q/78927835
tagged with: lua
tagged with: function
tagged with: world-of-warcraft
answer count: 0
has body: 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 -- Create the frame for handling events local frame = CreateFrame("Frame") -- Function to handle item tooltip display and upgrade cost local function OnTooltipSetItem(tooltip) local name, link = tooltip:GetItem() if not link then return end -- Print the item link for debugging print("Item Link:", link) -- Extract and print the item ID local itemID = tonumber(string.match(link, "item:(%d+)")) if not itemID then print("Failed to extract ItemID") return end print("Item ID:", itemID) -- Attempt to create an ItemLocation object using bag and slot information local itemLocation for bag = 0, NUM_BAG_SLOTS do for slot = 1, C_Container.GetContainerNumSlots(bag) do local slotItemID = C_Container.GetContainerItemID(bag, slot) if slotItemID == itemID then itemLocation = ItemLocation:CreateFromBagAndSlot(bag, slot) break end end if itemLocation then break end end if itemLocation then if itemLocation:IsValid() then print("Item Location is valid") local bag, slot = itemLocation:GetBagAndSlot() print("Bag:", bag, "Slot:", slot) else print("Item Location is not valid") end else print("ItemLocation object is nil") end -- Debug output for equipped items if itemLocation and itemLocation:IsValid() then if itemLocation:GetType() == "BAG" then local bag, slot = itemLocation:GetBagAndSlot() print("Bag:", bag, "Slot:", slot) elseif itemLocation:GetType() == "EQUIPMENT" then local equipmentSlot = itemLocation:GetEquipmentSlot() print("Equipment Slot:", equipmentSlot) end end -- If not found in bags, check equipped items if not itemLocation then for slot = 1, 19 do -- 19 equipment slots local slotItemID = GetInventoryItemID("player", slot) i…
type: Question
upvote count: 1
has title: (WoW Addon) Trying to display item upgrade costs in tooltip
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0

http://stackoverflow.com/a/78975215
has comment: http://stackoverflow.com/comment/139247839
has comment: http://stackoverflow.com/comment/139247672
answers question: http://stackoverflow.com/q/78974887
has body: If you mean that the names of the fields in the second table are taken from the first table, then so: --directory local dir = { [1] = "File", [2] = "Documents", [3] = "txt_Page", } --Table for directory local t= { Files = { File = { Documents = { txt_Page = "new" } } } } print (t.Files[dir[1]][dir[2]][dir[3]]t) out: new
score: 0
type: Answer

http://stackoverflow.com/comment/139304554
type: AnswerComment
type: Comment
has text: Amazing, this has worked and I have learned about `vim.api.nvim_buf_set_lines` thanks.
comment on: http://stackoverflow.com/a/79004096
score: 0

http://stackoverflow.com/comment/139375069
score: 0
comment on: http://stackoverflow.com/a/79038597
type: AnswerComment
type: Comment
has text: Did it help your issue?

http://stackoverflow.com/a/78945854
score: 1
has body: As @luther has said, Lua tables are not sorted. However, they can be iterated in a required order, including by key ascending. To do so, you need to reload the pairs() function for the dictionary, by defining __pairs metamethod. --This function will convert the simple table tbl into a table that pairs() will iterate in the order of its keys ascending. The table will preserve its qualities after adding or removing items. -- local function sorted_by_key (tbl) return setmetatable (tbl, { __pairs = function (t) local keys = {} --Get the keys of t and sort them. We cannot use for key, _ in pairs (t), as it is reloaded and we would start an infinite recursion. -- key, _ = next (t) while key do keys [#keys + 1] = key key, _ = next (t, key) end table.sort (keys) local key = 0 -- this counter will be incremented by pairs. return function () key = key + 1 return keys [key], t [keys [key]] end end }) end print 'Initial dic:' local dic = sorted_by_key { [1] = 'foo', [25] = 'bar', [-30] = 'negative', [100] = 'very positive', [-100] = 'very negative' } for key, value in pairs (dic) do print (key, value) end print 'With an added item at key 50:' dic [50] = 'moderately positive' for key, value in pairs (dic) do print (key, value) end print 'With a removed item at key 25:' dic [25] = nil for key, value in pairs (dic) do print (key, value) end
type: Answer
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/78931550

http://stackoverflow.com/q/78912520
tagged with: luau
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/139165082
tagged with: lua
has comment: http://stackoverflow.com/comment/139186868
tagged with: roblox
has comment: http://stackoverflow.com/comment/139185129
score: 0
has body: I've been making a ragdoll system but there's a weird bug where when you try to unragdoll it just ragdolls again. The game is open-source so heres the link to it: https://www.roblox.com/games/18787710805/Ragdoll-Physics-OPEN-SOURCE I think the problem is the events but I have no clue how to fix that. I tryed making the system Client sided so it wouldn't have to use Events. But that didn't work... Heres the code to the Server Script: local Event = game.ReplicatedStorage:FindFirstChild('Ragdoll') local IsRag = false local IsStudio = false local plr = nil local cooldown = 3 local CanRagDoll = true if game:GetService('RunService'):IsStudio() then IsStudio = true print('User in studio') else IsStudio = false print('User not in studio') end local UserInputService = game:GetService('UserInputService') function Ragdoll(Player, Character) for i,joint in pairs(Character:GetDescendants()) do if joint ~= nil and joint:IsA('Motor6D') then print('Found Joint.') Character:FindFirstChildOfClass('Humanoid').PlatformStand = true task.wait(0.01) for i,v in pairs(workspace:GetDescendants()) do if v:IsA('Folder') and v ~= nil then if v.Name == 'HitBoxes'..Player.name then for i,j in pairs(v:GetChildren()) do if j:IsA('Part') and j ~= nil then j.CanCollide = true end end end end end local socket = Instance.new('BallSocketConstraint') local a1 = Instance.new('Attachment') local a2 = Instance.new('Attachment') a1.Position = joint.C0.Position a2.Position = joint.C1.Position a1.Name = 'RagdollAttachment' a2.Name = 'RagdollAttachment' socket.Parent = joint.Parent socket.Attachment0 = a1 socket.Attachment1 = a2 socket.LimitsEnabled = true socket.TwistLimitsEnabled = true a1.Parent = joint.Part0 a2.Parent = joint.Part1 joint.Enabled = false end end end function UnRagDoll(Player, Character) Character:FindFirstChildOfClass('Humanoid').PlatformStand = false for i,joint in pairs(Character:GetDescendants()) do if joint ~= nil and joint:IsA('Motor6D') then joint.Enabled = true for i,v in pairs(worksp…
has title: Ragdoll System I made not working correctly
type: Question

http://stackoverflow.com/comment/139165082
score: 0
type: Comment
comment on: http://stackoverflow.com/q/78912520
has text: 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`?
type: QuestionComment

http://stackoverflow.com/comment/139219292
type: QuestionComment
comment on: http://stackoverflow.com/q/78959804
has text: Those who votes for closing -- could you please tell why as I can't see the reasons you've chosen.
type: Comment
score: 0

http://stackoverflow.com/a/79041376
has body: Infinite spawnselection Yield Workspace.cameras.spawnselection 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. I removed all the references to Workspace.cameras.spawnselection and replaced them with Workspace.cameras which is a valid location. I chose this since there are instances which the :WaitForChild(). The corrected version is this but it still has an error in it: local starting_camera=cameras:WaitForChild("default camera") local hillcrest_camera=cameras:WaitForChild("Hillcrest") Infinite default camera Yield The next error is for default camera. There are no instances named default camera or default_camera in the workspace and no scripts create it so, like before, yielding to it will cause an infinite yield error. I noticed there was a Part named start_camera in Workspace.cameras which is likely what you wanted to use, given the variable name. local starting_camera=cameras:WaitForChild("start_camera") Instance Streaming I noticed another issue with Instance Streaming causing the parts the script uses to be streamed out. They are two fixes for this. Adding to your script to request area streaming for the parts Ensure the player spawns close enough to the parts to be within the StreamingMinRadius so they are always loaded Disable Instance Streaming by setting Workspace.StreamingEnabled to false Conclusions Your script specified the incorrect locations for Parts and the Parts were being streamed out. These caused the errors you would be experiencing. Your final fixed script would be this: --Local Script local TweenService=game:GetService("TweenService") local camera=game.Workspace.Camera local cameras=game.Workspace:WaitForChild("cameras") local play=script.Parent["main menu"]["main frame"].PlayButton --Camera Locations local starting_camera=cameras:WaitForChild("start_camera") local hillcrest_camera=cameras:WaitForChild("Hillcrest") local function createtween(end_:C…
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79025911
has comment: http://stackoverflow.com/comment/139369017
answers question: http://stackoverflow.com/q/79025911

upvalue
type: Tag
tag name: upvalue
tags question: http://stackoverflow.com/q/78950971

http://stackoverflow.com/comment/139348809
score: 0
type: Comment
has text: 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. calculate 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
comment on: http://stackoverflow.com/q/79029505
type: QuestionComment

http://stackoverflow.com/q/79064655
answer count: 1
has body: 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 part.Position.Y value to that of the part i want it to copy off; and i used this script: while true do script.Parent.TornadoDamage.Position=Vector3.new(script.Parent.TornadoDamage.Position.X,script.Parent.Position.Y,script.Parent.TornadoDamage.Position.Z) How can i use constraints, scripts or settings to keep the part from falling so I can use the touch event?
score: 0
tagged with: roblox
has title: How to get the touched event of an anchored part?
type: Question
type: UnansweredQuestion
tagged with: lua
has answer: http://stackoverflow.com/a/79068688

http://stackoverflow.com/comment/139378950
has text: 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?
score: 0
comment on: http://stackoverflow.com/q/79040796
type: QuestionComment
type: Comment

http://stackoverflow.com/q/79059982
has answer: http://stackoverflow.com/a/79061220
type: UnansweredQuestion
downvote count: 0
favorite count: 0
has title: How to "require" a LUA script within a Spoon-package?
upvote count: 2
tagged with: autoload
score: 2
answer count: 2
tagged with: lua
tagged with: hammerspoon
tagged with: require
has answer: http://stackoverflow.com/a/79104868
type: Question
has body: We have base LUA file ~/.hammerspoon/init.lua which can load a spoon package: hs.loadSpoon("Foo") Now we have our package file init.lua by path: ~/.hammerspoon/Spoons/Foo.Spoon/init.lua It works fine. I create a file my/bar.lua inside this package. Full path: `~/.hammerspoon/Spoons/Foo.Spoon/my/bar.lua` with code: return {} and it should be included in ~/.hammerspoon/Spoons/Foo.Spoon/init.lua: local bar = require("Foo.Spoon.my.bar") We will see similar error: Error loading Foo:..poon.app/Contents/Resources/extensions/hs/_coresetup.lua:662: module 'Foo.Spoon/my/bar' not found: no field package.preload['Foo.Spoon/my/bar'] no file '/Users/me/.hammerspoon/Foo/Spoon/my/bar.lua' no file '/Users/me/.hammerspoon/Foo/Spoon/my/bar/init.lua' no file /Users/me/.hammerspoon/Spoons/Foo/Spoon/my/bar.spoon/init.luat26: no file opt/homebrew/share/lua/5.4/Foo/Spoon/my/bar.lua' ... I played with various options like require("my.bar") require("Foo.my.bar") all of them fail. Problem In case of using require("Foo.Spoon.my.bar"), it looks like the loader the loader always replaces "." with "/" which breaks options to mention the package folder Foo.Spoon. But it suppose to keep "Foo.Spoon" instead of "Foo/Spoon". And it does not: no file '/Users/me/.hammerspoon/Foo/Spoon/my/bar.lua' no file According to logs it obviously walks around, but does not look at the Foo.Spoon directory (tried .spoon it in lowercase too), which is strange. Any advice/workaround (but without changing "require" function, or using absolute paths)?.. P.S. I took a look at related other posts.

http://stackoverflow.com/comment/139286415
comment on: http://stackoverflow.com/q/78996339
type: Comment
score: 3
has text: 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.
type: QuestionComment

http://stackoverflow.com/a/78934473
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/78929050
answers question: http://stackoverflow.com/q/78929050
type: Answer
has comment: http://stackoverflow.com/comment/139669121
has comment: http://stackoverflow.com/comment/139603293
has body: Let's start with Span elements, because everything is easier there. To get bold text, it's enough to wrap the content with pandoc.Strong – pandoc calls bold text "strongly emphasized". function Span (span) if span.classes:includes 'answer' then return show_answers and pandoc.Strong(span.content) or {} end end The code to add ANSWER: was almost correct, it just wraps the result in too many curly braces. Removing the extra braces should work: function Span (span) if span.classes:includes 'answer' then return show_answers and pandoc.Strong({"ANSWER: "} .. span.content) or {} end end 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 ANSWER string becomes more difficult. We solve the first issue by using a "local" filter on all answer elements and then apply it with :walk: local make_bold = function (element) element.content = {pandoc.Strong(element.content)} return element end function Div (div) if div.classes:includes 'answer' then return show_answers and div.content:walk{Plain = make_bold, Para = make_bold} or {} end end And now finally, some code to prepend a string to a list of blocks. It can be used in the Div filter function: local function prepend_string (str, blks) -- Check if we can add the string to the contents of the first element if blks[1] and pandoc.utils.type(blks[1].content) == "Inlines" then blks[1].content:insert(1, str) return blks else -- otherwise we add a new `Plain` element with the string return {pandoc.Plain{str}} .. blks end end
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/139600848
downvote count: 0

http://stackoverflow.com/comment/139232676
score: 0
has text: 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'
comment on: http://stackoverflow.com/a/78954198
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/139148695
type: Comment
score: 0
has text: That's not a Lua error btw.
type: QuestionComment
comment on: http://stackoverflow.com/q/78919595

http://stackoverflow.com/q/79029505
tagged with: roblox-studio
has title: Armor takes up durability when regening health
score: 0
has comment: http://stackoverflow.com/comment/139353215
tagged with: roblox
type: Question
type: UnansweredQuestion
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139348809
has body: 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? Here is the armor script: local armor = script.Parent repeat wait() until armor.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(armor.Parent) local dura = armor.Durability.Value local max = armor.Max.Value local damageReduction = 4 local regening = false player.Character:FindFirstChild("Humanoid").HealthChanged:Connect(function() if dura > 0 and not regening then regening = true local dmgRecieved = player.Character:FindFirstChild("Humanoid").Health - player.Character:FindFirstChild("Humanoid").MaxHealth print(math.abs(math.floor(dmgRecieved))) armor.ArmorHitSFX:Play() dura -= 1 player.Character:FindFirstChild("Humanoid").Health += dmgRecieved/damageReduction wait(0.01) regening = false else armor:Destroy() end end)` And here is the tool activation: local armor = script.Parent repeat wait() until armor.Parent:FindFirstChild("Humanoid") local player = game.Players:GetPlayerFromCharacter(armor.Parent) armor.Activated:Connect(function() player.PlayerGui.Stats.ArmorBackground.Visible = true local weld = Instance.new("WeldConstraint",armor.Handle) weld.Part0 = armor.Handle weld.Part1 = armor.Parent.Torso armor.Handle.Parent = player.Character armor:Destroy() end) 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?

http://stackoverflow.com/q/78985612
downvote count: 0
has comment: http://stackoverflow.com/comment/139267586
tagged with: python
has comment: http://stackoverflow.com/comment/139267507
score: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78989633
tagged with: arrays
answer count: 2
tagged with: lua
has answer: http://stackoverflow.com/a/78988659
upvote count: 1
has body: In numpy any ndarray 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: import numpy as np a = np.zeros((5,4,3,2)) def ivalue(index): return (index[0]-index[3])/(index[1]+index[2]+1) for index, _ in np.ndenumerate(a): a[index] = ivalue(index) index = (0,3,2,1) print(a[index]) // -1/6 In lua it is relatively easy to construct the same array. For example a = {} for i=1, 5 do a[i] = {} for j=1, 4 do a[i][j] = {} for k=1, 3 do a[i][j][k] = {} for l=1, 2 do a[i][j][k][l] = (i-l)/(j+k-1) end end end end io.write(a[1][4][3][2]) -- -1/6 But now suppose we had to write a program where given the indices we want to return a value; in numpy this is straightforward since (as long as index matches the array structure) we can write a[index] and we are done. But in lua I cannot think of a way where given index={1,4,3,2} I could retrieve the value stored. Native python has the same issue so I was thinking perhaps there is an extension of lua that deals with multidimensional array indices.
has comment: http://stackoverflow.com/comment/139267361
has title: Analogue of numpy indices for lua multidimensional array
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/139267512
accepted answer: http://stackoverflow.com/a/78988659
tagged with: numpy
possible better answer: http://stackoverflow.com/a/78989633

http://stackoverflow.com/comment/139271066
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78987682
has text: @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.
type: Comment

http://stackoverflow.com/q/78914037
has body: I'm new to Lua Script. I'm trying to connect MSSQL DB using lua-odbc https://github.com/moteus/lua-odbc I'm able to connect and get data from MSSQL using below code --print("ODBC Connectivity started") odbc = require "odbc" cjson = require "cjson" dbassert = odbc.assert -- Dynamic Input from USER local tableName = "dbo.Table1"; local selectFields = "Field1,Field2"; local limit = "10" local condition = ""; cnn = odbc.connect('DBNAME', 'USERNAME', 'PASSWORD') local sqlQuery = 'SELECT TOP '.. limit .. ' ' .. selectFields .. ' FROM '.. tableName; print(sqlQuery) stmt = cnn:execute(sqlQuery) print(getmetatable(stmt)) local myTable = {}; stmt:foreach(function(f1,f2) local valueArray = {}; valueArray.f1= f1; valueArray.f2= f2; table.insert(myTable,valueArray); end) local json_str = cjson.encode(myTable); --print(json_str) assert(stmt:closed()) -- foreach close cursor assert(not stmt:destroyed()) -- statement valid Is there a way to dynamically handle UserData returned from cnn:execute For example : If user wants to include field3 how can I include field3 in my table while iterating UserData
type: Question
has comment: http://stackoverflow.com/comment/139193352
score: 0
tagged with: lua
type: UnansweredQuestion
answer count: 0
has title: How to handle ODBC UserData in Lua

http://stackoverflow.com/q/79009035
has comment: http://stackoverflow.com/comment/139310069
has body: I want to make a script and an error like this appears, can anyone help? Tester=gg.getRangesList('libil2cpp.so')[2].start` attempt to index ? (a nil value) with key 'start' (field '2') level = 1, const = 30, proto = 0, upval = 1, vars = 4, code = 79 GETTABLE v0 v0 "start" ; PC 36 CODE 00434007 OP 7 A 0 B 0 C 269 Bx 269 sBx -130802 My script: function money1() gg.setVisible(false) gg.alert ("CLICK LEVEL 3 THEN CLICK ON THE GG LOGO TO START") gg.clearResults() gg.clearList() while true do if gg.isVisible() then break else gg.sleep(50) end end gg.setVisible(false) gg.clearResults() Tester=gg.getRangesList('libil2cpp.so')[2].start Lua=0x5D28E08 setvalue(Tester+Lua,16,1917191729192019001910) gg.setRanges(32) gg.searchNumber("40", 16) gg.getResults(9999) gg.editAll("50000000", 16) gg.alert ("CLICK LEVEL 1") gg.toast("ON") gg.clearResults() gg.clearList() end Game guardian & Lua script.
score: -1
tagged with: lua
downvote count: 1
type: Question
has title: attempt to index ? (a nil value) with key 'start' (field '2') in game guardian script
answer count: 1
type: UnansweredQuestion
favorite count: 0
has answer: http://stackoverflow.com/a/79013273
upvote count: 0

http://stackoverflow.com/a/79136450
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79012369
answers question: http://stackoverflow.com/q/79012369
has body: You can store the previous YouTube subscriber count before it is updated, and write the difference in a TextLabel. Changes: ... 22 lines skipped ... + local oldSubscriberCount = 0 ... 9 lines skipped ... + local subscriberCountDifference = subscriberCount - oldSubscriberCount + local message = (subscriberCountDifference < 0 and "-" or "+") .. " subscribers" + -- Use the message variable to set the TextLabel of your choice + oldSubscriberCount = subscriberCount ... 19 lines skipped ... Modified code: local HttpService = game:GetService("HttpService") local API_KEY = "SECRET" -- Replace with your API key local CHANNEL_ID = "UCA4yZCVHlHZVknfesTU3XOg" -- Replace with your channel ID local fonts = { Enum.Font.Arcade, Enum.Font.Arial, Enum.Font.ArialBold, Enum.Font.Bangers, Enum.Font.Bodoni, Enum.Font.Cartoon, Enum.Font.Code, Enum.Font.Creepster, Enum.Font.DenkOne, Enum.Font.Fantasy, Enum.Font.Fondamento, Enum.Font.FredokaOne, Enum.Font.Garamond, Enum.Font.Gotham, Enum.Font.GothamBlack, } local oldSubscriberCount = 0 local function getChannelStats() print("SENDING REQUEST") local success, result = pcall(function() local url = string.format("https://www.googleapis.com/youtube/v3/channels?part=statistics&id=%s&key=%s", CHANNEL_ID, API_KEY) local response = HttpService:GetAsync(url) local data = HttpService:JSONDecode(response) local subscriberCount = data.items[1].statistics.subscriberCount local subscriberCountDifference = subscriberCount - oldSubscriberCount local message = (subscriberCountDifference < 0 and "-" or "+") .. " subscribers" -- Use the message variable to set the TextLabel of your choice oldSubscriberCount = subscriberCount --script.Parent.Text = "Inscritos: " .. subscriberCount script.Parent.Text = subscriberCount script.Parent.Font = fonts[math.random(1, #fonts)] end) if not success then warn("Error fetching channel data:", result) --script.Parent.Text = "Erro ao carregar dados." end end -- Call the function initially and every 10 seconds getChannelStats() …

http://stackoverflow.com/q/78958369
type: Question
has title: Lazy Loading Copilot to Neovim but not autocompleting after that
upvote count: 1
has body: I use Neovim with Lazy.nvim and I want to use GitHub Copilot 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: return { "github/copilot.vim", -- disable copilot by default lazy = true, keys = { "<leader>ce" }, config = function() vim.keymap.set("i", "<C-j>", 'copilot#Accept("\\<CR>")', { expr = true, replace_keycodes = false, }) vim.keymap.set("n", "<leader>cd", ":Copilot disable <CR>", {}) vim.keymap.set("n", "<leader>ce", ":Copilot enable <CR>", {}) end, } It works, it is not loaded until I press ce, but I do not receive autocompletion after that, I can acces :Copilot <command>, but this does not autocomplete my text/code, any idea why? 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 :Copilot setup to use it but before lazy loading it I did't need to do it? return { "github/copilot.vim", -- disable copilot by default lazy = true, keys = { "<leader>ce" }, config = function() vim.cmd("Copilot setup") -- Line I added vim.keymap.set("i", "<C-j>", 'copilot#Accept("\\<CR>")', { expr = true, replace_keycodes = false, }) vim.keymap.set("n", "<leader>cd", ":Copilot disable <CR>", {}) vim.keymap.set("n", "<leader>ce", ":Copilot enable <CR>", {}) end, } By the way, here is my complete config file.
has comment: http://stackoverflow.com/comment/139894399
favorite count: 0
tagged with: neovim-plugin
type: UnansweredQuestion
tagged with: neovim
downvote count: 0
tagged with: lazy-loading
answer count: 0
score: 1
tagged with: lua
tagged with: github-copilot

http://stackoverflow.com/q/79021308
favorite count: 0
score: 0
type: UnansweredQuestion
tagged with: neovim
tagged with: nvim-lspconfig
has answer: http://stackoverflow.com/a/79089240
upvote count: 1
has body: 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. My problem is that when I copy the nvim-cmp config from https://github.com/hrsh7th/nvim-cmp it does not work. It says: Error loading lua [string ":lua"]. I thing that maybe I need some lua files in config. Right now I have got just init.vim in .config/nvim/. But I didn't find an explanation of how to set it up. I also don't know what I should put in ['YOUR_LSP_SERVER'] in nvim-cmp config (the one on the github page). Can somebody explain? Do you adwise me to use different autocompletion plugin like coc?
has title: How to configure nvim-cmp for autocompletion
tagged with: lua
has comment: http://stackoverflow.com/comment/139339912
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/139331997
answer count: 1
has comment: http://stackoverflow.com/comment/139334664

http://stackoverflow.com/comment/139180750
score: 0
type: QuestionComment
has text: @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`).
type: Comment
comment on: http://stackoverflow.com/q/78938722

http://stackoverflow.com/q/78935797
tagged with: lua
type: Question
tagged with: fltk
has title: MurgaLua 0.7.5 and use of fltk function saveAsPng()
has comment: http://stackoverflow.com/comment/139218865
accepted answer: http://stackoverflow.com/a/79057545
has comment: http://stackoverflow.com/comment/139218749
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/139178902
answer count: 1
has answer: http://stackoverflow.com/a/79057545
has comment: http://stackoverflow.com/comment/139178804
score: 0
has body: 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 "core dumped" message, or only the last diagram is saved, or, and this is the current solution, a fltk "modal window" 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: https://open-data-assurance-maladie.ameli.fr/medicaments/download_file2.php?file=Open_MEDIC_Base_Complete/OPEN_MEDIC_2023.zip And the complete murgaLua code is here https://github.com/mterras01/murgaLua/blob/main/statsoncsv_next2.lua Following function is fully working function read_Image() pwindow:make_current() Fl:check() Fl:flush() imageString = fltk.fl_read_image(0, 0, width_pwindow, height_pwindow) Fl:check() Fl:flush() image2 = fltk:Fl_RGB_Image(imageString, width_pwindow, height_pwindow, 3, 0) Fl:check() Fl:flush() fileName = title .. ".png" image2:saveAsPng(fileName) end It is called from a for-loop (successive images). (I know murgaLua is an old language (i'm 59 old) written by John de Murga). i successfully can save all my charts with Fl:check() pwindow:show() pwindow:redraw() Fl:flush() pwindow:set_modal() if fltk:fl_choice("Save Charts or not ?", "No", "Yes", nil) == 1 then read_Image() end pwindow:set_non_modal() but have to click each time to save. Not the good way to build a 500 images report.
has comment: http://stackoverflow.com/comment/139178895
has comment: http://stackoverflow.com/comment/139218733

http://stackoverflow.com/a/78932894
has body: Lua table keys are not stored in any particular order. When you iterate a table with pairs, you see the contents in whatever order the interpreter finds convenient. Sequences are implemented by using consecutive integer keys starting at 1 and going up. Your dic table has a [1] key but no [2], so table.sort and ipairs basically just see it as a 1-element sequence. Sorting works by changing which keys point to which elements. You have basically 2 choices: Keep it like it is, so you can refer to things by their current key. Add your current keys to their corresponding tables, so you can use normal sequence keys and keep the tables in a specific order. 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.
type: Answer
score: 4
downvote count: 0
answers question: http://stackoverflow.com/q/78931550
upvote count: 4

http://stackoverflow.com/q/79021129
downvote count: 1
has title: How can I deal with Lua garbage-collecting my userdata objects?
duplicate of: http://stackoverflow.com/q/66807244
upvote count: 1
tagged with: luajit
tagged with: garbage-collection
has body: When making a Lua API for C code, I have made a function Thing that constructs a Lua userdata that returns a userdata for a C struct also called Thing.I also have a function List that returns a Lua userdata for a C struct called List, which contains C pointers for Thing objects. If I have a Lua script: local list = List() local thing = Thing() list:add(thing) thing:setField(123) return function() list:do_something() end and then, in my C code, I repeatedly lua_pcall the returned function, Lua's garbage collector will delete Thing. However, my list's C struct contains a pointer to thing, so thing should not be garbage-collected. What would be the best way for me to be able to tell Lua to not garbage-collect thing? Would it be to (a) make list:add(thing) add a duplicate of thing, and not a pointer to thing itself? However, this would make the code a bit less convenient, since if thing was modified after list:add(thing), then list would not be changed. Or would a better approach be to (b) make a wrapper function around Thing() like this: function NewThing() local ret = { userdata: Thing(), dependencies: {} } function ret:add(thing) self.userdata:add(thing) dependencies[#dependencies+1] = thing end end 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.
score: 0
type: Question
linked to: http://stackoverflow.com/q/66807244
type: UnansweredQuestion
tagged with: c++
favorite count: 0
answer count: 0
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/139340032
tagged with: lua

http://stackoverflow.com/comment/139734509
type: QuestionComment
score: 0
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/79010976

http://stackoverflow.com/q/79040796
score: 0
type: Question
has comment: http://stackoverflow.com/comment/139382155
type: UnansweredQuestion
tagged with: roblox
has comment: http://stackoverflow.com/comment/139382180
answer count: 0
has comment: http://stackoverflow.com/comment/139378950
has title: Not getting past the If statement
has body: 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 print("Got past if statement") is where the promblem is and the problem is the if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end Remotes local replicatedStorage = game:GetService("ReplicatedStorage") local remoteData = game:GetService("ServerStorage"):WaitForChild("RemoteData") local cooldown = 1 replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player) print("FIRED") if not remoteData:FindFirstChild(player.Name) then return "NoFolder" end print("Got past IF statement") local debounce = remoteData[player.Name].Debounce if not debounce.Value then debounce.Value = true player.leaderstats.Strength.Value = player.leaderstats.Strength.Value + 1 * (player.leaderstats.Rebirths.Value + 1) wait(cooldown) debounce.Value = false end end) stats game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Wait() local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player local Strength = Instance.new("NumberValue") Strength.Name = "Strength" Strength.Parent = leaderstats local Rebirths = Instance.new("IntValue") Rebirths.Name = "Rebirths" Rebirths.Parent = leaderstats local dataFolder = Instance.new("Folder") dataFolder.Name = "dataFolder" dataFolder.Parent = serverStorage.RemoteData local debounce = Instance.new("BoolValue") debounce.Name = "Debounce" debounce.Parent = dataFolder module local module = {} local replicatedStorage = game:GetService("ReplicatedStorage") function module.Lift() replicatedStorage.Remotes.Lift:FireServer() end return module local script local module = require(script.Parent:WaitForChild("ModuleScript")) local player = game.Players.LocalPlayer local mouse = player:GetMouse() script.Parent.Activated:Connect(function() module.Lift() end)` expecting it to get past the if statement and tried changing a couple of things
tagged with: lua
tagged with: roblox-studio

http://stackoverflow.com/q/79002050
favorite count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/79004096
has body: New to lua. I would like to create an autocmd 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 Date: * and change it to Date: strftime("%Y/%M/%d"). I have been looking at the link and more specifically in the following :autocmd BufWritePre,FileWritePre *.html ks|call LastMod()|'s :fun LastMod() : if line("$") > 20 : let l = 20 : else : let l = line("$") : endif : exe "1," .. l .. "g/Last modified: /s/Last modified: .*/Last modified: " .. : \ strftime("%Y %b %d") :endfun But I would like to do that in lua. Would that be possible?
type: AnsweredQuestion
answer count: 1
has title: Neovim autocommand to add current date in markdown files using lua
tagged with: neovim
accepted answer: http://stackoverflow.com/a/79004096
type: Question
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/q/78983963
type: Question
has comment: http://stackoverflow.com/comment/139264717
has answer: http://stackoverflow.com/a/78984391
has comment: http://stackoverflow.com/comment/139263662
has answer: http://stackoverflow.com/a/78984628
has title: C++ accessing global variables in a lua_State
tagged with: lua
has comment: http://stackoverflow.com/comment/139263663
type: UnansweredQuestion
tagged with: serialization
score: 0
answer count: 2
tagged with: language-implementation
has body: I am currently building a program that lets me implement Lua scripts. I want to get into serialization of those scripts, by accessing only the global variable of a lua_State by name and by value. My Lua script looks like this: TESTVALUE1 = 10 --TESTVALUE2 = 5.5 --TESTVALUE3 = "TEST" --TESTVALUE4 = {hallo=5, x=5.4, y="y", t={5, 8}} function Setup(object) -- Setup is executed once the GameObject is completely loaded the associated object is given to store in a global if needed end function Update(deltatime) -- deltatime is the frametime end function Render() -- Called every frame, put your render functions inside! end And my serialization in C++ looks like this: void serialize(std::ofstream &file) { if (file.is_open() && file.good()) { // Writing script name and path to the file file.write((char *)&path, sizeof(path)); file.write((char *)&name, sizeof(name)); lua_pushglobaltable(L); lua_pushnil(L); while (lua_next(L, -2) != 0) { char value_type = 0; std::string name = lua_tostring(L, -2); lua_getglobal(L, name.c_str()); if (lua_isfunction(L, -1)) { lua_pop(L, 2); continue; } if (lua_isinteger(L, -1)) { file.write((char *)&name, sizeof(name)); int val = lua_tointeger(L, -1); value_type = 1; file.write((char *)&value_type, sizeof(value_type)); file.write((char *)&val, sizeof(val)); } else if (lua_isnumber(L, -1)) { file.write((char *)&name, sizeof(name)); float val = lua_tonumber(L, -1); value_type = 2; file.write((char *)&value_type, sizeof(value_type)); file.write((char *)&val, sizeof(val)); } else if (lua_isstring(L, -1)) { file.write((char *)&name, sizeof(name)); std::string val = lua_tostring(L, -1); value_type = 3; file.write((char *)&value_type, sizeof(value_type)); file.write((char *)&val, sizeof(val)); } else if (lua_istable(L, -1)) { file.write((char *)&name, sizeof(name)); value_type = 4; file.write((char *)&value_type, sizeof(value_type)); int top = lua_gettop(L); serializetable(file, top); } else { file.write((char *)&name, sizeof(name)); file.write((char *…
tagged with: c++

http://stackoverflow.com/comment/139193364
type: QuestionComment
comment on: http://stackoverflow.com/q/78911624
type: Comment
has text: Try `local is_math_mode = require 'nvim.snippets.math-util'`.
score: 0

http://stackoverflow.com/comment/139575472
type: AnswerComment
type: Comment
score: 0
has text: 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 This works for me with WezTerm.
comment on: http://stackoverflow.com/a/79141374

http://stackoverflow.com/q/79025911
answer count: 1
has comment: http://stackoverflow.com/comment/139358437
favorite count: 0
has comment: http://stackoverflow.com/comment/139358740
type: Question
accepted answer: http://stackoverflow.com/a/79041376
has comment: http://stackoverflow.com/comment/139362095
has body: I have a Tween service that moves the camera between two parts. However using a direct call such as game.Workspace.cameras.spawnselection.default_camera to get the parts fails. Here is my code: --Local Script local TweenService=game:GetService("TweenService") local camera=game.Workspace.Camera local cameras=game.Workspace:WaitForChild("cameras") local play=script.Parent["main menu"]["main frame"].PlayButton --Camera Locations local starting_camera=cameras:WaitForChild("spawnselection"):WaitForChild("default camera") local hillcrest_camera=cameras.spawnselection:WaitForChild(""):WaitForChild("Hillcrest") local function createtween(end_:CFrame,time_:number) local cutscene=TweenService:Create(camera,TweenInfo.new(time_),{CFrame=end_}) return cutscene end play.Activated:Connect(function() camera.CameraType=Enum.CameraType.Scriptable local selection local canswitch=true local cutscene=createtween(hillcrest_camera.CFrame,10) if canswitch then camera.CFrame=starting_camera.CFrame cutscene:Play() canswitch=false end cutscene.Completed:Connect(function() canswitch=true end) end) I tried using a ':WaitForChild' method, but this obviously doesn't work, due to the warning: Infinite yield possible on 'Workspace.cameras.spawnselection:WaitForChild("default camera"). I was expecting this to work first-try. I then ran a server script to get the Parents 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 LocalScript. 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 place. The problomatic file is in StarterGUI and the LocalScripts' name is SpawnSelection.
tagged with: roblox
has title: Part can't be found by local script in Roblox
downvote count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79041376
tagged with: lua
upvote count: 3
tagged with: scripting
score: 3

http://stackoverflow.com/q/78985787
has comment: http://stackoverflow.com/comment/139273565
score: 0
has title: Finding the full path of the library loaded by LuaJIT `ffi.load`
has body: I am using LuaJIT to open a BLAS library on macOS -- load.lua local ffi = require("ffi") local blas = ffi.load("blas") I can call procedures like blas.cblas_dgemm and get the correct result, but there are multiple implementations for BLAS. In 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. The blas variable returned by ffi.load is a userdata, so I'm not sure how to parse it. I also tried using dtruss, since LuaJIT must stat or open the library at some point. However, all relevant system calls return -1 Err#2. $ sudo dtruss luajit load.lua 2>&1 | grep blas read_nocancel(0x3, "local ffi = require(\"ffi\")\nlocal blas = ffi.load(\"blas\")\n\0", 0x1000) = 57 0 open("libblas.dylib\0", 0x0, 0x0) = -1 Err#2 stat64("libblas.dylib\0", 0x7FF7B459B060, 0x0) = -1 Err#2 stat64("/System/Volumes/Preboot/Cryptexes/OSlibblas.dylib\0", 0x7FF7B459B020, 0x0) = -1 Err#2 How do I get the full path to the dynamic library loaded by ffi.load("blas")? As a bonus question, is the Accelerate framework on my system broken? $ file /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/libBLAS.dylib /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/libBLAS.dylib: broken symbolic link to Versions/Current/libBLAS.dylib
tagged with: lua
type: Question
type: UnansweredQuestion
answer count: 0
tagged with: macos
tagged with: luajit
tagged with: dll
tagged with: ffi

http://stackoverflow.com/a/78929652
score: 1
type: Answer
has body: For googlers from the future, here is how I solved it eventually: { mode = "n"; key = "<leader>c"; action = "gcc"; options.remap = true; } I found the answer here: https://www.reddit.com/r/neovim/comments/1d278fz/keymap_comment_nvim_010/. In case the link stops working in the distant future, here is a quote: 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 https://github.com/neovim/neovim/blob/master/runtime/lua/vim/_defaults.lua#L135.
answers question: http://stackoverflow.com/q/78926822
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/139353215
type: Comment
comment on: http://stackoverflow.com/q/79029505
type: QuestionComment
score: 0
has text: Can you provide an example of what it should look like?

http://stackoverflow.com/comment/139362095
type: QuestionComment
comment on: http://stackoverflow.com/q/79025911
score: 0
type: Comment
has text: Don't forget to change the file permissions so that anyone with a link can download it

http://stackoverflow.com/a/78925884
answers question: http://stackoverflow.com/q/78922870
score: 0
has body: Use a system like this: --Server Script directon=Vector3.new(0,0,1) part=script.parent moving=true while moving do part.Position=part.Position+direction This script checks if moving is true, then moves at a rate of 10 studs/sec along the Z axis. You can add extra logic to change the direction and the moving bool. If u want to get the mouse position in the world, use a script like this: --Local Script local mousepos=game.Players.LocalPlayer.Mouse.Hit You could then use some logic to determine the part's current position and then move it accordingly to the mouse position. Hope this helps!
type: Answer

http://stackoverflow.com/q/78941149
type: UnansweredQuestion
has title: Goal: A best fit Markdown representation of a Confluence page with tables and images using Pandoc and shell scripts
tagged with: lua
tagged with: confluence
has answer: http://stackoverflow.com/a/79518449
tagged with: pandoc
answer count: 2
score: 0
has answer: http://stackoverflow.com/a/78942762
has body: I am working to create a ci/cd pipeline for "documentation-as-code", 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-->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-->markdown step as well as LUA filters, but with no luck. Any tips will be appreciated!
type: Question

http://stackoverflow.com/q/79064409
has body: Using the sol 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? function foo(a, b, c) end The information would be: Function has 3 params Names of params are: a, b, c, in that order Optionally, would be nice if it can also tell if function accepts varargs.
score: 0
has title: Figure out function param arity and param names
type: UnansweredQuestion
tagged with: lua
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/79065496

http://stackoverflow.com/comment/139226536
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/78961688
score: 1
type: Comment

http://stackoverflow.com/comment/139301786
type: Comment
comment on: http://stackoverflow.com/q/78970599
type: QuestionComment
has text: Also what are your errors?
score: 0

http://stackoverflow.com/comment/139219242
score: 0
has text: @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`.
comment on: http://stackoverflow.com/a/78959883
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/139339988
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/79024260
type: Comment
has text: 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`

autoload
tag name: autoload
tags question: http://stackoverflow.com/q/79059982
type: Tag

http://stackoverflow.com/comment/139334477
comment on: http://stackoverflow.com/q/79012369
has text: thats not in console, thats on a TextLabel
type: QuestionComment
type: Comment
score: 0

youtube
type: Tag
tags question: http://stackoverflow.com/q/79012369
tag name: youtube

http://stackoverflow.com/a/78951467
has body: The doc to load and lua_load functions in the Lua manual mentions: load: When you load a main chunk, the resulting function will always have exactly one upvalue, the _ENV variable. lua_load: When loading main chunks, this upvalue will be the _ENV variable. In summary, the loaded chunk only has one upvalue, which is _ENV. Since Lua 5.2, SomeClass = {} is equivalent to _ENV.SomeClass = {}, and print(self) is equivalent to print(_ENV.self). Because SomeClass is set in the global scope, the loaded chunk can also see this entry in the _ENV table, but there is no place will automatically set _ENV.self. You may expect the function to work like this: function expect(self) return (function() return print(self) end)() end In fact it will work like this: function fact(self) return (function() return print(_ENV.self) end)() end For the "expect" function, the lua compiler will add self as an upvalue for you, but for the "fact" function, it will do nothing. And your C++ code completely overwritten _ENV with SomeClass, which is going too far.
accepted answer of: http://stackoverflow.com/q/78950971
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/139205946
answers question: http://stackoverflow.com/q/78950971
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/139210729

http://stackoverflow.com/q/79039651
score: 0
tagged with: fluent-bit
has body: I want to enrich my kubernetes events collected through fluent-bit kubernetes_events input. I'm using fluent-bit LUA filter for this use case and I have try two lua scripts, but neither of them worked for me. using kubectl in lua script local involvedObjectKind = record["involvedObject"]["kind"] local involvedObjectName = record["involvedObject"]["name"] local involvedObjectNamespace = record["involvedObject"]["namespace"] if involvedObjectKind == "Pod" then local command = "kubectl get pod " .. involvedObjectName .. " -n " .. involvedObjectNamespace .. " -o json" print("Executing command: " .. command) local handle = io.popen(command) if handle then local result = handle:read("*a") handle:close() local json = require('json') local pod = json.decode(result) if pod then print("Pod found: " .. pod) end else print("Failed to execute command: " .. command) end end return 1, timestamp, record This always prints Failed to execute command. using http calls in lua script local involvedObjectKind = record["involvedObject"]["kind"] local involvedObjectName = record["involvedObject"]["name"] local involvedObjectNamespace = record["involvedObject"]["namespace"] local http = require("socket.http") local ltn12 = require("ltn12") local cjson = require("cjson") if involvedObjectKind == "Pod" then -- http request to k8s API server to get pod labels local url = "https://kubernetes.default.svc/api/v1/namespaces/" .. involvedObjectNamespace .. "/pods/" .. involvedObjectName local response_body = {} local res, code, response_headers, status = http.request { url = url, method = "GET", headers = { ["Authorization"] ="Bearer " .. os.getenv("K8S_TOKEN"), ["Accept"] = "application/json", }, sink = ltn12.sink.table(response_body), create = function() local sock = require("socket").tcp() sock:connect("kubernetes.default.svc", 443) return sock end } if code == 200 then local pod = cjson.decode(table.concat(response_body)) for k, v in pairs(pod["metadata"]["labels"]) do record["labels." .. k] = …
type: Question
type: UnansweredQuestion
tagged with: kubernetes-label
has title: How to get kubernetes pod labels using fluent-bit LUA filter
tagged with: lua
tagged with: kubernetes
answer count: 0

http://stackoverflow.com/comment/139219275
score: 0
type: AnswerComment
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/78959883

http://stackoverflow.com/q/78961688
score: 0
has body: 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: local tool = script.Parent local debounce = false tool.Activated:Connect(function() if debounce == false then debounce = true local player = game:GetService"Players":GetPlayerFromCharacter(script.Parent.Parent) local character = script.Parent.Parent local foodvalue = 5 player.PlayerGui.Meters.AteFoodEvent:FireAllClients(player,foodvalue) print(foodvalue) wait(2) end debounce = false end) (The wait(2) and debounce is just to try to solve this problem, which has not worked) This seems to work just fine and the print function only prints one "foodvalue", being five. But, when I look at the script that recieves the RemoteEvent... player.PlayerGui.Meters.AteFoodEvent.OnClientEvent:Once(function(player,foodvalue) if eventDebounce == false then eventDebounce = true if hunger > foodvalue then hunger -= foodvalue elseif hunger <= foodvalue then hunger = -1 print(foodvalue) end wait(2) end eventDebounce = false end) No matter where I print the foodvalue, or wait(2), or debounce, the amount of "foodvalues" 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 usually lower, and same with a higher hunger value. I have no clue what's going on!
type: Question
type: UnansweredQuestion
has title: FireAllClients event seems to be firing a random number of times whenever ran
tagged with: lua
has comment: http://stackoverflow.com/comment/139226536
tagged with: roblox
answer count: 0

setup-factory
type: Tag
tag name: setup-factory
tags question: http://stackoverflow.com/q/78936201

http://stackoverflow.com/q/79012369
has comment: http://stackoverflow.com/comment/139321823
tagged with: lua
has answer: http://stackoverflow.com/a/79136450
type: Question
has title: How do I implement a system that shows the difference in subscribers?
answer count: 1
tagged with: roblox
has comment: http://stackoverflow.com/comment/139318521
tagged with: youtube
has comment: http://stackoverflow.com/comment/139334477
has body: 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. Is there any way I can implement this in my code? local HttpService = game:GetService("HttpService") local API_KEY = "SECRET" -- Replace with your API key local CHANNEL_ID = "UCA4yZCVHlHZVknfesTU3XOg" -- Replace with your channel ID local fonts = { Enum.Font.Arcade, Enum.Font.Arial, Enum.Font.ArialBold, Enum.Font.Bangers, Enum.Font.Bodoni, Enum.Font.Cartoon, Enum.Font.Code, Enum.Font.Creepster, Enum.Font.DenkOne, Enum.Font.Fantasy, Enum.Font.Fondamento, Enum.Font.FredokaOne, Enum.Font.Garamond, Enum.Font.Gotham, Enum.Font.GothamBlack, } local function getChannelStats() print("SENDING REQUEST") local success, result = pcall(function() local url = string.format("https://www.googleapis.com/youtube/v3/channels?part=statistics&id=%s&key=%s", CHANNEL_ID, API_KEY) local response = HttpService:GetAsync(url) local data = HttpService:JSONDecode(response) local subscriberCount = data.items[1].statistics.subscriberCount --script.Parent.Text = "Inscritos: " .. subscriberCount script.Parent.Text = subscriberCount script.Parent.Font = fonts[math.random(1, #fonts)] end) if not success then warn("Error fetching channel data:", result) --script.Parent.Text = "Erro ao carregar dados." end end -- Call the function initially and every 10 seconds getChannelStats() while true do wait(2) getChannelStats() end 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 print()
score: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/79136450
has comment: http://stackoverflow.com/comment/139334487
tagged with: youtube-api
tagged with: luau

http://stackoverflow.com/q/78974887
type: Question
has comment: http://stackoverflow.com/comment/139252337
upvote count: 1
downvote count: 0
has body: I have a table and a directory : --directory { [1] = "File" [2] = "Documents" [3] = "txt_Page" } --Table for directory { Files = { File = { Documents = { txt_Page = "new" } } } } I want to edit the txt_page through the directory and return the newly edited files table but I've tried methods and I can't seem to find it.
possible better answer: http://stackoverflow.com/a/78975215
score: 1
favorite count: 0
tagged with: lua
tagged with: dictionary
type: AnsweredQuestion
has title: Edit table data through a directory in lua
has answer: http://stackoverflow.com/a/78978267
tagged with: roblox
accepted answer: http://stackoverflow.com/a/78978267
answer count: 2
has answer: http://stackoverflow.com/a/78975215

http://stackoverflow.com/a/79069564
score: 0
accepted answer of: http://stackoverflow.com/q/79059156
has body: Lua expects the luaopen_mymodule function to follow the lua_CFunction protocol, which means: the function must have the signature int(lua_State *) noexcept, the function can get its input arguments from the Lua stack, and the return value of the function must be the number of Lua values it returns (Lua functions can return multiple values, which can be used in multiple assignments like local foo, bar = baz()), and the actual Lua values to be returned must be on the top of the Lua stack. Additionally, the function must be extern "C" so that its name is not mangled. Specifically, the luaopen_mymodule function will be called with two arguments that can usually be ignored, and will usually return a single value (typically a table) which will be passed back by the require function. This means: you can simply ignore the initial contents of the Lua stack, and luaopen_mymodule should return 1. Equipped with the necessary knowledge, we know how to implement luaopen_mymodule: Wrap the function body inside a try-catch block and handle C++ exceptions properly. Inside the function body: Construct a sol::state_view from the lua_State *. Use the sol::state_view in the same way you'd use a sol::state: call new_usertype(), create_table(), etc. Immediately before you return from luaopen_mymodule, 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). Return 1. sol allows you to manually push a value onto the Lua stack with the push method on the sol::reference class, which is also available on concrete "value" types such as sol::table since they inherit publicly from sol::reference. Here's an example that implements the foo module illustrated in /a/65660774, rewritten in C++ using sol: #include <exception> #include <sol/sol.hpp> extern "C" { // Define `FOO_LIB` as `__attribute__((visibility("default")))`, // `__declspec(dllexport)`, etc. FOO_LIB int luaopen_foo(lua_State *L) noexcep…
answers question: http://stackoverflow.com/q/79059156
type: AcceptedAnswer
type: Answer

garbage-collection
tag name: garbage-collection
tags question: http://stackoverflow.com/q/79021129
type: Tag

http://stackoverflow.com/comment/139313049
comment on: http://stackoverflow.com/q/79010976
type: QuestionComment
score: 0
has text: Please do not tag span. Have a look at [ask]
type: Comment

http://stackoverflow.com/comment/139358437
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/79025911
type: Comment
score: 0

http://stackoverflow.com/comment/139205723
type: QuestionComment
score: 0
has text: Very nice! Good points, and yes, this would just be for debugging. Could also just get better at running a debugger in neovim.
type: Comment
comment on: http://stackoverflow.com/q/78951239

http://stackoverflow.com/comment/139382180
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79040796
has text: It worked i must have been just too eager to get it done Tysm

factory
type: Tag
tag name: factory
tags question: http://stackoverflow.com/q/78959804

http://stackoverflow.com/q/78931550
has body: I'm discovering Lua (context: factorio scripting) and I'm quite puzzled by the loose typing. I'm trying to make a dictionary (int,structure) with an integer (and possibly negative key). And then sort it by that key. local dic = {} dic[1] = {t="foo"} dic[25] = {t="bar"} dic[-30] = {t="negative"} table.sort(dic) -- oddly, that changes nothing print(serpent.block(dic)) -- using ipairs() would make no sense for this structure for k,v in pairs(dic) do print(serpent.line(k) .. " --> " .. serpent.line(v)) end -- some processing that expects the array/dic/structure/thingy sorted by index and that outputs { { t = "foo" }, [-30] = { t = "negative" }, [25] = { t = "bar" } } -- sort didn't work 1 --> {t = "foo"} 25 --> {t = "bar"} -30 --> {t = "negative"} So, what am I doing wrong ? Edit: thanks to answers, I now understand that ipairs() was not the right iterator for this data type. Removesd it from code for clarity
has comment: http://stackoverflow.com/comment/139168193
accepted answer: http://stackoverflow.com/a/78939478
has answer: http://stackoverflow.com/a/78932894
upvote count: 2
has answer: http://stackoverflow.com/a/78945854
score: 2
answer count: 3
type: Question
downvote count: 0
has title: Sort array with some negative indexes
has answer: http://stackoverflow.com/a/78939478
favorite count: 0
has comment: http://stackoverflow.com/comment/139181476
tagged with: arrays
tagged with: lua
possible better answer: http://stackoverflow.com/a/78932894
type: AnsweredQuestion

memory-leaks
tags question: http://stackoverflow.com/q/79024260
type: Tag
tag name: memory-leaks

http://stackoverflow.com/comment/139600848
comment on: http://stackoverflow.com/a/78934473
type: AnswerComment
type: Comment
has text: 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?"
score: 0

http://stackoverflow.com/comment/139240284
comment on: http://stackoverflow.com/q/78970599
type: Comment
has text: Do you ever call the `onDriveSeatChanged` function? Is it connected to a Seat anywhere?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139563224
type: AnswerComment
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/79141374
score: 0

http://stackoverflow.com/comment/139358740
type: Comment
has text: @RyanLuu I've edited the post and uploaded the file.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79025911

http://stackoverflow.com/comment/139267512
type: Comment
score: 0
has text: 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)`.
type: QuestionComment
comment on: http://stackoverflow.com/q/78985612

http://stackoverflow.com/q/79024260
has body: This is my first add-on and my first Lua program. I capture the events of the combat log. In a table (db1) I store the damage of each second. db1 is limited to 50 entries. Initially the addon occupies 39 kb, but as time goes by, the memory it occupies increases (observed with GetAddOnMemoryUsage("GraphDPS")). Even by triggering a collectgarbage("collect") when the memory used reaches double the initial memory. I always end up with a freeze. Does anyone have an idea? -- ================================= VARIABLES ================================== -- -- Globals, only used when login and log out GDPS_damae = 0 GDPS_db1 = {} GDPS_db3 = {} GDPS_frgfh = 238 GDPS_frgfw = 83 GDPS_unvu = {} -- Locals local coei = nil -- combat : CombatLog Event Infos local colib = "Dernier combat" -- combat : "Dernier combat" ou combat actuel" local cosc = 0 -- combat : compteur de seconde du combat en cours local damae = 0 -- data : biggest dps ever local datalc = 0 -- data :total amount last combat local db1 = {} -- database 1 local db1l = 50 -- database 1 limit local db1le = {nil, nil} -- database : database 1 last entry local db1nv = 0 -- database : database 1 number of values local db1nvn = 0 -- database : database 1 number of values numerical local db3 = {} -- database : database 3 local evt = "" -- event : type local eva = 0 -- event : amount local evsn = "" -- event : swing or spell local fra = 0 -- frames alpha local tic = 0 -- timer : every second in combat local tmce = 0 -- timestamp : combat end (PLAYER_REGEN_ENABLED) local tmcel = 0 -- timestamp : combat end local tmdce = 0 -- timestamp : combat end delta local tmia = 0 -- timestamp : timstamp in analyse local tmiaa = 0 -- timestamp : timestamp in analyse amount local tmlcs = 0 -- timestamp : timestamp last combat start local tmoe = 0 -- timestamp : timestamp of event local tmprd = 0 -- timestamp : timestamp combat start (PLAYER_REGEN_DISABLED) local unUID = UnitGUID("player") -- units : player local unUIDe = "" -- units : of e…
type: Question
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139339988
has comment: http://stackoverflow.com/comment/139374928
has comment: http://stackoverflow.com/comment/139337833
tagged with: arrays
tagged with: lua
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/139337576
has comment: http://stackoverflow.com/comment/139340104
has answer: http://stackoverflow.com/a/79074251
has title: Lua World of Warcraft: memory leak with array
score: 0

http://stackoverflow.com/comment/139331997
type: Comment
has text: Use the plugin's issue tracker.
type: QuestionComment
comment on: http://stackoverflow.com/q/79021308
score: 0

http://stackoverflow.com/comment/139181476
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78931550
has text: @Matt : I would expect the data sorted by index, in whatever form the language can provide. Solution found, see self-answer
type: Comment

http://stackoverflow.com/comment/139369025
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/79037052
score: 1
type: Comment

http://stackoverflow.com/a/78989633
has body: 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 metatable with two metamethods: __newindex to reload table item setter and __index to reload the getter. local function indexed_by_tuple (multidimensional) -- Non-tables should not be wrapped: if type (multidimensional) ~= 'table' then return multidimensional end return setmetatable ({}, { __newindex = function (tbl, keys, value) -- We want the standard syntax z [i] [j] [k] [l] to still work: local keys = type (keys) == 'table' and keys or { keys } local current = multidimensional for depth, key in ipairs (keys) do -- Last key reached: if depth == #keys then current[key] = value break end -- Sub-table not initialised yet: if current [key] == nil then current[key] = {} end -- Going deeper: current = current[key] end end, __index = function (tbl, keys) -- We want the standard syntax z [i] [j] [k] [l] to still work: local keys = type (keys) == 'table' and keys or { keys } local current = multidimensional for depth, key in ipairs (keys) do -- Last key reached: if depth == #keys then -- Allow to index the return with a tuple as well: return indexed_by_tuple (current [key]) end -- Even the dimension is not initialised yet: if current [key] == nil then return nil end -- Go deeper: current = current [key] end end }) end -- A 4-d test table: local a = {} for i = 1, 5 do a [i] = {} for j = 1, 4 do a [i] [j] = {} for k = 1, 3 do a [i] [j] [k] = {} for l= 1, 2 do a [i] [j] [k] [l] = (i - l) / ( j + k - 1 ) end end end end -- Initialise table indexed by tuple with a table: local ibt = indexed_by_tuple (a) -- Reset one item by hand: ibt [{ 1, 3, 3, 1 }] = 42 -- Get an item by tuple: print ('ibt [{ 1, 3, 3, 1 }] = ', ibt [{ 1, 3, 3, 1 }]) -- Get it traditional way: print ('ibt [1] [3] [3] [1] = ', ibt [1] [3] …
answers question: http://stackoverflow.com/q/78985612
score: 1
type: Answer
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/139210729
type: AnswerComment
has text: 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)`
score: 1
type: Comment
comment on: http://stackoverflow.com/a/78951467

http://stackoverflow.com/comment/139252337
has text: 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
type: Comment
comment on: http://stackoverflow.com/q/78974887
score: 1
type: QuestionComment

failover
type: Tag
tags question: http://stackoverflow.com/q/79063646
tag name: failover

http://stackoverflow.com/q/78922796
has comment: http://stackoverflow.com/comment/139150884
favorite count: 0
tagged with: lua
type: UnansweredQuestion
has body: 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. I'm not sure if there is a flaw in my usage of threads. Could someone help me understand this issue? static VOID __msg_exe_script_cb(IN message *msg) { int rt = 0; SCRIPT_EXE_NODE_S *exe_node = (SCRIPT_EXE_NODE_S *)msg->pMsgData; if (!exe_node){ print("path is null."); return; } if (!exe_node->co && !exe_node->path){ print("co and path is null."); goto ERR_EXIT; } if (!exe_node->co){ exe_node->co = lua_newthread(lua_mgr_s.L); if (!exe_node->co){ print("new co is null."); goto ERR_EXIT; } print("load file:%s.",exe_node->path); if (luaL_loadfile(exe_node->co, exe_node->path) != LUA_OK) { print("error loading script: %s", lua_tostring(exe_node->co, -1)); lua_pop(exe_node->co, 1); goto ERR_EXIT; } } INT_T status = lua_resume(exe_node->co, NULL, 0); if (LUA_OK == status){ print("script finished."); lua_pop(exe_node->co, 1); }else if (LUA_YIELD == status){ print("script coroutine."); return; }else { print("error running script: %s", lua_tostring(exe_node->co, -1)); lua_pop(exe_node->co, 1); } return; } 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.
score: 1
answer count: 0
type: Question
upvote count: 1
downvote count: 0
has title: Frequent Crashes in internshrstr after Multiple Executions of Lua Script Using lua_newthread

http://stackoverflow.com/comment/139178804
type: QuestionComment
type: Comment
has text: In the meantime, i tried : Lua coroutine (threads-like), then fltk Fl-timer : both give "core dumped" error while reading/saving first chart.
score: 0
comment on: http://stackoverflow.com/q/78935797

http://stackoverflow.com/comment/139218865
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78935797
has text: 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...

http://stackoverflow.com/a/79074251
has body: It was not actually a table problem. In this code there is a timer that triggers actions every second and a frame that listens to different events. I deleted the timer and there is no more problem. I think that when an event was received at the same precise moment or the timer had to execute its actions it generated a freeze. I will do tests using coroutines, which, if I understand correctly, are used precisely to avoid this kind of situation.
answers question: http://stackoverflow.com/q/79024260
score: 0
type: Answer

http://stackoverflow.com/comment/139340104
type: QuestionComment
comment on: http://stackoverflow.com/q/79024260
has text: Thanks for your suggestion, I'll try it tonight.
type: Comment
score: 0

http://stackoverflow.com/comment/139267586
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78985612
has text: @hpaulj thanks for your comments. How would one apply the scalar index recursively for a lua table?
score: 0

http://stackoverflow.com/comment/139178895
comment on: http://stackoverflow.com/q/78935797
type: QuestionComment
type: Comment
has text: important : fltk version in murgaLua 0.7.5 is 1.1.10.
score: 0

http://stackoverflow.com/comment/139267361
has text: 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.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/78985612

http://stackoverflow.com/q/78970599
score: 0
has title: Formatted TextLabel doesn't show the correct values
type: Question
answer count: 1
type: UnansweredQuestion
tagged with: lua
has comment: http://stackoverflow.com/comment/139240284
has answer: http://stackoverflow.com/a/78980576
tagged with: roblox
has comment: http://stackoverflow.com/comment/139301786
has body: I need help with a gas gauge for a car in Roblox. Setup: DriveSeat (VehicleSeat) and GasValue (NumberValue) are in the same car model. I have a GasGUI with a TextLabel that displays the gas percentage. I used a LocalScript in the TextLabel. The issue is that the script only shows "Gas: --%" even when I enter the car, and I want it to show how much gas is in the car. local player = game.Players.LocalPlayer local gasLabel = script.Parent gasLabel.Text = "Gas: --%" local function onDriveSeatChanged(driveSeat) if driveSeat.Occupant and driveSeat.Occupant.Parent == player.Character then local car = driveSeat.Parent local gasValue = car:FindFirstChild("GasValue") if gasValue then gasLabel.Text = "Gas: " .. math.floor(gasValue.Value) .. "%" gasValue:GetPropertyChangedSignal("Value"):Connect(function() gasLabel.Text = "Gas: " .. math.floor(gasValue.Value) .. "%" end) else gasLabel.Text = "Gas: N/A" end else gasLabel.Text = "Gas: --%" end end I'm not sure what isn't working.

http://stackoverflow.com/q/78949402
tagged with: saving-data
type: Question
has body: 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 : local DS = game:GetService("DataStoreService") local BoxPos = DS:GetDataStore("BoxPos") script.Parent.MouseClick:Connect(function(plr) local boxData = BoxPos:GetAsync(plr.UserId) if boxData then workspace.Box.Position = Vector3.new(boxData:match("(.+), (.+), (.+)")) else BoxPos:SetAsync(plr.UserId,000) end end) game.Players.PlayerRemoving:Connect(function(plr) local boxPos = workspace.Box.Position BoxPos:SetAsync(plr.UserId,tostring(BoxPos)) end) 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 "0,0,0"
answer count: 1
has answer: http://stackoverflow.com/a/79009121
type: UnansweredQuestion
tagged with: roblox
score: 0
has title: Saving a part's position with data store
tagged with: lua
tagged with: scripting

http://stackoverflow.com/comment/139218733
type: Comment
comment on: http://stackoverflow.com/q/78935797
score: 0
type: QuestionComment
has text: 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).

http://stackoverflow.com/comment/139287801
score: 0
comment on: http://stackoverflow.com/q/78996339
has text: 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.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139181229
type: Comment
comment on: http://stackoverflow.com/q/78938722
has text: Pls explain lua syntax `var ::= Name | prefixexp '[' exp ']' | prefixexp '.' Name` briefly as I dont know lua
type: QuestionComment
score: 0

http://stackoverflow.com/comment/139269032
type: Comment
has text: @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.
comment on: http://stackoverflow.com/q/78985193
score: 0
type: QuestionComment

http://stackoverflow.com/a/78952439
has body: Your first step is to reliably reproduce the issue. How often does this error occur? What steps can you perform to make the error occur? E.g. does this happen every time you start up and join your server? Then, you should remove addons from your server to work out which addon is causing it. Run the server without any addons No addons from the workshop and no addons in the server's addons folder If you no longer get the error, go to step 2 If you still get the error 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) 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 Run the server with some of the addons You could keep re-adding one addon until you get the error again Once you start getting the error again, the last addon you added will be the source of it 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.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/78919595

http://stackoverflow.com/comment/139318521
type: QuestionComment
comment on: http://stackoverflow.com/q/79012369
score: 1
has text: 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
type: Comment

http://stackoverflow.com/comment/139196975
comment on: http://stackoverflow.com/a/78942762
has text: 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.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/78984391
answers question: http://stackoverflow.com/q/78983963
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: A simple approach is to remap the global environment to an empty table before running your file. _ENV = setmetatable({}, {__index = _G}) An equivalent C code is: lua_newtable(L); // new global environment lua_createtable(L, 0, 1); // new metatable lua_getglobal(L, LUA_GNAME); // _G lua_setfield(L, -2, "__index"); // { __index = _G } lua_setmetatable(L, -2); // setmetatable(...) lua_rawseti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS); // _ENV = ...

http://stackoverflow.com/comment/139265916
type: QuestionComment
comment on: http://stackoverflow.com/q/78985193
score: 0
has text: What's the value of `package.path`?
type: Comment

http://stackoverflow.com/comment/139218749
has text: ... 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.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/78935797
type: Comment

http://stackoverflow.com/comment/139219285
has text: @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.
comment on: http://stackoverflow.com/a/78959883
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/79013273
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/79009035
has body: 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. gg.getRangesList('libil2cpp.so')[2] is nil. The table returned by gg.getRangesList('libil2cpp.so') does not contain a value at index 2. 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. This should be obvious if you would have read the first view pages of the Lua manual. https://www.lua.org/manual/5.4/manual.html#2.1
type: Answer

http://stackoverflow.com/comment/139603293
type: AnswerComment
has text: Change the line starting with `and` to `and prepend_string('ANSWER: ', div.content):walk(...)`.
score: 0
comment on: http://stackoverflow.com/a/78934473
type: Comment

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/79062698
type: Tag
tag name: xml
tags question: http://stackoverflow.com/q/79206391

http://stackoverflow.com/a/79024942
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/78954455
has body: I prepared Dockerfile and instructions to demo it. It looks like there is a difference on how execute vs aggregate functions deal with imports. Please, notice in the examples below, that both errorudf and fineudf have local PartnerUserId = require "PartnerUserId_pb" which in its turn has local protobuf = require 'protobuf' , but only aggregate call is failing. It seems like an issue of Aerospike itself. > docker build -t as-lua . > docker run -d --rm --name as-lua as-lua > docker exec as-lua aql -c "register module '/fineudf.lua'" register module '/fineudf.lua' OK, 1 module added. > docker exec as-lua aql -c "register module '/errorudf.lua'" register module '/errorudf.lua' OK, 1 module added. > docker exec as-lua aql -c "execute fineudf.make() on test where PK='1'" execute fineudf.make() on test where PK='1' +------+ | make | +------+ | | +------+ 1 row in set (0.001 secs) OK > docker exec as-lua aql -c "aggregate errorudf.count() on test" 2024-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': /usr/local/lib/lua/5.1/protobuf/pb.so: undefined symbol: lua_settop Error: (100) UDF: Execution Error 1 aggregate errorudf.count() on test Dockerfile FROM rockylinux:8.9 # install requirements RUN dnf update -y && \ dnf install -y git gcc-c++ make findutils wget unzip readline-devel python3 python3-pip nano && \ ln -sf /usr/bin/python3 /usr/bin/python ## install aerospile RUN mkdir -p aerospike \ && wget -qO- "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" | tar -xvzf - -C ./aerospike --strip-components=1 \ && cd ./aerospike && ./asinstall && cd ../ && rm -rf ./aerospike # https://aerospike.com/developer/udf/knowing_lua#lua-version ENV LUA_VERSION=5.1.4 # Use latest ENV LUAROCKS_VERSION=3.11.1 # install lua RUN mkdir -p lua && \ wget -qO- https://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz | tar -xvzf - -C .…
type: Answer
score: 1
answers question: http://stackoverflow.com/q/78954455
type: AcceptedAnswer

http://stackoverflow.com/comment/139168193
comment on: http://stackoverflow.com/q/78931550
type: QuestionComment
has text: Given your input data, what output do you expect to get?
type: Comment
score: 3

http://stackoverflow.com/q/79053069
type: Question
tagged with: kong
score: 0
answer count: 0
tagged with: lua
has body: 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? 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. 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.
tagged with: cors
has title: Allow all localhosts to make request to kong after removing * from allowed origins in CORS configuration
tagged with: kong-plugin
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139390175

sonarqube
type: Tag
tag name: sonarqube
tags question: http://stackoverflow.com/q/79062698

http://stackoverflow.com/a/79057545
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/78935797
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/78935797
has body: 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 "synchro" graphic (draw charts) & 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 !

serialization
tags question: http://stackoverflow.com/q/78983963
type: Tag
tag name: serialization

video-streaming
type: Tag
tags question: http://stackoverflow.com/q/78909274
tag name: video-streaming

http://stackoverflow.com/comment/139178902
has text: Other important info : solution given in https://onexception.dev/news/1385946/saving-fltk-diagrams-as-png-in-murgalua is IA bullshit.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78935797
type: QuestionComment

http://stackoverflow.com/comment/139202788
score: 1
has text: 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}"` :)
type: Comment
comment on: http://stackoverflow.com/q/78951239
type: QuestionComment

sonarqube-scan
type: Tag
tags question: http://stackoverflow.com/q/79062698
tag name: sonarqube-scan

http://stackoverflow.com/comment/139337576
has text: It may be necessary to monitor the growth of tables db1, db3 and unvu, because they are saved and restored.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/79024260
type: QuestionComment

language-implementation
type: Tag
tags question: http://stackoverflow.com/q/78983963
tag name: language-implementation

http://stackoverflow.com/comment/139339912
has text: Please, if you want some help with your Neovim config, post extract of your init.lua / nvim-cmp config files.
type: Comment
comment on: http://stackoverflow.com/q/79021308
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139894399
type: Comment
has text: Try running ":Copilot auth" instead of ":Copilot setup".
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/78958369

http://stackoverflow.com/comment/139340032
type: QuestionComment
score: 1
has text: @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.
type: Comment
comment on: http://stackoverflow.com/q/79021129

http://stackoverflow.com/q/78911624
tagged with: lua
type: Question
has body: When I try to require math-util.lua in my markdown.lua file, error occurs: Error detected while processing :source (no file): E5108: Error executing lua [string &quot;:source (no file)&quot;]:8: module 'snippets.math-util' not found: no field package.preload['snippets.math-util'] cache_loader: module snippets.math-util not found cache_loader_lib: module snippets.math-util not found no file '.\snippets\math-util.lua' no file 'C:\tools\neovim\nvim-win64\bin\lua\snippets\math-util.lua' no file 'C:\tools\neovim\nvim-win64\bin\lua\snippets\math-util\init.lua' no file 'C:\Program Files (x86)\Lua\5.1\lua\snippets\math-util.luac' no file 'C:\Users\joene\AppData\Local\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/snippets\math-util.lua' no file 'C:\Users\joene\AppData\Local\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/snippets\math-util/init.lua' no file 'C:\Users\joene\AppData\Local\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/snippets\math-util.lua' no file 'C:\Users\joene\AppData\Local\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/snippets\math-util/init.lua' no file 'C:/Users/joene/AppData/Local/nvim/snippets/snippets\math-util.lua' no file '.\snippets\math-util.lua' no file 'C:\tools\neovim\nvim-win64\bin\lua\snippets\math-util.lua' no file 'C:\tools\neovim\nvim-win64\bin\lua\snippets\math-util\init.lua' no file 'C:\Program Files (x86)\Lua\5.1\lua\snippets\math-util.luac' no file 'C:\Users\joene\AppData\Local\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/snippets\math-util.lua' no file 'C:\Users\joene\AppData\Local\nvim-data/lazy-rocks/nvim-dap-python/share/lua/5.1/snippets\math-util/init.lua' no file 'C:\Users\joene\AppData\Local\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/snippets\math-util.lua' no file 'C:\Users\joene\AppData\Local\nvim-data/lazy-rocks/telescope.nvim/share/lua/5.1/snippets\math-util/init.lua' no file 'C:/Users/joene/AppData/Local/nvim/snippets/snippets\math-util.lua' no file 'C:/Users/joene/AppData/Local/nvim/sni Code f…
type: UnansweredQuestion
score: 1
favorite count: 0
answer count: 0
has title: Required lua module not found
has comment: http://stackoverflow.com/comment/139193364
tagged with: neovim
upvote count: 1
downvote count: 0

jenkins
tags question: http://stackoverflow.com/q/79063646
tag name: jenkins
type: Tag

http://stackoverflow.com/a/79089240
has body: It seems like you are kinda confused at the moment on lot of stuff. Autocompletion with nvim-cmp and the related projects can be a bit messy but it is manageable when you take a look at the doc. Here is what I can advice to first familiarize yourself with the ecosystem: Use Kickstart to setup your first configuration Alternative: use a distro such as LazyVim, LunarVim... 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. Take your time, read the doc, read other people config (look dotfiles on github) and enjoy the journey, it will be a long one !
answers question: http://stackoverflow.com/q/79021308
score: 0
type: Answer

http://stackoverflow.com/a/78987341
upvote count: 2
has body: The problem here is that the default value of package.path is overridden by the LUA_PATH environment variable, and its value does not include ./?.lua. In the manual, it mentions that if you want to include the default search path in an environment variable, you can append ;; to it. This also applies to LUA_CPATH. for instance: C:\lua\systree\share\lua\5.4\?.lua;C:\lua\systree\share\lua\5.4\?\init.lua;;
answers question: http://stackoverflow.com/q/78985193
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/78985193
score: 2

http://stackoverflow.com/comment/139337833
type: QuestionComment
comment on: http://stackoverflow.com/q/79024260
has text: 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
type: Comment
score: 0

http://stackoverflow.com/comment/139202738
type: Comment
has text: 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. At least half of the motivation here is learning treesitter and building with Lua too :)
comment on: http://stackoverflow.com/q/78951239
score: 0
type: QuestionComment

http://stackoverflow.com/a/78984628
score: 0
type: Answer
has body: I fixed it and found the problem. By 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: lua_pushglobaltable(L); int idx = lua_gettop(L); lua_pushnil(L); while (lua_next(L, -2) != 0) { char value_type = 0; std::string key = lua_tostring(L, -2); size = key.size(); lua_pushstring(L, key.c_str()); lua_gettable(L, idx); 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.
answers question: http://stackoverflow.com/q/78983963

http://stackoverflow.com/comment/139263663
type: Comment
comment on: http://stackoverflow.com/q/78983963
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139219278
has text: 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 !
type: AnswerComment
comment on: http://stackoverflow.com/a/78959883
type: Comment
score: 0

http://stackoverflow.com/comment/139334487
has text: It's the difference in the past 2 seconds, so, if I got +1 subs, it will show "+1"
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79012369
type: Comment

http://stackoverflow.com/comment/139267507
type: QuestionComment
comment on: http://stackoverflow.com/q/78985612
type: Comment
score: 0
has text: 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)`

http://stackoverflow.com/comment/139273565
type: Comment
score: 0
comment on: http://stackoverflow.com/q/78985787
has text: Try `sudo dtruss sudo -u YOUR_USER_NAME luajit load.lua`
type: QuestionComment

http://stackoverflow.com/comment/139193352
comment on: http://stackoverflow.com/q/78914037
type: Comment
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/a/79036808
answers question: http://stackoverflow.com/q/79010976
score: 0
type: Answer
has body: 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 Alt, Shift or Ctrl. Here's an example: -- Variables local leanDuration = 25 local pauseDuration = 40 local function Press(key1, key2) PressKey(key1) Sleep(leanDuration) ReleaseKey(key1) Sleep(pauseDuration) PressKey(key2) Sleep(leanDuration) ReleaseKey(key2) end function OnEvent(event, arg) -- Abort if not MMB pressed if event ~= "MOUSE_BUTTON_PRESSED" or arg ~= 3 then return end -- Get button modifier -- local lalt = IsModifierPressed("lalt") -- Left Alt -- local ralt = IsModifierPressed("ralt") -- Right Alt -- local alt = IsModifierPressed("alt") -- Either Alt -- local lshift = IsModifierPressed("lshift") -- Left Shift -- local rshift = IsModifierPressed("rshift") -- Right Shift -- local shift = IsModifierPressed("shift") -- Either Shift -- local lctrl = IsModifierPressed("lctrl") -- Left CTRL -- local rctrl = IsModifierPressed("rctrl") -- Right CTRL local ctrl = IsModifierPressed("ctrl") -- Either CTRL -- Alternatively, use lock keys -- local scrolllock = IsKeyLockOn("scrolllock") -- local capslock = IsKeyLockOn("capslock") -- local numlock = IsKeyLockOn("numlock") -- Control is pressed if ctrl then Press("m", "n") else Press("n", "m") end end If this isn't exactly something that can help you, then your best bet would be to use something like AutoHotkey.

http://stackoverflow.com/a/79065496
type: Answer
answers question: http://stackoverflow.com/q/79064409
upvote count: 1
downvote count: 0
has body: I don't know about the sol wrapper, but in plain Lua this code works: function foo(a, b, c) end t=debug.getinfo(foo) print("params",t.nparams) for i=1,t.nparams do print(i,debug.getlocal(foo,i)) end print("isvararg",t.isvararg) See The Debug Library in the Lua reference manual.
score: 1

http://stackoverflow.com/q/79037052
tagged with: button
tagged with: lua
accepted answer: http://stackoverflow.com/a/79038597
type: Question
answer count: 1
tagged with: roblox
tagged with: roblox-studio
score: 0
has answer: http://stackoverflow.com/a/79038597
type: AnsweredQuestion
has title: Lua/Roblox Studio - How do I hide a scrolling frame
tagged with: hide
has body: 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 "I agree" button in it. I want the rules to hide when button is clicked. I tried local button = script.Parent local menu = script.Parent.Parent.Parent local function onButtonClicked() if menu.Visible then menu.Visible = false else menu.Visible = true end end button.MouseButton1Down:Connect(onButtonClicked) and it resulted with nothing.
has comment: http://stackoverflow.com/comment/139369025

http://stackoverflow.com/comment/139219231
comment on: http://stackoverflow.com/a/78959883
score: 0
has text: No, the resulting line is `local t = setmetatable(args, Button)`
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/139185129
score: 0
comment on: http://stackoverflow.com/q/78912520
type: QuestionComment
type: Comment
has text: @histrueandfalse Could you show me an example of this in a script of some sort? If so, thanks.

http://stackoverflow.com/a/79038597
has comment: http://stackoverflow.com/comment/139375069
has comment: http://stackoverflow.com/comment/139627184
accepted answer of: http://stackoverflow.com/q/79037052
answers question: http://stackoverflow.com/q/79037052
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/139366304
type: Answer
score: 2
downvote count: 0
has body: If the button is a direct child of the scrolling frame you're going up one parent too much. It should be this: local menu = script.Parent.Parent If that's not it, you might have accidentally disabled your script. I've recreated your scenario in my own studio and your code works fine, see the images and link to a short video below. 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 "Enable scripts". My set-up: (As per your current code) See the result here (gyazo). Hopefully, this resolves your issue.

http://stackoverflow.com/a/78942762
score: 0
has body: 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 parse-latex filter, which does the same thing for LaTeX. --- parse-html.lua – parse and replace raw HTML snippets --- --- Copyright: © 2021–2024 Albert Krewinkel --- License: MIT -- Return an empty filter if the target format is HTML: the snippets will be -- passed through unchanged. if FORMAT:match 'html' then return {} end -- Parse and replace raw HTML blocks, leave all other raw blocks -- alone. function RawBlock (raw) if raw.format:match 'html' then return pandoc.read(raw.text, 'html').blocks end end -- Parse and replace raw HTML inlines, leave other raw inline -- elements alone. function RawInline(raw) if raw.format:match 'html' then return pandoc.utils.blocks_to_inlines( pandoc.read(raw.text, 'html').blocks ) end end Converting documents with --lua-filter=parse-html.lua should then give much better results.
type: Answer
answers question: http://stackoverflow.com/q/78941149
has comment: http://stackoverflow.com/comment/139196975

http://stackoverflow.com/a/78954198
accepted answer of: http://stackoverflow.com/q/78951239
has comment: http://stackoverflow.com/comment/139232676
score: 1
has comment: http://stackoverflow.com/comment/139234920
has body: Get tree and node at your cursor local cursor_row, cursor_col = unpack(vim.api.nvim_win_get_cursor(0)) cursor_row = cursor_row - 1 local parser = vim.treesitter.get_parser(0) local tree = parser:parse()[1] local root = tree:root() local node = root:named_descendant_for_range(cursor_row, cursor_col, cursor_row, cursor_col) Go through nodes find function_definition in range of your cursor, take its params and add print to first line of that function while node do if node:type() == "function_definition" then local start_row, _, end_row, _ = node:range() if cursor_row >= start_row and cursor_row <= end_row then print("Cursor is inside function") for child in node:iter_children() do if child:type() == "parameters" then local args_list = {} for param in child:iter_children() do if param:type() == "identifier" then local arg_name = vim.treesitter.get_node_text(param, 0) table.insert(args_list, string.format("%s={%s}", arg_name, arg_name)) end end if #args_list ~= 0 then local args_string = table.concat(args_list, ", ") local print_statement = string.format(' print(f"%s")', args_string) vim.api.nvim_buf_set_lines(0, start_row + 1, start_row + 1, false, { print_statement }) end return end end end node = node:parent() end print("Cursor is not inside a function.") end This handles only simple case, def add_numbers(a, b): return a + b To check for other type of params you can always run :InspectTree and see what type you need for example to add default params if param:type() == "default_parameter" then local arg_name = vim.treesitter.get_node_text(param:child(), 0) end
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/78951239
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/139264717
comment on: http://stackoverflow.com/q/78983963
type: QuestionComment
type: Comment
has text: @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
score: 0

http://stackoverflow.com/comment/139145051
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/78919595
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139669121
has text: Thank you so much--this all works great!
comment on: http://stackoverflow.com/a/78934473
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/139321823
type: QuestionComment
comment on: http://stackoverflow.com/q/79012369
type: Comment
has text: Are you trying to print things in the console in different fonts?
score: 0

capture
tag name: capture
tags question: http://stackoverflow.com/q/79020824
type: Tag

http://stackoverflow.com/a/78967045
accepted answer of: http://stackoverflow.com/q/78962708
type: AcceptedAnswer
score: 0
type: Answer
has body: Not sure why you are calling the event inside a loop, even if that loop should only execute once. Here's how I would approach a debounced event handler. It might be worth searching your Workspace when the game is running to see if you somehow have clones of this LocalScript somewhere. local textbox = script.Parent local event = game.ReplicatedStorage.FireCode local debounce = false local COOLDOWN = 2.0 -- seconds textbox.FocusLost:Connect(function(enterPressed) -- escape if the flag is active if debounce then return end if enterPressed then debounce = true -- get the code and then clear the text box so we don't repeat the same command local code = textbox.Text textbox.Text = &quot;&quot; -- execute the code event:FireServer(code) -- wait for a moment before clearing the debounce flag wait(COOLDOWN) debounce = false end end)
answers question: http://stackoverflow.com/q/78962708

http://stackoverflow.com/a/79038795
score: 1
answers question: http://stackoverflow.com/q/79037409
has body: I tried recreating the scenario you described but to no avail. When placed in the tool, your code worked for me in both local and regular scripts. Here's the code I ended up with: -- Defined player at top-level (LocalScript only) local player = game.Players.LocalPlayer local tool = script.Parent -- Renamed "enabled" to cooldown for clarity local cooldown = false function onActivated() if cooldown then return end cooldown = true -- Change position to drink tool.GripForward = Vector3.new(0,-.759,-.651) tool.GripPos = Vector3.new(1.5,-.5,.3) tool.GripRight = Vector3.new(1,0,0) tool.GripUp = Vector3.new(0,.651,-.759) tool.Handle.DrinkSound:Play() -- Wait for sound to end tool.Handle.DrinkSound.Ended:Wait() -- (Removed the original add health code) -- Get player RootPart local root = tool.Parent:FindFirstChild("HumanoidRootPart") local explosion = Instance.new("Explosion") explosion.BlastRadius = 16 explosion.BlastPressure = 1000000 explosion.Position = root.Position explosion.Parent = game.Workspace cooldown = false end Hopefully, these slight adjustments resolve your issue...
type: Answer
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/139183726
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/78939478
has text: ```table.sort(dic,``` ```return kv1.key < kv2.key```

out
type: Tag
tags question: http://stackoverflow.com/q/79062698
tag name: out

http://stackoverflow.com/comment/139205946
comment on: http://stackoverflow.com/a/78951467
type: AnswerComment
type: Comment
score: 0
has text: 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 What 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!!

http://stackoverflow.com/a/79009121
type: Answer
answers question: http://stackoverflow.com/q/78949402
score: 0
has body: The issue is caused by the creation of the Vector3: Let's say we have P = Vector3.new(1,2,3). Then we do tostring(P), which returns boxData = "1, 2, 3". Now, when you GetAsync, you use :match("(.+), (.+), (.+)"), which returns one string: "1 2 3". Passing this variable to Vector3.new is the same as: Vector3.new("1 2 3"). Since using strings is invalid, the vector returns 0, 0, 0. Instead, you want to use a different function. Since you need a table of arguments, we can use string:split. So, then we would have boxData:split(", ") which returns {"1","2","3"}. We want to pass these numbers as separate parameters, not as table, so we can wrap unpack() around it. The full code would be: if boxData then workspace.Box.Position = Vector3.new(unpack(boxData:split(", "))) else BoxPos:SetAsync(plr.UserId, nil) end Let me know if it worked - and don't hestitate to place a comment if it didn't!

http://stackoverflow.com/comment/139369017
has text: Thank you so much! This was a great answer, and you deserved this bounty.
type: AnswerComment
comment on: http://stackoverflow.com/a/79041376
type: Comment
score: 0

http://stackoverflow.com/comment/139334664
has text: 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).
type: QuestionComment
comment on: http://stackoverflow.com/q/79021308
type: Comment
score: 0

http://stackoverflow.com/comment/139182435
score: 0
has text: @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.
type: Comment
comment on: http://stackoverflow.com/q/78938722
type: QuestionComment

http://stackoverflow.com/comment/139272833
type: QuestionComment
has text: Did you try `require(... .. ".hello")` ?
comment on: http://stackoverflow.com/q/78985193
type: Comment
score: 0

github-copilot
type: Tag
tags question: http://stackoverflow.com/q/78958369
tag name: github-copilot

http://stackoverflow.com/comment/139247839
has text: then clarify in the question where and what you have a variable quantity, you may need function with loop iteration to access the value
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78975215
score: 0

button
type: Tag
tag name: button
tags question: http://stackoverflow.com/q/79037052

http://stackoverflow.com/a/79068688
score: 0
type: Answer
answers question: http://stackoverflow.com/q/79064655
has body: After grappling with this problem, I've figured out a solution. You can use the part:GetTouchingParts method and iterate through the list. Here's what I used for my game: while true do wait(0.01) print("hi") for i,part in pairs(script.Parent:GetTouchingParts()) do if TornadoDamage.TornadoDamageKey(part,Debugging,5) then TornadoDamage.TornadoPhysics(part,script.Parent,5,part.Parent) end end end

aerospike
type: Tag
tags question: http://stackoverflow.com/q/78954455
tag name: aerospike
tags question: http://stackoverflow.com/q/79318506

hide
tag name: hide
type: Tag
tags question: http://stackoverflow.com/q/79037052

http://stackoverflow.com/comment/139366304
score: 0
has text: oh wait im dumb... i didnt even think that can be the problem
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/79038597

http://stackoverflow.com/comment/139390175
score: 0
has text: Welcome, but please read https://stackoverflow.com/help/how-to-ask
type: QuestionComment
comment on: http://stackoverflow.com/q/79053069
type: Comment

kubernetes-label
tag name: kubernetes-label
type: Tag
tags question: http://stackoverflow.com/q/79039651

confluence
tags question: http://stackoverflow.com/q/78941149
type: Tag
tag name: confluence

evaluation
tags question: http://stackoverflow.com/q/78996339
type: Tag
tag name: evaluation
tags question: http://stackoverflow.com/q/79370237

http://stackoverflow.com/comment/139270065
has text: Try reverting Lua Debug back to version 2.0.9. I also could not run Lua code with Lua Debug 2.0.10.
type: QuestionComment
comment on: http://stackoverflow.com/q/78987682
score: 1
type: Comment

http://stackoverflow.com/comment/139247672
has text: 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
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/78975215
score: 0

http://stackoverflow.com/comment/139401970
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/79059064
type: Comment
has text: 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.

fltk
type: Tag
tag name: fltk
tags question: http://stackoverflow.com/q/78935797

variable-assignment
tags question: http://stackoverflow.com/q/78938722
tag name: variable-assignment
type: Tag

constructor
tags question: http://stackoverflow.com/q/78959804
tag name: constructor
type: Tag

http://stackoverflow.com/q/79075858
tagged with: telescope.nvim
has body: I tried to install Telescope and Treesitter plugins in my Nvim, but when I open Nvim I get this error message: Error detected while processing /home/user/.config/nvim/init.lua: E5113: Error while calling lua chunk: vim/keymap.lua:0: rhs: expected string|function, got nil stack traceback: [C]: in function 'error' vim/shared.lua: in function 'validate' vim/keymap.lua: in function 'set' .../user/.config/nvim/lua/core/plugin_config/telescope.lua:4: in main chunk [C]: in function 'require' /home/user/.config/nvim/lua/core/plugin_config/init.lua:5: in main chunk [C]: in function 'require' [nvim-treesitter] [0/7] Downloading tree-sitter-markdown_inline... Press ENTER or type command to continue -- ~/.config/nvim/init.lua vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release lazypath, }) end vim.opt.rtp:prepend(lazypath) require("core.keymaps") require("core.plugins") require("core.plugin_config") -- ~/.config/nvim/lua/core/plugins.lua require("lazy").setup({ 'ellisonleao/gruvbox.nvim', 'nvim-tree/nvim-tree.lua', 'nvim-tree/nvim-web-devicons', 'nvim-lualine/lualine.nvim', 'nvim-treesitter/nvim-treesitter', { 'nvim-telescope/telescope.nvim', tag = '0.1.8', dependencies = { {'nvim-lua/plenary.nvim'} } }, }) -- ~/.config/nvim/lua/core/plugin_config/init.lua require("core.plugin_config.gruvbox") require("core.plugin_config.lualine") require("core.plugin_config.nvim-tree") require("core.plugin_config.treesitter") require("core.plugin_config.telescope") -- ~/.config/nvim/lua/core/plugin_config/telescope.lua local builtin = require('telescope.builtin') vim.keymap.set('n', '<c-p>', builtin.find_files, {}) vim.keymap.set('n', '<Space><Space>', builtin.old_files, {}) vim.keymap.set('n', '<Space>fg', builtin.live_grep, {}) vim.keymap.set('n', '<Space>…
tagged with: neovim
upvote count: 1
answer count: 1
type: Question
downvote count: 0
tagged with: lua
type: UnansweredQuestion
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/79078859
has title: How to fix Nvim 'E5113: Error while calling lua chunk'?
linked to: http://stackoverflow.com/q/71605407

http://stackoverflow.com/a/79146726
upvote count: 3
has body: string.sub (substring) and string.gsub (pattern substitution) have already been mentioned. It might be worth mentioning for string.gsub that you of course have to escape your pattern if it may contain "magic characters". Personally I think string.match is the most appropriate tool for the job, at least assuming a static prefix: str:match"^prefix(.*)" will give you the suffix, or nil if it doesn't start with the prefix, so you can use str:match"^prefix(.*)" or str to get the unaltered string in that case. Alternatively you can wrap it as assert(str:match"^prefix(.*)") to error if it doesn't start with the prefix.
score: 3
answers question: http://stackoverflow.com/q/79141463
has comment: http://stackoverflow.com/comment/139646068
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/139654111

http://stackoverflow.com/comment/139486161
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/79100682
score: 0
type: AnswerComment

http://stackoverflow.com/a/79207993
answers question: http://stackoverflow.com/q/79203333
type: Answer
downvote count: 0
upvote count: 1
score: 1
has body: 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.

http://stackoverflow.com/q/79203333
tagged with: destructuring
upvote count: 2
has body: If I have a table with known properties, but where the order of the properties is potentially unknown: local person = { name = 'James', age = 30, } can I reliably destructure it: local name, age = unpack(person) My worry is that if the order of the fields in the table is changed, that destructuring assignment will no longer work as expected.
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/139664784
has comment: http://stackoverflow.com/comment/139664850
downvote count: 0
has answer: http://stackoverflow.com/a/79209782
tagged with: lua
has comment: http://stackoverflow.com/comment/139664858
answer count: 3
type: Question
has answer: http://stackoverflow.com/a/79207993
has title: Unpack table into same-named variables
score: 2
has answer: http://stackoverflow.com/a/79209376

http://stackoverflow.com/comment/139438984
type: AnswerComment
comment on: http://stackoverflow.com/a/79078859
has text: Thanks for your answer! I added the Telescope and Treesitter files to my question.
type: Comment
score: 0

http://stackoverflow.com/a/79154432
answers question: http://stackoverflow.com/q/79149433
downvote count: 0
has body: From the BLPOP documentation: 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. 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 (source).
type: AcceptedAnswer
score: 1
accepted answer of: http://stackoverflow.com/q/79149433
upvote count: 1
type: Answer

http://stackoverflow.com/q/79241223
type: UnansweredQuestion
score: 2
tagged with: neovim
has title: Vim: Different mappings to search with and without highlight
favorite count: 0
has body: When I press g/ , it should search for word with the searched word left highlighted after pressing enter. When I press /, it should search for word but not leave the searched word highlighted after pressing enter This is the important aspect: In either case, the search should be highlighted until I have pressed enter. I have this code to allow for the first requirement with / but I have no idea how to accomplish the second without affecting the first one. -- Highlights searched pattern only until writing the search keyword vim.api.nvim_create_augroup("vimrc_incsearch_highlight", { clear = true }) vim.api.nvim_create_autocmd("CmdlineEnter", { pattern = { "/", "\\?" }, command = "set hlsearch", group = "vimrc_incsearch_highlight", }) vim.api.nvim_create_autocmd("CmdlineLeave", { pattern = { "/", "\\?" }, command = "set nohlsearch", group = "vimrc_incsearch_highlight", }) Motivation: I use / 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.
downvote count: 0
answer count: 0
upvote count: 2
tagged with: lua
type: Question

http://stackoverflow.com/a/79141472
upvote count: 3
type: Answer
score: 2
answers question: http://stackoverflow.com/q/79141463
has body: This should do the trick: function remove_prefix(str, prefix) if str:sub(1, #prefix) == prefix then return str:sub(#prefix + 1) else return str end end
downvote count: 1

http://stackoverflow.com/comment/139609701
comment on: http://stackoverflow.com/a/79165588
has text: Thank you! I tried to simplify everything first: 1. 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. 2. 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. 3. Solve a slightly simpler system.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/79078859
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/139438984
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/79075858
has body: There might be a call to setup(...) somewhere in one of these file: require("core.plugin_config.treesitter") require("core.plugin_config.telescope") Double check for typos, maybe around require('telescope').setup(...) If you post the content of these 2 files, and if they are too big, at least the lines around setup() would work.

http://stackoverflow.com/comment/139495031
comment on: http://stackoverflow.com/a/79103199
type: Comment
score: 0
type: AnswerComment
has text: 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

http://stackoverflow.com/comment/139664899
has text: @MindSwipe How can I instruct Visual Studio to use the SDK-style format for projects? How can I convert the existing project?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/79203398

http://stackoverflow.com/comment/139479635
comment on: http://stackoverflow.com/q/79089890
type: QuestionComment
type: Comment
has text: As a work around, adding this to rsyslog.d/haproxy.conf works: if $programname == 'haproxy' then /var/log/haproxy.log & ~
score: 0

http://stackoverflow.com/q/79194739
has title: Roblox running animation doesnt work, but the walking animation does
type: UnansweredQuestion
answer count: 0
score: 0
has body: 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. I tried to change the running animation (plr.Character.Humanoid.Animate.run.RunAnim.AnimationId), but this just breaks all the animations completely local walkingAnimation = 'rbxassetid://71361029954021' local runningAnimation = 'rbxassetid://74605067173947' local config = require(script.Parent.CharacterPropertiesConfig) local function ToggleRun(plr : Player) local animator : Animator = plr.Character.Humanoid.Animator if not plr.running.Value then plr.running.Value = true plr.Character.Animate.walk.WalkAnim.AnimationId = runningAnimation plr.Character.Humanoid.WalkSpeed = config.RunSpeed plr.Character.Humanoid.JumpHeight = config.JumpHeight elseif plr.running.Value then plr.running.Value = false plr.Character.Animate.walk.WalkAnim.AnimationId = walkingAnimation plr.Character.Humanoid.WalkSpeed = config.Speed plr.Character.Humanoid.JumpHeight = config.JumpHeight end end game.Players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) wait(1) char.Animate.walk.WalkAnim.AnimationId = walkingAnimation char.Humanoid.WalkSpeed = config.Speed char.Humanoid.JumpHeight = config.JumpHeight end) end) game.ReplicatedStorage.CtrlPressed.OnServerEvent:Connect(function(plr) ToggleRun(plr) end)
type: Question
tagged with: lua
tagged with: roblox

telescope.nvim
type: Tag
tags question: http://stackoverflow.com/q/79075858
tag name: telescope.nvim
tags question: http://stackoverflow.com/q/79484591

http://stackoverflow.com/q/79145351
tagged with: lua
tagged with: roblox-studio
has body: How do I copy the client's UI into the server when the player leaves? 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 frame to save as it contains all of the other items parented to it. Is there a better way to save the frame only? 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.
has comment: http://stackoverflow.com/comment/139891434
has comment: http://stackoverflow.com/comment/139572489
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139558709
has title: How do I transfer the client's UI into server side?
score: 0
tagged with: roblox
type: Question
has comment: http://stackoverflow.com/comment/139577522
answer count: 0
has comment: http://stackoverflow.com/comment/139577236

http://stackoverflow.com/comment/139550810
score: 1
has text: I had to change it to {['custom-style'] = "Strong Emphasis"} but working!
type: AnswerComment
comment on: http://stackoverflow.com/a/79139040
type: Comment

http://stackoverflow.com/q/79135054
tagged with: lua
has body: 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 "cache_loader: module yaml.version not found" Here's the entire output from Neovim: /usr/local/share/lua/5.1/lyaml/init.lua:460: attempt to call field 'parser' (a nil value) # stacktrace: - /usr/local/share/lua/5.1/lyaml/init.lua:460 _in_ **Parser** - /usr/local/share/lua/5.1/lyaml/init.lua:487 _in_ **load** - /xxx/lua/xxx/model/YamlHeader.lua:114 _in_ **parseDocument** - /xxx/lua/xxx/controller/SetUpController.lua:37 _in_ **updateNote** - /xxx/lua/xxx/controller/SetUpController.lua:117 _in_ **scanNoteBoxes** - /xxx/lua/xxx/init.lua:13 _in_ **setup** - .config/nvim/lua/config/lazy.lua:9 - .config/nvim/init.lua:2 ^Ino field package.preload['yaml.version'] cache_loader: module yaml.version not found cache_loader_lib: module yaml.version not found ^Ino file './yaml/version.lua' ^Ino file '/opt/homebrew/share/luajit-2.1/yaml/version.lua' ^Ino file '/usr/local/share/lua/5.1/yaml/version.lua' ^Ino file '/usr/local/share/lua/5.1/yaml/version/init.lua' ^Ino file '/opt/homebrew/share/lua/5.1/yaml/version.lua' ^Ino file '/opt/homebrew/share/lua/5.1/yaml/version/init.lua' ^Ino file './yaml/version.so' ^Ino file '/usr/local/lib/lua/5.1/yaml/version.so' ^Ino file '/opt/homebrew/lib/lua/5.1/yaml/version.so' ^Ino file '/usr/local/lib/lua/5.1/loadall.so' ^Ino module 'yaml.version' in file '/usr/local/lib/lua/5.1/yaml.so' module 'yaml.parser' not found: ^Ino field package.preload['yaml.parser'] cache_loader: module yaml.parser not found cache_loader_lib: module yaml.parser not found ^Ino file './yaml/parser.lua' ^Ino file '/opt/homebrew/share/luajit-2.1/yaml/parser.lua' ^Ino file '/usr/local/share/lua/5.1/yaml/parser.lua' ^Ino file '/usr/local/share/lua/5.1/yaml/parser/init.lua' ^Ino file '/opt/homebrew/share/lua/5.1/yaml/parser.lua' ^Ino file '/opt/homebrew/share/lu…
type: UnansweredQuestion
has title: Error when using LYAML in Neovim plugin: "cache_loader: module yaml.version not found"
tagged with: neovim-plugin
answer count: 0
score: 0
type: Question

http://stackoverflow.com/comment/139672848
type: Comment
has text: [That](https://stackoverflow.com/q/73365404/1847592) question is very similar to your. Does that answer solve your problem?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79152996

http://stackoverflow.com/comment/139483514
comment on: http://stackoverflow.com/q/79104155
score: 0
type: QuestionComment
has text: 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.
type: Comment

http://stackoverflow.com/q/79105654
score: 0
has comment: http://stackoverflow.com/comment/139492131
type: Question
has title: Can't get custom style working in pandoc for odt output
type: UnansweredQuestion
tagged with: pandoc
has body: According to the doc, custom-style for odt output should be straigthforward in Pandoc, without the need for any extension. 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: MD source document: ### header bla this is a custom style span ::: {custom-style="Poetry"} | A Bird came down the Walk--- | He did not know I saw--- ::: ::: {custom-style="bluestyle"} I'm blue ::: # My Header {style="Header 7"} scscscs this is a custom style span Pandoc Command: pandoc test_input.md -o test_output.odt Versions: pandoc 3.5.1 ubuntu 22.04
tagged with: libreoffice
tagged with: lua
answer count: 0

http://stackoverflow.com/q/79179000
tagged with: lua-table
downvote count: 0
has title: Repacking or printing unpacked Lua tables
answer count: 2
upvote count: 3
possible better answer: http://stackoverflow.com/a/79202412
favorite count: 0
tagged with: recursion
accepted answer: http://stackoverflow.com/a/79179832
score: 3
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79179832
has body: Why does the table.unpack() function print the unpacked table only if there is nothing following the function? > print(table.unpack({1,2,3})) 1 2 3 > print(table.unpack({1,2,3}),"a") -- expecting: 1 2 3 a 1 a > print("a",table.unpack({1,2,3})) a 1 2 3 Background: I 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 table.pack("a", table.unpack({1,2,3})) but not when you do table.pack(table.unpack({1,2,3}), "a").
type: Question
has answer: http://stackoverflow.com/a/79202412
tagged with: lua

http://stackoverflow.com/q/79196930
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/79197117
has answer: http://stackoverflow.com/a/79197117
has title: In lua why is print ("Name can't be empty") being executed instead of table[i] = io.read () in first iteration
upvote count: 3
tagged with: lua
has body: As the tittle implies in first iteration print ("Name can't be empty") is executed instead of table[i] = io.read () in the first iteration Here is the whole code io.write("How many names do you want to enter? ") maxNames = io.read("*n") table = {} for i = 1, maxNames, 1 do while true do io.write ("Enter names: ") table[i] = io.read () if #table[i] == 0 or table[i] == " " then print ("Name can't be empty") else break end end end for k, items in pairs(table) do print ("Name in index " .. k .. " of table is " .. items) end print (table)
downvote count: 0
type: AnsweredQuestion
answer count: 1
favorite count: 0

http://stackoverflow.com/a/79086590
answers question: http://stackoverflow.com/q/79086554
score: 3
has comment: http://stackoverflow.com/comment/139451311
has body: You are doing essentially this (I renamed the keys and variables to make the distinction clearer): local b = {} local a = { value = b } a.value = 3 print(b) Why would setting a.value change b? You can't change local variables like that. So even though it might seem that you can alter a (and more precisely in this case, what a 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 a.
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/139452696
accepted answer of: http://stackoverflow.com/q/79086554
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/139871602
type: QuestionComment
comment on: http://stackoverflow.com/q/79232356
has text: yeah it does work
type: Comment
score: 0

http://stackoverflow.com/comment/139722131
comment on: http://stackoverflow.com/q/79234493
score: 0
type: QuestionComment
has text: 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)
type: Comment

http://stackoverflow.com/comment/139513748
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/79120372
has text: Thanks. That string comes from a module I don’t control but I got it with `output:gsub(‘\n’, ‘\\n’)`
type: Comment

http://stackoverflow.com/q/79118768
type: AnsweredQuestion
tagged with: lua-5.4
score: 0
has answer: http://stackoverflow.com/a/79135390
type: Question
tagged with: macos
tagged with: lua
has body: under MAC OS Sonoma 14.2.1 luaclient.lua script line 2 is: local socket = require('socket') When the script is run, it yields: lua: luaclient.lua:2: module 'socket' not found: no field package.preload['socket'] no file '/usr/local/share/lua/5.4/socket.lua' no file '/usr/local/share/lua/5.4/socket/init.lua' no file '/usr/local/lib/lua/5.4/socket.lua' no file '/usr/local/lib/lua/5.4/socket/init.lua' no file './socket.lua' no file './socket/init.lua' no file '/usr/local/lib/lua/5.4/socket.so' no file '/usr/local/lib/lua/5.4/loadall.so' no file './socket.so' stack traceback: [C]: in function 'require' luaclient.lua:2: in main chunk [C]: in ? socket is installed here: /Users/user_name/.luarocks/share/lua/5.4 Lua interpreter says: Lua 5.4.7 Copyright (C) 1994-2024 Lua.org, PUC-Rio print(package.path) /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 Trying: set LUA_PATH '/Users/perryhorwich/.luarocks/share/lua/5.4/?.lua' ... in the shell, gives the same error as though LUA_PATH has no effect on the lookup for 'socket' What am I missing?
tagged with: installation
accepted answer: http://stackoverflow.com/a/79135390
answer count: 1
has title: 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?

http://stackoverflow.com/a/79112340
type: Answer
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/79084408
upvote count: 2
has body: 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 when to switch waypoints just needs to be a bit smarter. So let's walk through the way a knockback along a path should work : Description Diagram Consider the path ABC: - A is the spawn point, and C is the end point, - the distance from A to B is 10 studs, - the distance from B to C is 15. Let's imagine we have an enemy marching from B to C, and they are 3 studs past B... When the enemy is knocked back 5 studs... - they should be sent back the 3 studs to B, - then the remaining 2 studs should send them towards A. 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 So your knockback logic needs to know the following information : the full list of waypoints the enemy's current waypoint target the enemy's current position how far to be knocked back Let's make a ModuleScript to handle your Enemy logic. The updated knockback logic will live in the Enemy:OnKnockback() function, which you can trigger however you like later. local Enemy = {} Enemy.__index = Enemy function Enemy.new(waypoints : { BasePart }, damage : number, speed : number, health : number, modelTemplate : Model) assert(#waypoints >= 2, "List of waypoints must be >= 2") local self = { waypoints = waypoints, currentWaypoint = 2, -- assume that 1 is the spawn, so the first target is 2 damage = damage, speed = speed, health = health, modelTemplate = modelTemplate, moveToConnection = nil, -- for now modelRef = nil, -- for now } setmetatable(self, Enemy) return self end function Enemy:Spawn() local newModel = self.modelTemplate:Clone() newM…
answers question: http://stackoverflow.com/q/79084408
has comment: http://stackoverflow.com/comment/139504011
has comment: http://stackoverflow.com/comment/139536878
has comment: http://stackoverflow.com/comment/139533694
type: AcceptedAnswer

http://stackoverflow.com/comment/139664858
has text: `local name, age = person.name, person.age`
type: Comment
comment on: http://stackoverflow.com/q/79203333
score: 3
type: QuestionComment

http://stackoverflow.com/comment/139497967
type: Comment
has text: 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 >.<
comment on: http://stackoverflow.com/a/79110751
type: AnswerComment
score: 0

http://stackoverflow.com/q/79107680
type: UnansweredQuestion
favorite count: 0
tagged with: ruff
tagged with: neovim
answer count: 0
tagged with: pyright
upvote count: 3
tagged with: nvim-lspconfig
has body: 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. I followed the setup instructions in nvim-lspconfig (note: I'm also using mason-lspconfig and mason, by extension). I ended up with the following handler configuration: ... ['pyright'] = function() require('lspconfig')['pyright'].setup({ capabilities = capabilities, on_attach = on_buffer_attach_common_actions, --- see keys at: https://microsoft.github.io/pyright/#/settings settings = { python = { pythonPath = get_python_path(), }, pyright = { disableOrganizeImports = true, --- defer to ruff } }, }) end, ['ruff'] = function() require('lspconfig')['ruff'].setup({ capabilities = capabilities, --- see keys at: https://docs.astral.sh/ruff/editors/settings/ settings = { configurationPreference = 'filesystemFirst', }, }) --- See: https://neovim.io/doc/user/lsp.html#lsp-config vim.api.nvim_create_autocmd('LspAttach', { callback = function(args) local client = vim.lsp.get_client_by_id(args.data.client_id) if client.name == 'ruff' then --- defers some capabilities on python LSP to pyright/basedpyright client.server_capabilities.hoverProvider = false on_buffer_attach_common_actions(client, args.buf) local function apply_autofix() local params = { --- command = 'ruff.applyOrganizeImports', command = 'ruff.applyAutofix', arguments = { { uri = vim.uri_from_bufnr(args.buf), version = 0 }, }, } local non_ruff_client_ids = {} for _, cl in ipairs(vim.lsp.get_clients()) do if cl.name ~= "ruff" then table.insert(non_ruff_client_ids, cl.id) end end --- Detach all clients that are not ruff so that the --- execute_command does not reach them. for _, id in ipairs(non_ruff_client_ids) do vim.lsp.buf_detach_client(args.buf, id) end vim.lsp.buf.execute_command(params) for _, id in ipairs(non_ruff_client_ids) do vim.lsp.buf_attach_client(args.buf, id) end end vim.api.nvim_create_user_command( 'RuffApplyAutofix', apply_autofix, { desc = 'Ruff: Apply auto-fix' } ) --- ac…
type: Question
downvote count: 0
has title: Executing a command on only one of the attached LSP servers in Neovim
score: 3
tagged with: lua

http://stackoverflow.com/q/79217152
answer count: 2
has answer: http://stackoverflow.com/a/79474267
upvote count: 1
type: UnansweredQuestion
has body: I change my layouts with a very primitive xkb-switch utility. I need to imitate the 'Share the same input method among all applications - disabled' behaviour of IBus. My idea is such: When exiting a certain client I want to store the output of the xkb-switch shell command (it just lists my current layout: us(altgr-intl),am or ru). After some time, when entering back into that client, I want to switch the keyboard layout back (to the stored one) with the shell command xkb-switch --switch <layout_here> My attempt: client.connect_signal("unfocus", function(c) awful.spawn.easy_async_with_shell("xkb-switch", function(stdout) if c.valid then c.keyboard_layout = stdout end end) end) client.connect_signal("focus", function(c) c = awful.screen.focused({client = true}) if c.keyboard_layout == nil then c.keyboard_layout = "us(altgr-intl)" end awful.spawn.with_shell("xkb-switch -s "..c.keyboard_layout) end) Here is the behaviour: the notification popup is showing the intended language, but for some reason the switched language is wrong, is there some race hazard? https://youtu.be/juarLneLBAo
favorite count: 0
downvote count: 0
tagged with: lua
tagged with: awesome-wm
type: Question
has title: Unique keyboard layout per client
score: 1
has answer: http://stackoverflow.com/a/79217415

http://stackoverflow.com/q/79203398
type: Question
has comment: http://stackoverflow.com/comment/139664869
has body: Following this post, 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 .csproj files when adding new source files. In Visual Studio, when you add a new .cs file, it automatically updates the project file by adding an entry like this in the appropriate ItemGroup section: <Compile Include="path\to\fileName.cs" /> Is there a way to implement similar functionality in Neovim? I'm looking for solutions that could involve: Existing plugins (preferably compatible with lazy.nvim) Custom Lua/VimScript implementation File watchers or other automation approaches The ideal solution would: Detect when a new .cs file is created Automatically locate the corresponding .csproj file Update the XML structure by adding the Compile element in the correct ItemGroup Maintain proper relative paths I think if no existing plugins provide this functionality then I have to write custom solutions in Lua or VimScript. Does anyone have experience implementing this kind of .NET project file automation in vi/vim/nvim?
tagged with: lua
has comment: http://stackoverflow.com/comment/139664935
has comment: http://stackoverflow.com/comment/139664899
tagged with: csproj
has comment: http://stackoverflow.com/comment/139664845
tagged with: c#
linked to: http://stackoverflow.com/q/63055430
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139664976
has comment: http://stackoverflow.com/comment/139664804
has title: How to automatically update .csproj files when adding new C# files in Neovim?
tagged with: .net
tagged with: neovim
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/139664925

http://stackoverflow.com/q/79124307
has title: Problem setting nginx variable from inside lua block - Value doesn´t change on nginx/location variable
tagged with: nginx-location
has answer: http://stackoverflow.com/a/79124389
answer count: 1
type: UnansweredQuestion
score: 0
tagged with: nginx
linked to: http://stackoverflow.com/q/53168425
type: Question
has body: 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 "target" 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. location /payload-test { set $target '0'; content_by_lua_block { ngx.req.read_body() local body = ngx.req.get_body_data() if body then local document = string.sub(body, string.find(body, "documentNumber") + 16, string.find(body, "documentNumber")+30) ngx.print(document) local documentNum = string.match(document, "%d+") ngx.print(documentNum) local lastDigit = string.sub(documentNum, string.len(documentNum)) if math.fmod(lastDigit, 2) == 0 then ngx.var.target = "1" else ngx.var.target = "2" end ngx.print(ngx.var.target) end } #updated block if ($target = "1") { proxy_pass http://port_23301; } if ($target = "2") { proxy_pass http://port_23501; } } 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 "0" and not 1 or 2, set by lua block. 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: access_by_lua_block { ngx.req.read_body() local body = ngx.req.get_body_data() if body then local document = string.sub(body, string.find(body, "documentNumber") + 16, string.find(body, "documentNumber")+30) local documentNum = string.match(document, "%d+") local lastDigit = string.sub(documentNum, string.len(documentNum)) if math.fmod(lastDigit, 2) == 0 then ngx.ctx.target = "1" else ngx.ctx.target = "2" end end } Then, on the upstream, i created a balancer_by_lua_block? balancer_by_lua_block { local balancer = require('ngx.balancer') ngx.log(1,"Target Varia…
tagged with: lua

uefi
type: Tag
tag name: uefi
tags question: http://stackoverflow.com/q/79113391

http://stackoverflow.com/comment/139419060
comment on: http://stackoverflow.com/q/79068981
type: QuestionComment
score: 1
type: Comment
has text: "_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?

http://stackoverflow.com/a/79141388
answers question: http://stackoverflow.com/q/79139769
score: 0
has body: Lua (5.4) does not include the described function in its Standard Library (see: 6.6 – Table Manipulation). table.move is the closet analogue, but it behaves like the C function memmove, working on array-like tables (i.e., a sequence). You will have to implement this function yourself. In the simplest of terms, it can be written as: local function update(to, from) for key, value in pairs(from) do to[key] = value end end
type: Answer
accepted answer of: http://stackoverflow.com/q/79139769
type: AcceptedAnswer

http://stackoverflow.com/q/79191945
score: 0
type: Question
has body: I am trying to run the following code local lgi = require("lgi") local Gdk = lgi.Gdk local Gtk = lgi.Gtk Gtk.init() -- Create a new window local window = Gtk.Window({ title = "LGI Test Window", default_width = 300, default_height = 200, on_destroy = Gtk.main_quit, }) -- Create a label and add it to the window local label = Gtk.Label({ label = "Hello, LGI!" }) window:add(label) window:show_all() Gtk.main() But this is giving me the following error lua: /home/username/.luarocks/share/lua/5.3/lgi/core.lua:14: module 'lgi.corelgilua51' not found: no field package.preload['lgi.corelgilua51'] no file '/home/username/.luarocks/share/lua/5.3/lgi/corelgilua51.lua' no file '/home/username/.luarocks/share/lua/5.3/lgi/corelgilua51/init.lua' no file '/usr/local/share/lua/5.3/lgi/corelgilua51.lua' no file '/usr/local/share/lua/5.3/lgi/corelgilua51/init.lua' no file '/usr/local/lib/lua/5.3/lgi/corelgilua51.lua' no file '/usr/local/lib/lua/5.3/lgi/corelgilua51/init.lua' no file './lgi/corelgilua51.lua' no file './lgi/corelgilua51/init.lua' no file '/home/username/.luarocks/lib/lua/5.3/lgi/corelgilua51.so' no file '/usr/local/lib/lua/5.3/lgi/corelgilua51.so' no file '/usr/local/lib/lua/5.3/loadall.so' no file './lgi/corelgilua51.so' no file '/home/username/.luarocks/lib/lua/5.3/lgi.so' no file '/usr/local/lib/lua/5.3/lgi.so' no file '/usr/local/lib/lua/5.3/loadall.so' no file './lgi.so' stack traceback: [C]: in function 'require' /home/username/.luarocks/share/lua/5.3/lgi/core.lua:14: in main chunk [C]: in function 'require' /home/username/.luarocks/share/lua/5.3/lgi/init.lua:19: in main chunk [C]: in function 'require' /home/username/.luarocks/share/lua/5.3/lgi.lua:19: in main chunk [C]: in function 'require' init2.lua:1: in main chunk I have already set LUA_PATH and LUA_CPATH, but installing lgi from luarocks does not have the corelgilua51, what could be the issues, the lgi only contain the following files:- drwxr-xr-x. 1 username username 226 Nov 15 13:01 . drwxr-xr-x. 1 username…
has comment: http://stackoverflow.com/comment/139644471
has comment: http://stackoverflow.com/comment/139645420
tagged with: module
tagged with: luarocks
tagged with: gtk3
accepted answer: http://stackoverflow.com/a/79194541
tagged with: lua
has answer: http://stackoverflow.com/a/79194541
type: AnsweredQuestion
answer count: 1
tagged with: lgi
has title: `corelgilua51` not found in lgi lua

docker-compose
type: Tag
tags question: http://stackoverflow.com/q/79205736
tag name: docker-compose

http://stackoverflow.com/q/79071010
type: Question
tagged with: lua
type: UnansweredQuestion
has title: debug.getlocal: reading internal local variables
answer count: 0
score: 0
has body: 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 004016f0, 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: 6c09e0d0, this function cant be saved into a variable which is also quite weird. Can someone please explain this behavior? and what the functions may be? code: print(debug.getlocal(2, 1)) -- ARGS print(debug.getlocal(2, 2)) -- USERDATA print(debug.getlocal(2, 3)) -- CONSTANT C FUNC? print(debug.getlocal(1, 1)) -- CONSTANT FUNC, IF NO LOCAL VARS local k, v = debug.getlocal(1, 1) -- NIL, NIL? local k2, v2 = debug.getlocal(2, 3) for key, value in pairs(debug.getinfo(v2)) do print(key, value) end output: (C temporary) 2 (C temporary) userdata: 00802290 (C temporary) function: 004016f0 (temporary) function: 6c09e0d0 lastlinedefined -1 func function: 004016f0 ftransfer 0 istailcall false ntransfer 0 namewhat currentline -1 source =[C] isvararg true short_src [C] nparams 0 what C nups 0 linedefined -1

http://stackoverflow.com/q/79137236
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/139545478
tagged with: pandoc
tagged with: libreoffice-writer
score: 0
has body: I have input.md: --- title: My example document --- ## Overview *I am italic* **I am bold** If I run: pandoc input.md -o output.odt 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 "Strong Emphasis" and "Emphasis", respectively, from the Styles menu. I want to automate this, so I created custom_styles.lua: function Strong(elem) return pandoc.Span(elem.content, {class = "StrongEmphasis"}) end function Emph(elem) return pandoc.Span(elem.content, {class = "Emphasis"}) end If I run: pandoc --lua-filter=custom_styles.lua -o output.odt input.md My odt document now shows "No Character Style" for the text that was bold and italic. Can somebody explain what I should be doing to achieve this? Thanks I
accepted answer: http://stackoverflow.com/a/79139040
type: Question
tagged with: odt
has comment: http://stackoverflow.com/comment/139543582
tagged with: lua
has title: How can I create a Lua filter that changes italic & bold markdown to Emphasis & Strong Emphasis styles with pandoc for LibreOffice Writer ODT file?
has answer: http://stackoverflow.com/a/79139040
answer count: 1
has comment: http://stackoverflow.com/comment/139545875
has comment: http://stackoverflow.com/comment/139546390

http://stackoverflow.com/a/79194541
answers question: http://stackoverflow.com/q/79191945
accepted answer of: http://stackoverflow.com/q/79191945
type: AcceptedAnswer
type: Answer
has body: The reason for this question is that the lib directory in the lgi's Makefile is hardcoded as /usr/local/lib/lua/5.1. PREFIX = /usr/local LUA_VERSION=5.1 LUA_LIBDIR = $(PREFIX)/lib/lua/$(LUA_VERSION) LUA_SHAREDIR = $(PREFIX)/share/lua/$(LUA_VERSION) ... mkdir -p $(DESTDIR)$(LUA_LIBDIR)/lgi cp $(CORE) $(DESTDIR)$(LUA_LIBDIR)/lgi As you can see in the question, when you use it in another version of Lua, the directory it searches for is /usr/local/lib/lua/5.3/lgi.so, which resulted in the error. The solution can be to modify the value of LUA_VERSION in the Makefile, or copy the output file to the correct directory, or change package.searchpath.
score: 0

http://stackoverflow.com/q/79237808
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/79238245
upvote count: 3
type: Question
tagged with: lua
accepted answer: http://stackoverflow.com/a/79238245
tagged with: neovim
score: 3
has title: How to execute a Lua function after exiting insert mode in Neovim
answer count: 1
favorite count: 0
has body: Teach me please how to make Neovim execute a Lua function after exiting an insert mode.

http://stackoverflow.com/a/79217754
has body: this is likely because of Streaming Enabled. A simple fix would be to disable it. It's a property of workspace
answers question: http://stackoverflow.com/q/79213245
score: 0
type: Answer

http://stackoverflow.com/a/79141898
upvote count: 1
downvote count: 0
score: 1
has body: 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 https://code.visualstudio.com.
accepted answer of: http://stackoverflow.com/q/79139400
answers question: http://stackoverflow.com/q/79139400
type: AcceptedAnswer
type: Answer

csproj
tags question: http://stackoverflow.com/q/79203398
tag name: csproj
type: Tag

http://stackoverflow.com/a/79120372
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/79119791
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/139513748
upvote count: 3
has body: Because \n will be interpreted as a line break, and this string will be interpreted as: return { date="2024-10-23T21:24:27.227996696Z", severity="Normal", category="Hardware", message="line 1 line 2", filename="", status="Not Present", source="Atmos-RX-2" } This is incorrect in syntax. If you want the value of message to include a line break, you should escape the backslash: message="line 1\\nline 2"
accepted answer of: http://stackoverflow.com/q/79119791

http://stackoverflow.com/q/79069051
tagged with: lua
tagged with: roblox
type: UnansweredQuestion
has title: How do I create a character removal button from the DataStorer in Roblox Studio?
score: 0
has body: 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. my problem is that the citizen is not saved to the DataStorer script button: local button = script.Parent local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") -- Define the spawn location local spawnLocation = workspace:WaitForChild("SpawnLocation") -- Make sure you have a SpawnLocation part in your workspace button.MouseButton1Click:Connect(function() local player = Players.LocalPlayer local character = player.Character if character then character:Destroy() end -- Clone the new character and set it up local newCharacter = ReplicatedStorage.Characters.Common.Citizen:Clone() newCharacter.Name = player.Name -- Ensure the character has the player's name newCharacter.Parent = workspace player.Character = newCharacter -- Wait for the character to be set up before making adjustments newCharacter:WaitForChild("HumanoidRootPart") newCharacter:WaitForChild("Humanoid") -- Move the new character to the spawn location newCharacter:SetPrimaryPartCFrame(spawnLocation.CFrame) -- Set the camera to follow the new character workspace.CurrentCamera.CameraSubject = newCharacter:FindFirstChild("Humanoid") workspace.CurrentCamera.CameraType = Enum.CameraType.Custom end) DataStorer_DataStore: local DataStoreService = game:GetService("DataStoreService") local config = script:WaitForChild("datastore_config") local myDataStore = DataStoreService:GetDataStore("$Data$!"..config:FindFirstChild("DataVersion").Value) local saving = config:FindFirstChild("Saving") local autoSave = config:FindFirstChild("AutoSave") local function create_table(plr) local player_stats = {} for _, folder in pairs(script:FindFirstChild("Plr"):GetChildren()) do if folder:IsA("Folder") then print(folder) for _, stat in pairs(plr:FindFirstChild(folder.Name):GetC…
type: Question
answer count: 0

http://stackoverflow.com/q/79171090
type: Question
tagged with: tween
has answer: http://stackoverflow.com/a/79174198
tagged with: lua
has comment: http://stackoverflow.com/comment/139611972
accepted answer: http://stackoverflow.com/a/79174198
answer count: 1
tagged with: roblox
score: 0
has title: How do I prevent my tween from playing double?
type: AnsweredQuestion
has body: I have a simple project where I'm making a card battling game. The battle sequence looks like this: repeat BattleClient.PlayerAttackTween() task.wait(battleSpeed) BattleClient.EnemyAttackTween() task.wait(battleSpeed) battleRound += 1 until isInBattle.Value == false 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 task.wait() and has not yet gotten to the until check to break the loop, so the tweens play double during that second fight. How do I prevent this from happening? Edit: Video showcasing issue
tagged with: repeat

http://stackoverflow.com/comment/139664845
type: QuestionComment
type: Comment
has text: @MindSwipe is that part of .NET Core? If yes, we are yet to migrate. We are, unfortunately, still using legacy proprietary .NET Framework.
comment on: http://stackoverflow.com/q/79203398
score: 0

http://stackoverflow.com/comment/139419296
comment on: http://stackoverflow.com/q/79068981
has text: 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.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/q/79151147
type: Question
accepted answer: http://stackoverflow.com/a/79151816
downvote count: 0
tagged with: async-await
possible better answer: http://stackoverflow.com/a/79151155
has title: Why doesn't the statement after await continue to execute after promise resolves?
tagged with: lua
score: 2
favorite count: 0
tagged with: typescript
tagged with: node.js
upvote count: 2
type: AnsweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/79151816
has body: I want to implement an asynchronous task scheduling. This is my code: let gameTick = 0; const tasks: Record&lt;string, Function[]&gt; = {}; function sleep(t: number) { const targetTick = gameTick + t; if (!tasks[targetTick]) { tasks[targetTick] = []; } return new Promise&lt;void&gt;(resolve =&gt; { tasks[targetTick].push(resolve); }); } async function task1() { print('start task1'); for (let i = 0; i &lt; 3; i++) { print(`execute: ${i}`); await sleep(2); } } // task1(); for (gameTick = 0; gameTick &lt; 10; gameTick++) { print(`tick: ${gameTick}`); tasks[gameTick]?.forEach(f =&gt; f()) if (gameTick == 2) task1(); } This code behaves differently in the TypeScriptToLua environment and in the node.js environment, which confuses me. <a href="https://typescripttolua.github.io/play#code/FDA2FMBcAIHMEMC24AqBLAxga2gXmgAwDcIGA9gHYDOMk8VWVAXNAErjkBOAJgDw2c0FWABpoAMQCuFDJDSUA2gF0AfHmgBvAL4lgAM2mz5FaFQjgADgApILCpMQAjcJwCUm4NC-Ry1WvE5YKHRsdQRkEJwAamhIEm9oND1oKwBCOgYqBTpA4MwsJXcNTwTvDMZsgKDISKV1ZXjvLRKvTihJThMKcAB3aAAFTjJENCpwXgA3MjRuFSs2qjJQCfA8NWLSsvoKnOragDoLSSoAC3nwReXwV0avLRvgZuB6AE8ZaAMZOUpY7YBGKxFEoWQQUSBWADkNAC-gYfwhDy8ejInBSEBgaHUxES0F40AAzERElEokCEiChOCAAbgAAeHEkkHALAAJBo0FoqYjvPAevA0DAzOBLFYAEzc5pPAD0Ut+cMBumRqKs4VQ+SxRNVkVx0D+2K1+RJZO8FLBVipcmwrI0BuwnO5XnKWVtBQA-PslQBReAYM7JXBqPSA1wtRLJFVINWhXD4cVyrAAh5aIA" rel="nofollow noreferrer">TypeScriptToLua <a href="https://www.typescriptlang.org/play/?#code/GYVwdgxgLglg9mABABwE4zFAFAZyqgLkT3TAHMBKRAbwFgAoRJxCBHOAGwFMA6DuMrnwUGAXwYNuURGQCGAWy4AVGBADWiALyIADAG4J9VmDyIosnGpxEASl1aoAJgB4SGMgBpEAMXDR4YADaALoAfFo0ogb0DKCQsAjE3FzIWFBEYCDyAEZcqFR0jMzGpuaoZFxQKuoRcorVGgDUZtHMiDDAiFgAhOaWOIFlFVWqasEFDG1tfVaDsuWVDcERIa3M4kVMqJUgqEhgXADuiAAKqHDyMDhczgBucDCOoVjb7By3XFrhhVPMMwNDRajYI8ZAgHAACxeXDeHwoayYonhYkMFgAnpBEHF-IkZgBGLATIpoDDYADkeHm0nxZORRWAcFQXSk7Qi+lZzkQAGY9O1Go0iW0SZgsAADLgAD3sICgXCIABJqDBRKK6W1ZIdZDBpDhkqkAExqxAbDYMAD0ZrMFjUBLpsUZXTqylGbN5ToaiE5ePZ7tG-MFzGF2FFsHUCuovvUKqNTH+gUjYwA-DwGagAKKyCBQzqacLAQkiTbtTpYBNabSGq2WW3RURAA" rel="…
has answer: http://stackoverflow.com/a/79151155
tagged with: javascript

http://stackoverflow.com/q/79110440
tagged with: profiler
score: 1
has answer: http://stackoverflow.com/a/79110751
answer count: 1
type: UnansweredQuestion
tagged with: hook
favorite count: 0
has body: I'm writing a lua script profiler in C, and I found the lua_sethook C API. I expected the hook to trigger balanced amounts of entering/leaving events, so I can mesure the time cost of every function. But the truth is that the returning (or leaving) event may be lost when there is an error raised during execution. The case can be summarized by the following codes: file test_hook.lua: function my_hook(event, line) local info = debug.getinfo(2) print(event .. ": " .. info.short_src .. " " .. tostring(info.name) .. " " .. tostring(info.currentline)) end debug.sethook(my_hook, "cr") function AAA() print(nil + 1) end function BBB() pcall(AAA) end function CCC() BBB() end CCC() With lua test_hook.lua, the output looks like this: return: [C] sethook -1 call: test_hook.lua CCC 16 call: test_hook.lua BBB 12 call: [C] pcall -1 call: test_hook.lua nil 8 return: [C] pcall -1 return: test_hook.lua BBB 13 return: test_hook.lua CCC 17 return: test_hook.lua nil 19 return: [C] nil -1 function AAA throws an error, and the 4th call event is no longer enclosed by a return event. In lua's interactive mode, the problem is similar: ... copy/paste code above ... > CCC() call: stdin nil 1 tail call: stdin nil 2 call: stdin BBB 2 call: [C] pcall -1 call: stdin nil 2 return: [C] pcall -1 return: stdin BBB 3 return: stdin nil 3 The 4th call event is not enclosed again. Because of this, I cannot know when a function ends if an error occurred (even if it was correctly handled by pcall/xpcall). Is there any other way to know it? What is the correct way to deal with it? How did existing lua profilers solve it? Thanks!
upvote count: 1
has title: Lua debug hook triggers different amount of call/returning events if error occurred during execution
type: Question
downvote count: 0
tagged with: lua

http://stackoverflow.com/comment/139670494
has text: 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
type: QuestionComment
comment on: http://stackoverflow.com/q/79205736
score: 1
type: Comment

edk2
tags question: http://stackoverflow.com/q/79113391
type: Tag
tag name: edk2

http://stackoverflow.com/a/79474267
answers question: http://stackoverflow.com/q/79217152
type: Answer
has body: Here is the way which I use: local layout = require("awful.widget.keyboardlayout") local menubar = require("menubar") require("awful.client").property.persist("last_layout", "number") local kbdlayout = { globally_preferred = "us", menubar_preferred = "us", } local function get_idx_by_name(name) if not name then return end for i, v in ipairs(layout.get_groups_from_group_names(awesome.xkb_get_group_names())) do if v.file == name then return i - 1 end end end local oneshot_lock = false local function on_layout_change() if oneshot_lock then oneshot_lock = false return end local c = client.focus if c then c.last_layout = awesome.xkb_get_layout_group() end end local function on_focus_changed(c) local idx = c.last_layout or get_idx_by_name(c.preferred_layout or kbdlayout.globally_preferred) if idx and awesome.xkb_get_layout_group() ~= idx then awesome.xkb_set_layout_group(idx) end end awesome.connect_signal("xkb::map_changed", on_layout_change) awesome.connect_signal("xkb::group_changed", on_layout_change) client.connect_signal("focus", on_focus_changed) local menubar_show = menubar.show local menubar_hide = menubar.hide function menubar.show(...) menubar_show(...) local idx = get_idx_by_name(kbdlayout.menubar_preferred) if idx then oneshot_lock = true awesome.xkb_set_layout_group(idx) end end function menubar.hide(...) menubar_hide(...) local c = client.focus if c then on_focus_changed(c) end end return kbdlayout
score: 0

http://stackoverflow.com/a/79185360
score: 0
has body: your problem is the ::continue:: is inside the loop try this. for i = 1, #backupSource do if i == 2 then goto continue end end ::continue:: Try and let me know
type: Answer
answers question: http://stackoverflow.com/q/79166496

http://stackoverflow.com/q/79104155
type: AnsweredQuestion
has body: 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? local creatureArray = {["White Wyrm"]= { ["dungeon"]= "Cavernam", ["slayer"]= "Beastial", ["difficulty"]= 100.8, ["goldvalue"]= 1008, ["hits"]= 4500, ["mindmg"]= 45, ["maxdmg"]= 55, ["wrestling"]= 105, ["armor"]= 50, ["magicresist"]= 25, ["ai"]= "Melee", ["speed"]= "Medium", ["uniquescaler"]= 1.35 }, } In the example above when I iterate over this entry in the "creatureArray" I need to get the "White Wyrm" 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. 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. I tried just referencing the table since I'm using a for loop to iterate over all of the creatures: for i, creature in pairs(creatureArray) In this example I tried just using "creature", but that references the table object itself and not the key. I'm know I could add a value under each creature called "name", but that just seems redundant.
has comment: http://stackoverflow.com/comment/139483514
upvote count: 1
accepted answer: http://stackoverflow.com/a/79104208
has comment: http://stackoverflow.com/comment/139484159
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/139487104
linked to: http://stackoverflow.com/q/7925090
has answer: http://stackoverflow.com/a/79104208
tagged with: lua
tagged with: lua-table
has comment: http://stackoverflow.com/comment/139487111
has title: Getting the key a value was assigned to in a table in lua
has comment: http://stackoverflow.com/comment/139485507
answer count: 1
score: 1
favorite count: 0

http://stackoverflow.com/comment/139611972
has text: I think you should use another true/false flag to crack this problem.
comment on: http://stackoverflow.com/q/79171090
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/79232356
type: Question
has comment: http://stackoverflow.com/comment/139871602
tagged with: roblox
downvote count: 0
has title: The task.wait script keeps stopping my entire script
answer count: 0
tagged with: lua
has body: I wrote this script: local mob = require(script.mob) local map = workspace["level 0"] local wave = 1 local spawntime = 1 if wave == 1 then task.wait(1) mob.Spawn("wretch", map) end 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 "wait(1)" instead or making it delay longer, but every time it won't work. 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.
score: 1
tagged with: roblox-studio
has comment: http://stackoverflow.com/comment/139729230
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139723563
has comment: http://stackoverflow.com/comment/139926168
has comment: http://stackoverflow.com/comment/140086949
has comment: http://stackoverflow.com/comment/139722447
has comment: http://stackoverflow.com/comment/140021295
has comment: http://stackoverflow.com/comment/140021296
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/139803204
has text: I suggest to go to both repos and add a feature request.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79180391

http://stackoverflow.com/comment/139664935
type: Comment
score: 0
has text: @MindSwipe does the SDK-style format for projects scan the code base recursively? does it scan the nested folders as well?
type: QuestionComment
comment on: http://stackoverflow.com/q/79203398

http://stackoverflow.com/q/79190029
tagged with: writer
has title: Trying to use a the Tutorial's Custom Writer for Pandoc, what CLI options need to use?
has comment: http://stackoverflow.com/comment/139643432
has comment: http://stackoverflow.com/comment/139645285
tagged with: pandoc
answer count: 0
score: 0
type: Question
has comment: http://stackoverflow.com/comment/139645639
has body: I am following the tutorial of the docs, example-modified-markdown-writer I want to try it against the following file input01.html My Document This code will be recognised custom-write01A.lua function Writer (doc, opts) local filter = { CodeBlock = function (cb) -- only modify if code block has no attributes if cb.attr == pandoc.Attr() then local delimited = '```\n' .. cb.text .. '\n```' return pandoc.RawBlock('markdown', delimited) end end } return pandoc.write(doc:walk(filter), 'gfm', opts) end Template = pandoc.template.default 'gfm' Now I can do the default markdown processing by pandoc -f html -t markdown input01.html Or I could be picking the custom writer pandoc -f html input01.html -L custom-writer01.lua Which is giving me My Document This code will be recognised I was expecting the output in the gfm I expected the output to be as specified per code (In a fenced code block) # My Document ``` This code will be recognised ``` Instead we get the in-line codeblock as the same as in -t markdown # My Document ` This code will be recognised `
tagged with: templates
tagged with: lua
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139649963
tagged with: parsing
has comment: http://stackoverflow.com/comment/139643440

http://stackoverflow.com/comment/139499488
type: QuestionComment
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/79112338
score: 0

http://stackoverflow.com/comment/139646068
type: Comment
has text: `match` returns first group as a string by default?
comment on: http://stackoverflow.com/a/79146726
score: 0
type: AnswerComment

http://stackoverflow.com/comment/139487104
score: 0
has text: @TimRoberts I'm a little limited as I'm working with a MediaWiki lua module, I should've mentioned that.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/79104155

http://stackoverflow.com/q/79084408
has answer: http://stackoverflow.com/a/79100682
answer count: 2
tagged with: 3d
tagged with: roblox
tagged with: lua
type: AnsweredQuestion
tagged with: roblox-studio
has answer: http://stackoverflow.com/a/79112340
accepted answer: http://stackoverflow.com/a/79112340
possible better answer: http://stackoverflow.com/a/79100682
has body: 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. 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: task.wait(10) local target = game:GetService("Workspace")["Live Enemies"]["Handcuff Arrest Officer"] local waypoint: Part = nil if target.EnemyInfo.Waypoint.Value == 0 then waypoint = game:GetService("Workspace").SpawnPoint else waypoint = game:GetService("Workspace").Waypoints[target.EnemyInfo.Waypoint.Value] end local studsToMove = 5 -- Make sure the model has a PrimaryPart set if target.PrimaryPart then -- Calculate direction from target's PrimaryPart to waypoint local direction = (waypoint.Position - target.PrimaryPart.Position).unit -- Calculate the new position, moving the PrimaryPart 5 studs in the direction of the waypoint local newPosition = target.PrimaryPart.Position + direction * studsToMove -- Offset the entire model by the same movement, preserving its orientation target.Knockback:Fire() target:SetPrimaryPartCFrame(target.PrimaryPart.CFrame + (direction * studsToMove)) end Additionally, here is the code for the enemy movement script. It uses a no-timeout version of humanoid:MoveTo() from https://create.roblox.com/docs/reference/engine/classes/Humanoid. -- In case the enemy dies before this script can run, pcall blocks errors. pcall(function(...) -- Constants local humanoid = script.Parent.Humanoid local info = script.Parent.EnemyInfo local waypoints = game:GetService(…
type: Question
upvote count: 1
favorite count: 0
has title: Roblox Knockback Skipping Waypoint
tagged with: luau
score: 1
downvote count: 0

http://stackoverflow.com/a/79107999
type: AcceptedAnswer
has body: The answer was just to suck it up and switch to msvc for the vs2022 profile workspace "Wrenderer" configurations { "Debug", "Release"} project "Wrenderer" language "C" targetname "Wrenderer" architecture "x64" kind "StaticLib" outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}" cdialect "C99" targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}") objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.name}") files { "include/**.h", "src/**.c" } libdirs { "./libs/" } includedirs { "./include/" } includedirs { "./include/libs/" } includedirs { os.getenv("VULKAN_SDK") .. "/Include" } links { "vulkan-1", "glfw3" } removefiles { "test/**.**" } filter "configurations:Debug" defines { "DEBUG" } symbols "On" filter "" filter "configurations:Release" optimize "On" filter "" filter "system:windows" defines { "VK_USE_PLATFORM_WIN32_KHR" } filter "" filter "system:linux" defines { "VK_USE_PLATFORM_XLIB_KHR" } filter "" filter "action:gmake" prebuildcommands { "mkdir -p" .. " %[%{wks.location}/Binaries/]", "mkdir -p" .. " %[%{wks.location}/Binaries/Intermediates/]", "mkdir -p" .. " %[%{wks.location}/Binaries/" .. outputdir .. "]", "mkdir -p" .. " %[%{wks.location}/Binaries/Intermediates/" .. outputdir .. "]", } filter "not action:gmake" prebuildcommands { "{MKDIR}" .. " %[%{wks.location}/Binaries/]", "{MKDIR}" .. " %[%{wks.location}/Binaries/Intermediates/]", "{MKDIR} %[%{wks.location}/Binaries/" .. outputdir .. "]", "{MKDIR} %[%{wks.location}/Binaries/Intermediates/" .. outputdir .. "]", } filter "" filter "action:gmake" toolset "clang" buildoptions {"-Wextra", "-Wall"} filter "not action:gmake" toolset "msc" filter"" project "WrenTest" architecture "x64" kind "ConsoleApp" language "C" files { "**.h", "test/**.c" } outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}" cdialect "C99" targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}") objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.…
accepted answer of: http://stackoverflow.com/q/79106182
score: 0
type: Answer
answers question: http://stackoverflow.com/q/79106182

http://stackoverflow.com/q/79132438
type: UnansweredQuestion
score: 1
favorite count: 0
upvote count: 1
has body: I have two Lua functions, getSongLyrics and getSongTitle, whose outputs are displayed in a conky window. getSongLyrics uses a python script that runs sptlrx pipe and outputs it into a FIFO file, which is read by the function and then displayed in conky using conky_displaySongLyrics. getSongTitle uses playerctl to get the title and artist of the current song playing, which is then displayed directly to the conky window using conky_displaySongTitle. The problem happens when a new song plays or is changed, the output display for getSongTitle in the conky wndow only gets updated whenever getSongLyrics is updated (i.e. a new lyric line). This problem is further shown whenever a song doesn't have any lyrics available, thus conky_displaySongLyrics never gets updated, which causes conky_displaySongTitle to never get updated from the previous song, until a song with lyrics plays. I'm assuming that it's because of the FIFO file waiting for a new line from sptlrx pipe that causes this update problem, but I'm not quite sure how to make it so that conky updates getSongTitle independent of getSongLyrics. How do I make it so that these two functions are ran independently from each other, so that conky_displaySongLyrics does not affect conky_displaySongTitle, and vise versa? scripts.lua -- read file and print contents of file function readPrintFile(file) local f = io.open(file, "rb") -- if file doesn't exist, return nil if not f then return nil end local content = f:read("*a") f:close() return content end -- get song title from a music source function getSongTitle() local command = io.popen("playerctl metadata --player spotify --format '{{ artist }} - {{ title }}'", "r") local title = command:read("*l") command:close() return format:gsub("\n", "") end -- get song lyrics from a music source function getSongLyrics() local lyrics = readPrintFile("/tmp/sptlrx_lyrics") or "" return lyrics:gsub("\n", "") end function conky_displaySongTitle() return getSongTitle() end function conky_displ…
type: Question
downvote count: 0
tagged with: conky
answer count: 0
tagged with: fifo
has title: Lua functions for conky doesn't update independently
tagged with: lua

http://stackoverflow.com/q/79106182
has comment: http://stackoverflow.com/comment/139488334
has comment: http://stackoverflow.com/comment/139488320
tagged with: lua
downvote count: 0
tagged with: premake
score: 1
has comment: http://stackoverflow.com/comment/139488712
has comment: http://stackoverflow.com/comment/139488707
has answer: http://stackoverflow.com/a/79107999
has body: I have 2 premake files 1 for my renderer, and one for my engine but when I generate a vs2022 solution via the command premake5 vs2022 trying to build said solution hits me with a 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 Here are the aforementioned solution files workspace "Wrenderer" configurations { "Debug", "Release"} project "Wrenderer" language "C" targetname "Wrenderer" architecture "x64" kind "StaticLib" outputdir = "%{cfg.system}-%{cfg.architecture}/%{cfg.buildcfg}" toolset "clang" cdialect "C99" targetdir("%{wks.location}/Binaries/" .. outputdir .. "/%{prj.name}") objdir("%{wks.location}/Binaries/Intermediates/" .. outputdir .. "/%{prj.name}") files { "include/**.h", "src/**.c" } libdirs { "./libs/" } includedirs { "./include/" } includedirs { "./include/libs/" } includedirs { os.getenv("VULKAN_SDK") .. "/Include" } buildoptions { "-Wextra -Wall" } links { "vulkan-1", "glfw3" } removefiles { "test/**.**" } filter "configurations:Debug" defines { "DEBUG" } symbols "On" filter "" filter "configurations:Release" optimize "On" filter "" filter "system:windows" links { "user32", "msvcrt", "gdi32", "shell32", "libcmt" } defines { "VK_USE_PLATFORM_WIN32_KHR" } filter "" filter "system:linux" defines { "VK_USE_PLATFORM_XLIB_KHR" } filter "" filter "action:gmake" prebuildcommands { "mkdir -p" .. " %[%{wks.location}/Binaries/]", "mkdir -p" .. " %[%{wks.location}/Binaries/Intermediates/]", "mkdir -p" .. " %[%{wks.location}/Binaries/" .. outputdir .. "]", "mkdir -p" .. " %[%{wks.location}/Binaries/Intermediates/" .. outputdir .. "]", } filter "" filter "not action:gmake" prebuildcommands { "{MKDIR}" .. " %[%{wks.location}/Binaries/]", "{MKDIR}" .. " %[%{wks.location}/Binaries/Intermediates/]", "{MKDIR} %[%{wks.location}/Binaries/" .. outputdir .. "]", "{MKDIR} %[%{wks.location}/Binaries/Intermediates/" .. outputdir …
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/139488062
tagged with: c99
has comment: http://stackoverflow.com/comment/139488336
answer count: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/139488329
has comment: http://stackoverflow.com/comment/139488607
has title: Using clang and trying to generate a visual studio solution with premake doesn't compile with "llvm-lib.exe exited with code 1"
accepted answer: http://stackoverflow.com/a/79107999
upvote count: 1
tagged with: http://stackoverflow.com/tag/c

http://stackoverflow.com/q/79112338
downvote count: 0
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139499488
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/139498554
has body: Im making a Raycaster style engine in Love2D, I'm using this function function AngToVec(angle) local one = math.cos(math.rad(angle)) local two = math.sin(math.rad(angle)) local vec = { two, one } return vec end to take player angle and get a normalized vector to apply to movment, and this function to calculate and apply movment to player, player.Rot = AngToVec(player.Angle) local altRot = AngToVec(player.Angle + 90) -- Take input and apply to acceleration player.Accel[1] = ( ((player.Input[1] * altRot[1]) * player.Speed) + ((-player.Input[2] * -player.Rot[1]) * player.Speed) ) player.Accel[2] = ( ((-player.Input[2] * player.Rot[2]) * player.Speed) + ((player.Input[1] * player.Rot[1]) * player.Speed) ) -- Add Acceleration to Velocity for i, v in ipairs(Vec2) do player.Vel[i] = player.Vel[i] + player.Accel[i] end [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.
tagged with: raycasting
tagged with: love2d
upvote count: 1
has comment: http://stackoverflow.com/comment/139504215
favorite count: 0
type: Question
has title: Angle to Normalized Vector seems to only be returning in 45 degree increments

http://stackoverflow.com/a/79092453
answers question: http://stackoverflow.com/q/79091521
upvote count: 2
has body: table.remove (a[1], 1) Do not thank.
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/79080682
has comment: http://stackoverflow.com/comment/139441402
tagged with: c#
answer count: 1
tagged with: http://stackoverflow.com/tag/json
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/139445365
score: 0
has comment: http://stackoverflow.com/comment/139446407
type: Question
has answer: http://stackoverflow.com/a/79083552
accepted answer: http://stackoverflow.com/a/79083552
has comment: http://stackoverflow.com/comment/139442662
tagged with: lua
tagged with: lua-table
has title: How can I parse a LuaTable in C#?
has body: I am at a complete loss with the syntax to parse a LuaTable. I have a table that follows the following structure: mission = { ["coalition"] = { ["blue"] = { ["bullseye"] = { ["y"] = -378451.53125, ["x"] = -178644.117188, }, -- end of ["bullseye"] ["country"] = { [1] = { ["plane"] = { ["group"] = { [1] = { ["hiddenOnPlanner"] = false, ["tasks"] = {}, ["radioSet"] = false, ["task"] = "AFAC", ["uncontrolled"] = false, ["hiddenOnMFD"] = false, ["taskSelected"] = true, ["route"] = {.............. and I am doing the following in my Winforms C# application (just a button triggering this code to test): private void button29_Click_1(object sender, EventArgs e) { Lua lua = new Lua(); string s = File.ReadAllText("C:\\Users\\username\\Desktop\\mission"); lua.DoString(s); var res = lua["mission.coalition.blue.country"]; var bluePlanes = lua["mission.coalition.blue.country.1"]; LuaTable tb = (LuaTable)res; Dictionary<object, object> dict = lua.GetTableDict(tb); Console.WriteLine("First chunk of code:"); foreach (KeyValuePair<object, object> de in dict) { Console.WriteLine("{0} {1}", de.Key.ToString(), de.Value.ToString()); } tb = (LuaTable)bluePlanes ; dict = lua.GetTableDict(tb); Console.WriteLine("Second chunk of code:"); foreach (KeyValuePair<object, object> de in dict) { Console.WriteLine("{0} {1}", de.Key.ToString(), de.Value.ToString()); } } The first chunk works but as soon as I stumble upon one of the elements in square brackets without quotes (e.g. [1]) 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? This is the console output: First chunk of code: 1 table Exception thrown: 'System.ArgumentNullException' in NLua.dll Value cannot be null. However, the information is shown in the Watch window: [![Watch window screenshot][1]][1] Additionally, I thought of converting the table to JSON and using a C# class, but I cannot manage to do that fr…

http://stackoverflow.com/q/79086554
accepted answer: http://stackoverflow.com/a/79086590
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79086590
has title: The question about some behaviors of a.a.a.a in lua
downvote count: 1
type: Question
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/139465909
has body: I was just following the practice in the book. Which is sth like: a = {} a.a = a a.a.a.a = 3 It behaves normally at begin, until i found that it's a.a == 3 , but not a == 3 could someone just tell me why my env: Linux 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio a = {} a.a = a print(a.a.a.a) a.a.a.a = 3 print(a) print(a.a) print(a.a.a) print(a.a.a.a) and it's output is table: 0x562c8c447fc0 table: 0x562c8c447fc0 3 lua5.4: main.lua:37: attempt to index a number value (field 'a') stack traceback: main.lua:37: in main chunk [C]: in ?
tagged with: lua
answer count: 1

http://stackoverflow.com/comment/139489576
type: AnswerComment
has text: 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).
type: Comment
comment on: http://stackoverflow.com/a/79103199
score: 0

http://stackoverflow.com/q/79205736
tagged with: docker
has comment: http://stackoverflow.com/comment/139678156
has comment: http://stackoverflow.com/comment/139669595
type: Question
downvote count: 0
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139678159
tagged with: kong
upvote count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
has title: Kong Gateway: I got an error when I run docker-compose up
tagged with: docker-compose
has comment: http://stackoverflow.com/comment/139670494
has body: Create the kong-gateway container using docker compose, got an error as follow: [lua] globalpatches.lua:84: sleep(): executing a blocking 'sleep' (0.004 seconds), context: init_worker_by_lua* [lua] globalpatches.lua:84: sleep(): executing a blocking 'sleep' (0.002 seconds), context: init_worker_by_lua* [lua] globalpatches.lua:84: sleep(): executing a blocking 'sleep' (0.016 seconds), context: init_worker_by_lua* [lua] globalpatches.lua:84: sleep(): executing a blocking 'sleep' (0.008 seconds), context: init_worker_by_lua* [lua] warmup.lua:53: warming up DNS entries ..., context: ngx.timer [lua] warmup.lua:87: finished warming up DNS entries' into the cache (in 39ms), context: ngx.timer; The kong-gateway command in docker compose file: services: networks: backend: postgres: .... .... .... kong: image: kong/kong-gateway platform: linux/amd64 environment: - KONG_DATABASE=postgres - KONG_PROXY_ACCESS_LOG=/dev/stdout - KONG_ADMIN_ACCESS_LOG=/dev/stdout - KONG_PROXY_ERROR_LOG=/dev/stderr - KONG_ADMIN_ERROR_LOG=/dev/stderr - KONG_ADMIN_LISTEN="0.0.0.0:8001, 0.0.0.0:8444 ssl" - KONG_PG_HOST=postgres - KONG_PG_USER=postgres - KONG_PG_PASSWORD=postgres - KONG_CASSANDRA_CONTACT_POINTS=postgres ports: - 8000:8000 - 8001:8001 - 8002:8002 - 8443:8443 - 8444:8444 command: - kong - start - --vv restart: no networks: - backend But there is no issue when creating the container directly using docker run command: docker run \ -d \ --platform=linux/amd64 \ --name kong \ --network=test_backend \ -e "KONG_DATABASE=postgres" \ -e "KONG_PROXY_ACCESS_LOG=/dev/stdout" \ -e "KONG_ADMIN_ACCESS_LOG=/dev/stdout" \ -e "KONG_PROXY_ERROR_LOG=/dev/stderr" \ -e "KONG_ADMIN_ERROR_LOG=/dev/stderr" \ -e "KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl" \ -e "KONG_PG_HOST=postgres" \ -e "KONG_PG_USER=postgres" \ -e "KONG_PG_PASSWORD=postgres" \ -e "KONG_CASSANDRA_CONTACT_POINTS=postgres" \ -p 8000:8000 \ -p 8001:8001 \ -p 8002:8002 \ -p 8443:8443 \ -p 8444:8444 \ kong/kong-gateway There is no issue with …

http://stackoverflow.com/q/79228105
downvote count: 0
has answer: http://stackoverflow.com/a/79231353
type: AnsweredQuestion
has title: In-place array compaction with least amount of shifting
has answer: http://stackoverflow.com/a/79228131
tagged with: algorithm
favorite count: 0
possible better answer: http://stackoverflow.com/a/79232073
tagged with: arrays
accepted answer: http://stackoverflow.com/a/79228131
type: Question
score: 3
tagged with: lua
answer count: 3
has body: 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. 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). This is the desired outcome: local arr = {1,3,4,-1,6,-1,8,-1,-1} compact(arr) -- arr: {1,3,4,8,6} As you can see we only moved one item, 8 from it's old index 7 (lua uses 1-based indices) to it's new index 4. 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.
has answer: http://stackoverflow.com/a/79232073
upvote count: 3

http://stackoverflow.com/a/79239533
answers question: http://stackoverflow.com/q/79238198
score: 0
type: Answer
has body: As @HighCommander4 mentioned on GitHub .tpp is not a file extension that clang recognizes as a C++ file type. You can nonetheless get clangd to process a .tpp file as C++ if you specify a -xc++ flag explicitly in the compile command (using, for example, a clangd config file). To make code completion work for non-standard C++ file extension, I have to specify -xc++ argument to a compiler, e.g. g++ -xc++ or clang -xc++, because GCC and clang are not recognizing .tpp as C++ file extension. So for clangd, in .clangd config file I have to add an -xc++ argument and it will look like this: CompileFlags: Add: [-xc++] And for ccls .ccls configuration file using GCC compiler it will look like this: g++ -xc++ Hooray! Finally code completion for .tpp file started to work!

http://stackoverflow.com/comment/139442662
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79080682
has text: @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

http://stackoverflow.com/comment/139715460
has text: This code is fully operational. It requests a number and outputs a factorial. (I tested it in VS Code.)
type: QuestionComment
comment on: http://stackoverflow.com/q/79231157
score: 2
type: Comment

http://stackoverflow.com/q/79080159
has answer: http://stackoverflow.com/a/79103199
type: UnansweredQuestion
tagged with: luau
upvote count: 0
score: -1
tagged with: lua
answer count: 1
has body: local UserInputService = game:GetService("UserInputService") local RunService = game:GetService("RunService") local plr = game:GetService("Players").LocalPlayer local char = plr.Character or plr.CharacterAdded:Wait() local hum = char:WaitForChild("Humanoid") local root = hum.RootPart local pcKey = Enum.KeyCode.LeftShift local xboxKey = Enum.KeyCode.DPadLeft local isActive = false function shiftLock() isActive = not isActive if isActive then hum.CameraOffset = Vector3.new(1.75, 0, 0) hum.AutoRotate = false RunService:BindToRenderStep("ShiftLock", Enum.RenderPriority.Character.Value, function() UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter local rootCFrame = root.CFrame local cameraLookVector = workspace.CurrentCamera.CFrame.LookVector local newCFrame = CFrame.new(rootCFrame.Position, rootCFrame.Position + Vector3.new(cameraLookVector.X, 0, cameraLookVector.Z)) root.CFrame = newCFrame end) else hum.CameraOffset = Vector3.new(0, 0, 0) hum.AutoRotate = true RunService:UnbindFromRenderStep("ShiftLock") UserInputService.MouseBehavior = Enum.MouseBehavior.Default end end shiftLock() UserInputService.InputBegan:Connect(function(input, process) if process then return end if input.KeyCode == pcKey or input.KeyCode == xboxKey then shiftLock() end end) Im trying to make a Custom 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.
tagged with: roblox
type: Question
favorite count: 0
downvote count: 1
has title: how to detect another player from

http://stackoverflow.com/comment/139486827
type: AnswerComment
type: Comment
has text: That MoveTo() function is specially modified to bypass the 8-second movement timeout, as in https://create.roblox.com/docs/reference/engine/classes/Humanoid.
comment on: http://stackoverflow.com/a/79100682
score: 0

http://stackoverflow.com/a/79139733
answers question: http://stackoverflow.com/q/79137049
type: Answer
downvote count: 0
score: 2
has body: 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 D1. Note, that distance(A,D1) = distance(B,D1) = distance(D1,T1). You can find a unit vector N, perpendicular to the line AB, and express vector D1 in terms of the midpoint vector M and the vector N, multiplied by a scalar parameter t: D1 = M + t*N (1) The distance(C,T1) is known to be equal to cr, and also it's equal to the sum: distance(C,T1) = distance(C,D1) + distance(D1,T1) = cr This can be rewritten as: distance(C,M + t*N) + distance(A,M + t*N) = cr (2) This is an equation with a single unknown variable t, which can be solved algebraically (it's not easy) - its solutions will give you two points D1 and D2. Another option is to solve this equation numerically, incrementing the parameter t 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). ADDITION #1. 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 bisection method. The code is below: #include <cmath> #include <iostream> #include <boost/math/tools/roots.hpp> #include <CGAL/Simple_cartesian.h> namespace bmt = boost::math::tools; using Kernel = CGAL::Simple_cartesian<double>; using Circle = Kernel::Circle_2; using Point = Kernel::Point_2; using Vector = Kernel::Vector_2; // ------ return vector, corresponding to the point P Vector toVector(Point const& P) { return P - CGAL::ORIGIN; } // ------ return unit vector, corresponding to the vector V Vector unitVector(Vector const& V) { return V / std::sqrt(V.squared_length()); } // ------ return the end point of the vector with origin in (0,0) Point endPoint(Vector const& V) { return CGAL::ORIGIN + V; } // ------ return the point of intersection of the circle C a…
upvote count: 2

http://stackoverflow.com/comment/139589203
type: QuestionComment
comment on: http://stackoverflow.com/q/79162067
type: Comment
has text: 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`.
score: 0

http://stackoverflow.com/q/79162067
has comment: http://stackoverflow.com/comment/139589219
type: UnansweredQuestion
tagged with: neovim
has comment: http://stackoverflow.com/comment/139589214
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/79162674
has comment: http://stackoverflow.com/comment/139589177
favorite count: 0
type: Question
downvote count: 0
has body: I have the following lua function: function GET_STRING() return "THE_STRING" end I want to press : to enter command mode and execute the lua function so the final command looks like :THE_STRING. Context: I want to create a keybinding which automatically creates this command.
has title: How to get output of lua function in command line
tagged with: lua
has comment: http://stackoverflow.com/comment/139589203
score: 1

http://stackoverflow.com/q/79126377
tagged with: wireshark
has body: 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. Problem Description 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. Changes in Wireshark 4.4.2 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. Relevant Code Here is the part of the code where the issue seems to occur. Does anyone have an idea what might be causing this issue with the new version? Thanks in advance! local json = require "json" local ws = Proto("ws", "WS") local identifier = "03" -- Function to recursively parse and display JSON data local function parse_json(json_data, tree) for key, value in pairs(json_data) do if type(value) == "table" then local subtree = tree:add(ws, string.format("%s: ", key)) parse_json(value, subtree) else tree:add(ws, string.format("%s: %s", key, tostring(value))) end end end function ws.dissector(buffer, pinfo, tree) local id = buffer(0, 12):bytes():tohex() if id:sub(-2) == identifier then pinfo.cols.protocol = "ws" local subtree = tree:add(ws, buffer(), "ws Data") subtree:add(buffer(0, 12), "Identification: " .. id) subtree:add("----------------------------------------") local data = buffer(12, buffer:len() - 12) local data_string = tostring(data:string()) -- Clean up the data string by removing unwanted characters data_string = data_string:gsub("\r\n", ""):gsub("\n", ""):gsub("\t", ""):gsub("[\128-\255]", ""):gsub("UUUU$", "") print("Debug: Extracted Data String = " .. data_string) -- Parse JSON data using the json.decode function from json.lua local status, json_data = pcall(json.decode, data_string) if not status or type(json_data) ~= "t…
answer count: 0
tagged with: lua
type: Question
type: UnansweredQuestion
has title: Wireshark plugin not working after update
has comment: http://stackoverflow.com/comment/139526444
score: 0

http://stackoverflow.com/a/79091793
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/139466920
type: Answer
answers question: http://stackoverflow.com/q/79090659
has body: The behavior of table.remove depends on the result of the length operator (#), 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 # and the table library functions, you have to construct your arrays without nils in them. Relevant docs: table.remove The Length Operator

http://stackoverflow.com/q/79160215
tagged with: ellipse
tagged with: lua
type: Question
tagged with: focus
tagged with: intersection
has body: I am currently working on a project in Lua that involves calculating the intersection points of two ellipses that share a common focus O. The 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). (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) The code for eliipses: local f0 = {x=400, y=300, r=290} local function newEllipse (x, y) local r = f0.r local ellipse = {f0 = f0, f= {x=x, y=y}} ellipse.c = length(f0.x, f0.y, x, y)/2 print ('c', ellipse.c) local p = (f0.r - 2*ellipse.c)/2 print ('p', p) ellipse.a = ellipse.c + p print ('a', ellipse.a) ellipse.b = math.sqrt(ellipse.a^2 - ellipse.c^2) ellipse.alpha = math.atan2 (y-f0.y, x-f0.x) print ('alpha', ellipse.alpha) local vertices = {} local numPoints = 32 for i = 1, numPoints do local t = (i / numPoints) * (2 * math.pi) local x = (f0.x + x) / 2 + ellipse.a * math.cos(t) * math.cos(ellipse.alpha) - ellipse.b * math.sin(t) * math.sin(ellipse.alpha) local y = (f0.y + y) / 2 + ellipse.a * math.cos(t) * math.sin(ellipse.alpha) + ellipse.b * math.sin(t) * math.cos(ellipse.alpha) -- print (x, y) table.insert (vertices, x) table.insert (vertices, y) end ellipse.vertices = vertices return ellipse end local e1 = newEllipse (500, 300) local e2 = newEllipse (400, 500) How can I find the points T1 and T2? Actually, it looks like a solution for PPC Apollonius Problem: Each circle's middle point is the ellipse and the radius to the own focus of it, it touches the circle with tangent! Update: I've found the solution for not inclined ellipses: x = f*d y = f*sqrt(1-d^2) -- where d is cos theta: d = (t1 - t2)/(t1*e2 - t2*e1) t1 = 1-e1^2 -- also t1 = b^2/a^2 t2 = 1-e2^2 -- f is radius for this theta: f = a*t1/(1-e1*d) Example: https://www.desmos.com/calculator/5mhzyskoei
accepted answer: http://stackoverflow.com/a/79165588
has title: Intersection of Two Ellipses with a Common Focus, Lua
has answer: http://stackoverflow.com/a/79165588
answer count: 1
score: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/139570249
comment on: http://stackoverflow.com/a/79151155
has text: 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.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/139664850
comment on: http://stackoverflow.com/q/79203333
type: Comment
score: 0
type: QuestionComment
has text: @shingo I know, and I am asking about what that line should be to achieve reliable name-based destructuring

http://stackoverflow.com/comment/139664976
type: Comment
has text: @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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79203398

http://stackoverflow.com/q/79090659
type: Question
downvote count: 0
score: 2
tagged with: lua
has title: table.remove() in lua 5.4 is strange
answer count: 1
type: UnansweredQuestion
favorite count: 0
upvote count: 2
has body: I try to remove nil from table, but table.remove() in lua 5.4 is strange: a = { nil, -0.0227, nil, -0.1157, nil, 0.0191, 0.1476, nil, nil,nil, nil, 0.1714, nil, -0.0681}; print("table a size:",#a); tb_size = #a; for j = tb_size,1,-1 do print(j,"==", 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],"tb size:",#a) if not a[j] then print("remove:",j,a[j]); table.remove(a,j); print(j,"--", 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],"tb size:",#a); end --if end --for this code alwasy report error: bad argument #1 to 'remove' (position out of bounds), the table size will suddenly become 7 from 14. enter image description here I try to remove nil from table , but table.remove() do not work , always report "position out of bounds", what is wrong ??
has answer: http://stackoverflow.com/a/79091793
tagged with: lua-5.4

http://stackoverflow.com/comment/139488334
comment on: http://stackoverflow.com/q/79106182
type: QuestionComment
has text: What is the full error message (from output panel), the one from error panel is mostly a resume.
type: Comment
score: 0

http://stackoverflow.com/comment/139543582
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79137236

http://stackoverflow.com/comment/139451311
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79086590
has text: thanks, this answers my question very well
type: Comment

http://stackoverflow.com/a/79113541
has comment: http://stackoverflow.com/comment/139543628
has comment: http://stackoverflow.com/comment/139525874
type: AcceptedAnswer
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/139522552
accepted answer of: http://stackoverflow.com/q/79113391
answers question: http://stackoverflow.com/q/79113391
score: 2
downvote count: 0
has body: I assume he meant this patch. You need to add the NORETURN attribute to LongJump: MdePkg/Include/Library/BaseLib.h InternalLongJump: MdePkg/Library/BaseLib/BaseLibInternals.h In addition to the changes in the patch, you also need to add it to: longjmp: StdLib/Include/setjmp.h

http://stackoverflow.com/comment/139487111
type: QuestionComment
comment on: http://stackoverflow.com/q/79104155
score: 0
has text: [https://www.mediawiki.org/wiki/Extension:Scribunto]
type: Comment

label
tags question: http://stackoverflow.com/q/79166496
type: Tag
tag name: label

http://stackoverflow.com/comment/139643440
comment on: http://stackoverflow.com/q/79190029
has text: you mean you want the output format to be `gfm`? then run `pandoc -t gfm -f html input01.html -L custom-writer01.lua`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139548192
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79139400
has text: 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.
type: Comment

http://stackoverflow.com/q/79158510
score: 0
type: Question
has body: My operating system is Windows 10 64 bit, and the downloaded version of Lua's sdl library is LuaSdl2_2.0.5-6.0 My operation steps are as follows: First, download the SDL-Release-2.0.5.zip source code from GitHub Download the Luasdl2_2.0.5-6.0.zip source code again Unzip SDL-Release-2.0.5.zip source code Add three projects (SDL, SDLMain, SDLtest) under the source code directory of SDL-lease-2.5.5 in Visual C to my solution The compilation of SDL, SDLMain, and SDLtest projects resulted in SDL2.dll, SDL2.lib, SDLMain.lib, and SDLtest.lib 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 You can view the content shown in the picture Unable to upload image!!! (1) SDL(not lua) project: step-1: add existing item from SDL-release-2.0.5\VisualC DIR. step-2: build SDL2.dll、SDL2.lib、SDL2main.lib、SDL2test.lib is ok. (2) lua SDL project: step-1: add existing item from luasdl2-2.0.5-6.0\src DIR step-2: Configuration Properties-->C/C++-->General-->Additional Dependencies--> include "xxx\SDL-release-2.0.5\include" DIR include "xxx\luasdl2-2.0.5-6.0\src", using common DIR include "xxx\luasdl2-2.0.5-6.0\rocks" include "xxx\luasdl2-2.0.5-6.0\extern\queen", using sys\queen.h include "xxx\lua547\src" step-3: Linker-->General-->Additional Library Directories--> add my lua54.lib、SDL2.lib、SDL2main.lib、SDL2test.lib, and SDL2.dll copy to lua.exe Release DIR -->Input: lua54.lib, SDL2.lib, SDL2main.lib, SDL2test.lib step-4: build lua SDL project step-5: as follows 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. I 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. My configuration options are Release and x86 If you know what the problem is, feel free to give me some tip…
answer count: 0
type: UnansweredQuestion
tagged with: lua
has comment: http://stackoverflow.com/comment/139582605
has title: Error compiling Lua's SDL.dll library using Visual Studio 2019

pandoc-citeproc
tags question: http://stackoverflow.com/q/79175075
type: Tag
tag name: pandoc-citeproc

http://stackoverflow.com/a/79139040
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/139550810
type: AcceptedAnswer
type: Answer
upvote count: 1
has body: This should work, but the custom styles must already exist in the reference odt. To create the reference ODT, first run pandoc --output=my-refdoc.odt --print-default-data-file=reference.odt Edit the resulting file my-refdoc.odt, add the custom styles, and then pass the modified file to pandoc via --reference-doc=my-refdoc.odt when doint the conversion. The filter should set the custom-style attribute, so the code should use {['custom-style'] = "StrongEmphasis"}. Everything should work once those things are in place.
accepted answer of: http://stackoverflow.com/q/79137236
answers question: http://stackoverflow.com/q/79137236

http://stackoverflow.com/q/79077823
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/79077986
type: Question
upvote count: 1
has title: Lua option -l "module 'lib1.lua' not found"
has body: One of the first examples in the Lua book is a function that's saved in a file called lib1.lua. The file works as expected when loaded via dofile: % lua > dofile("lib1.lua") > twice(3) 6.0 But the file is not found when loaded via the -l option: % lua -i -llib1.lua -e "print(twice(3))" Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio lua: module 'lib1.lua' not found: no field package.preload['lib1.lua'] no file '/usr/share/lua/5.4/lib1/lua.lua' no file '/usr/share/lua/5.4/lib1/lua/init.lua' no file '/usr/lib64/lua/5.4/lib1/lua.lua' no file '/usr/lib64/lua/5.4/lib1/lua/init.lua' no file './lib1/lua.lua' no file './lib1/lua/init.lua' no file '/usr/lib64/lua/5.4/lib1/lua.so' no file '/usr/lib64/lua/5.4/loadall.so' no file './lib1/lua.so' no file '/usr/lib64/lua/5.4/lib1.so' no file '/usr/lib64/lua/5.4/loadall.so' no file './lib1.so' stack traceback: [C]: in function 'require' [C]: in ? lib1.lua is in the current folder where the script is being executed: % ls lib1.lua Why is the -l option not finding lib1.lua?
tagged with: lua
has answer: http://stackoverflow.com/a/79077986

http://stackoverflow.com/q/79165928
type: Question
tagged with: roblox
has body: local ProximityPrompt = script.Parent ProximityPrompt.Triggered:Connect(function(Player) wait(1) Player.Character.HumanoidRootPart.Position = game.Workspace.Orchooselimbo.Position end) This script comes from ThenRemember's rig. Orchooselimbo's script is the same except its swapped to ThenRemember. The script files are in the correct destination I believe ThenRemember > ProximityPrompt > Script Orchooselimbo > ProximityPrompt > Script Orchooselimbo is a rig, and basically i'm trying to teleport from "ThenRemember" to "Orchooselimbo" using a proximity prompt. The prompt does appear but when I click it it does nothing. Any idea how to fix this? These are both rigs by the way I tried changing some letters to capital ones and i tried changing the symbols. Everything results in an error I do know how to fix, but this one just makes it so hard
tagged with: lua
answer count: 1
has answer: http://stackoverflow.com/a/79167596
type: UnansweredQuestion
has title: Position is not a valid member of model "Workspace.Orchooselimbo"
score: 0

http://stackoverflow.com/q/79234493
answer count: 0
score: 0
has body: I am attempting to make a program in Lua to sprint while shifting however im getting an "attempt to index nil" error local UserInputSerive = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild("Humanoid") UserInputSerive.InputBegan:Connect(function(input, gameProcessed) if input.KeyCode == Enum.KeyCode.LeftShift then Humanoid.WalkSpeed = 35 end end) UserInputSerive.InputEnded:Connect(function(input, gameProcessed) if input.KeyCode == Enum.KeyCode.LeftShift then Humanoid.WalkSpeed = 16 end end)
type: Question
has comment: http://stackoverflow.com/comment/139724129
has title: Shift To Sprint
tagged with: lua
has comment: http://stackoverflow.com/comment/139722131
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139722180

http://stackoverflow.com/q/79141463
has title: How to remove a prefix from a string in lua?
has answer: http://stackoverflow.com/a/79146726
favorite count: 0
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/139551539
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/79141472
tagged with: lua
has answer: http://stackoverflow.com/a/79141625
has body: Like Python's string.removeprefix(prefix) or bash's ${string#"$prefix"}, how can I similarly remove a known prefix from a string in lua? local str = 'onetwothree' local prefix = 'one' local suffix = removeprefix(str, prefix) --> 'twothree' 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.
upvote count: 2
answer count: 3
type: Question

http://stackoverflow.com/comment/139627893
type: Comment
score: 0
has text: @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.
type: AnswerComment
comment on: http://stackoverflow.com/a/79179832

http://stackoverflow.com/q/79238198
downvote count: 0
tagged with: code-completion
linked to: http://stackoverflow.com/q/79231569
has title: Why does code completion not work for ".tpp" file extension in Neovim?
type: Question
has comment: http://stackoverflow.com/comment/139727342
tagged with: file-extension
tagged with: lua
has answer: http://stackoverflow.com/a/79239533
has comment: http://stackoverflow.com/comment/139727479
has comment: http://stackoverflow.com/comment/139727330
has body: I have installed nvim-lspconfig and nvim-cmp plugins for Neovim. A code completion with ccls works pretty well for .cpp and .hpp file extensions. I want to make code completion to also work with .tpp file extension. I have created tpp.vim file inside ~/.config/nvim/ftdetect directory, which contains au BufRead,BufNewFile *.tpp set filetype=cpp Vim script. After doing this, syntax highlighting started to work for .tpp file, but code completion not. vim.filetype.add({ extension = { tpp = "cpp", }, }) I have also added these lines of code inside ~/.config/nvim/init.lua file, code completion still not wants to start working. So with all of that I have done - only syntax highlighting started to work for .tpp file extension, but code completion not. How can I make code completion to also start working for this file extension? lspconfig: require("lspconfig.health").check() LSP configs active in this session (globally) ~ - Configured servers: ccls - OK Deprecated servers: (none) LSP configs active in this buffer (bufnr: 1) ~ - Language client log: ~/.local/state/nvim/lsp.log - Detected filetype: `cpp` - 1 client(s) attached to this buffer - Client: `ccls` (id: 1, bufnr: [1]) root directory: ~/TurboINI/ filetypes: c, cpp, objc, objcpp, cuda cmd: /usr/local/bin/ccls version: `Debian ccls version 0.20241108-2-g4331c895` executable: true autostart: true Even tho LSP detected that this file's extension is related to C++, but code completion still not wants to work: I assume that solution to this is hiding in ccls and not in Neovim plugins. P.S. I have found an article on how to make a specific file extensions behave exactly like standard C++ extensions on vi.stackexchange.com, I have tried it out and ccls 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 #include <iostream> its database will only contain #include and <iostream> and nothing else.
upvote count: 2
tagged with: c++
score: 2
tagged with: neovim
answer count: 1
type: UnansweredQuestion
favorite count: 0

file-extension
tags question: http://stackoverflow.com/q/79238198
type: Tag
tag name: file-extension

http://stackoverflow.com/comment/139526966
type: Comment
score: 0
type: AnswerComment
has text: 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).
comment on: http://stackoverflow.com/a/79124389

http://stackoverflow.com/comment/139546976
comment on: http://stackoverflow.com/q/79137049
type: QuestionComment
has text: Not really a Lua question
type: Comment
score: 1

http://stackoverflow.com/comment/139722180
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/79234493
score: 0
type: QuestionComment

http://stackoverflow.com/q/79166496
score: 0
tagged with: goto
tagged with: go
type: Question
has answer: http://stackoverflow.com/a/79185360
has title: How to use 'goto' in gopher-lua v1.1.0?
tagged with: lua
has body: How to use 'goto' in gopher-lua v1.1.0? Is seems that gopher-lua has already support 'goto' over v1.1.0 link I have already update gopher-lua's version in v1.1.0. But when I use goto goto and ::label:: statement like this for i = 1, #backupSource do if i == 2 then goto continue end ::continue:: end It get error near '::': syntax error If someone could enlight me a bit that would be great :-) Thanks in advance
upvote count: 1
tagged with: label
answer count: 1
type: UnansweredQuestion
favorite count: 0
downvote count: 1

http://stackoverflow.com/q/79140278
tagged with: lua
type: UnansweredQuestion
tagged with: quarto
has body: 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. 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: \begin{minipage}[t]{\textwidth - 5.5mm} (my items, don’t remove these) \end{minipage} everything renders perfectly. The ideal solution would be to create a Lua filter that removes both \begin{minipage}[t]{\textwidth - 5.5mm} and the corresponding \end{minipage}. I've tried writing a Lua filter for this purpose; see https://github.com/produnis/minimal_examples/tree/longlist for a minimal example. 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? This is my script: local in_calloutlonglist = false function Div(el) if el.classes:includes("calloutlonglist") then in_calloutlonglist = true local processed_content = {} for _, elem in ipairs(el.content) do table.insert(processed_content, elem:walk({ RawBlock = function(raw_el) if raw_el.format == 'latex' then local start_pattern = "\\begin%{minipage%}%[t%]%{\\textwidth - 5.5mm%}" local end_pattern = "\\end%{minipage%}" raw_el.text = raw_el.text:gsub(start_pattern, "") raw_el.text = raw_el.text:gsub(end_pattern, "") end return raw_el end })) end in_calloutlonglist = false return pandoc.Div(processed_content, el.attr) end end
has comment: http://stackoverflow.com/comment/139556639
has comment: http://stackoverflow.com/comment/139558005
score: 0
tagged with: pandoc
answer count: 0
type: Question
has title: filter to find and replace pattern in .tex before rendering to PDF in quarto

http://stackoverflow.com/q/79213245
has title: :GetChildren() seemingly returning an empty table?
has answer: http://stackoverflow.com/a/79217754
tagged with: luau
tagged with: lua
type: Question
tagged with: roblox
has body: 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 here's the script (the print functions are temporary and it will not print "Found betplacer") local p = game.Players.LocalPlayer function canBet() return true--p:FindFirstChild("CanBet").Value end function bet(event:RemoteEvent, racer:Instance, tokens:number) if canBet() then event:FireServer(tokens, racer) end end for _, machine in pairs(workspace.Machines:GetChildren()) do if machine.Name == "RacingHeads" then local placers = machine.Placers:GetChildren() print("Found RacingHeads") for _, v in pairs(placers) do local event = v.Parent.Parent:FindFirstChild("Bet") local racer = v:FindFirstChild("Racer").Value local gui = v:FindFirstChild("BetGui") local button:TextButton = gui.Submit local function quickbet() local tokens = tonumber(gui.Amount.Text) print("Bet on RacingHeads") bet(event, racer, tokens) end print("Found betplacer") button.MouseButton1Click:Connect(quickbet) button.TouchTap:Connect(quickbet) end end end
has comment: http://stackoverflow.com/comment/139682671
answer count: 1
type: UnansweredQuestion
score: 0

http://stackoverflow.com/q/79165559
answer count: 1
tagged with: firmware
has title: Building nodemcu (lua) esp32-dev firmware with u8g2 support does not include requested display driver
type: Question
tagged with: lua
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/79299605
tagged with: nodemcu
score: 0
tagged with: esp32
has body: nodemcu esp32-dev branch cloned to raspberry pi 5. Firmware built with basic modules seems fine, bin files are produced and flashed to espressif esp32-wroom-32 (also generic 32E, dev kit 1,...) using esptool. However adding u8g2 for i2c using make menuconfig and then make results in a missing u8g2.ssd1306_i2c_128x64_noname. Of note, the 3 fonts selected are present, e.g. u8g2.font_6x10_tf. Of possible interest, make shows this /home/pi/esp32/nodemcu-firmware-esp32-241010a/components/modules/u8g2.c:617:12: warning: 'ldisplay_i2c' defined but not used [-Wunused-function] 617 | static int ldisplay_i2c( lua_State *L, display_setup_fn_t setup_fn ) Expecting something like this (from esp8266, but chilipeppr esp32 static firmware would look similar and does work fine for this example) for k,v in pairs(u8g2) do print(k,v) end ssd1306_i2c_128x64_noname function: 0x4024c0b8 uc1601_i2c_128x32 function: 0x4024c09c ssd1306_i2c_128x32_univision function: 0x4024c080 ssd1305_i2c_128x32_noname function: 0x4024c064 ssd1306_128x64_noname function: 0x4024c0f8 font_6x10_tf lightfunction: 0x4027e800 font_unifont_t_symbols lightfunction: 0x4027c518 DRAW_UPPER_RIGHT 1 DRAW_UPPER_LEFT 2 DRAW_LOWER_RIGHT 8 DRAW_LOWER_LEFT 4 DRAW_ALL 15 R0 lightfunction: 0x4027f014 R1 lightfunction: 0x4027f008 R2 lightfunction: 0x4027effc R3 lightfunction: 0x4027eff0 MIRROR lightfunction: 0x4027efe4 With esp32 builds, I get this (missing display drivers) for k,v in pairs(u8g2) do print(k,v) end font_6x10_tf userdata: 0x3f40a51e font_unifont_t_symbols userdata: 0x3f408236 font_chikita_tf userdata: 0x3f407ae5 DRAW_UPPER_RIGHT 1 DRAW_UPPER_LEFT 2 DRAW_LOWER_RIGHT 8 DRAW_LOWER_LEFT 4 DRAW_ALL 15 R0 userdata: 0x3f40ad30 R1 userdata: 0x3f40ad24 R2 userdata: 0x3f40ad18 R3 userdata: 0x3f40ad0c MIRROR userdata: 0x3f40ad00 Searching the make listing shows things that may be of interest. Including the following modules: FILE;GPIO;HTTP;I2C;NET;NODE;OW;PIPE;TMR;U8G2;UART;WIFI awk: line 2: function strtonum never defined a…

http://stackoverflow.com/q/79139400
upvote count: 1
answer count: 1
favorite count: 0
has body: I installed Love2D and the Love2D Support extension for VS Code. I can run Love2D from the command line ($ love). In addition, $ which love provides the app's path (usr/bin/love). Typing $ usr/bin/love runs the app and I can see it in my file explorer. Adding the path to the Love2D extension and running an app (Alt-L) gives me an error: Path specified in pixelbyte.love2d.path '/usr/bin/love' does not exist. Check your settings. Here's the weirdest part (to me): If I activate the terminal within VS Code and type sh-5.2$ which love I get the message: Path specified in pixelbyte.love2d.path '/usr/bin/love' does not exist. Check your settings.
tagged with: linux
type: Question
tagged with: visual-studio-code
downvote count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/79141898
accepted answer: http://stackoverflow.com/a/79141898
score: 1
tagged with: love2d
has comment: http://stackoverflow.com/comment/139548192
has title: How to get VSCode's Love2D Support extension to recognize my path?
type: AnsweredQuestion

http://stackoverflow.com/a/79138165
score: 0
has body: I've found the issue. Using eth_withoutfcs rather than eth within Dissector.get() solved the issue.
answers question: http://stackoverflow.com/q/79138011
type: Answer

http://stackoverflow.com/q/79175075
answer count: 0
tagged with: lua
type: Question
tagged with: pandoc-citeproc
has body: I'm trying to create a lua script that does the following with pandoc and its internal citeproc: The current input is: (MPD; [@Somereference2020 noparens]) The desired output is: (MPD; Somereference, 2020) with the correct internal link to citeproc references. I'm close, but I can't seem to wrangle removing the preceding space before noparens on the output. Current output is: (MPD; Somereference, 2020 ) Note the space after the year which I've been able to debug to being the preceding space before the noparens (based on the debug output with carrots). Thanks in advance to the Lua ninja ... Here's the code function Cite(cite) for i, citation in ipairs(cite.citations) do if citation.suffix and pandoc.utils.stringify(citation.suffix):match("noparens") then -- Debugging: Print the original suffix print("Original suffix:", pandoc.utils.stringify(citation.suffix)) -- Remove 'noparens' from the suffix local new_suffix = pandoc.List{} for _, item in ipairs(citation.suffix) do if item.t == "Str" then -- Remove 'noparens' and trim spaces/commas item.text = item.text:gsub("noparens", ""):gsub("^%s*,%s*", ""):gsub("%s*,%s*$", "") if item.text ~= "" then new_suffix:insert(item) end else new_suffix:insert(item) end end citation.suffix = new_suffix -- Debugging: Print the modified suffix print("Modified suffix:", pandoc.utils.stringify(citation.suffix)) -- Debugging: Print the original content print("Original content:", pandoc.utils.stringify(cite.content)) -- Remove 'noparens' and unnecessary parentheses from the content local new_content = pandoc.List{} for _, item in ipairs(cite.content) do if item.t == "Str" then -- Remove 'noparens' and parentheses item.text = item.text:gsub("noparens", ""):gsub("%(", ""):gsub("%)", ""):gsub("^%s*,%s*", ""):gsub("%s*,%s*$", "") end if item.text ~= "" then new_content:insert(item) end end cite.content = new_content -- Debugging: Print the modified content print("Modified citation: ^" .. pandoc.utils.stringify(cite) .. "^") return cite end end …
has title: Lua Pandoc Citation Modifier
tagged with: pandoc
type: UnansweredQuestion
score: 0

http://stackoverflow.com/a/79151785
type: Answer
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/79151316
has body: I have a similar filter that appears to work -- there's a pretty frustrating hiccup, though, as I'll try to explain below. 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. Given this filter (classfilter.lua on the LUA_PATH): -- split arglist by lpeg, function as it appears on lpeg documentation: -- https://www.inf.puc-rio.br/~roberto/lpeg/ local function split(s, sep) sep = lpeg.P(sep) local elem = lpeg.C((1 - sep) ^ 0) local p = lpeg.Ct(elem * (sep * elem) ^ 0) -- make a table capture return lpeg.match(p, s) end local keeplist = {} -- This function will go inside the Meta filter -- the keeplist table will be available to the rest -- of the filters to consult local function collect_vars(m) for _, classname in pairs(split(m.keeplist, ",")) do keeplist[classname] = true end end local function keep_elem(_elem) -- keep if no class designation if not _elem.classes or #_elem.classes == 0 then return true end -- keep if class name in keeplist for _, classname in ipairs(_elem.classes) do if keeplist[classname] ~= nil then return true end end -- don't keep otherwise return false end local function filter_list_by_classname(_elems) for _elemidx, _elem in ipairs(_elems) do if not keep_elem(_elem) then _elems:remove(_elemidx) end end return _elems end -- forcing the meta filter to run first return { { Meta = collect_vars }, { Inlines = filter_list_by_classname, Blocks = filter_list_by_classname } } -- and this pandoc cli command: pandoc -f markdown -t markdown --lua-filter=classfilter.lua <YOUR EXAMPLE INPUT> -M 'keeplist=other,bw-only' -- I get the following output: ## Images ![Generic image](generic_image.png) ![Generic image](generic_image.png){width="30px"} Color only image Color only image Color only image ![BW only image](bw_image.p…

http://stackoverflow.com/q/79180391
answer count: 0
score: 0
has body: I have a project at work that uses premake5 for configuration. In VSCode, I have the sumneko.lua extension installed. Premake defines a large number of functions and other properties that we use, however all of our premake5.lua files appear with warning underlines beneath anything defined in premake (normal lua standard library stuff seems fine). How can I configure our VSCode project such that we get better language server results (and no warnings) for the premake-defined stuff?
type: Question
has title: How can I set up VSCode to recognize premake5's global functions and not warn me about them?
has comment: http://stackoverflow.com/comment/139803160
has comment: http://stackoverflow.com/comment/139803204
tagged with: lua
tagged with: premake
type: UnansweredQuestion

http://stackoverflow.com/q/79194247
has body: 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 print(pcall(....)). Case 1: ▶ lua5.4 -e 'print(pcall(os.execute, "sleep 5"))' true nil signal 2 The first true comes from pcall and it indicates that the call to os.execute completed successfully, but the rest of the output (the return values from os.execute) says that the call has actually failed, because it has been interrupted by the signal 2 (SIGINT). Case 2: ▶ lua5.4 -e 'print(pcall(io.read))' false interrupted! Here it looks like the pcall itself has been interrupted, not io.read, but at least we get an error from pcall. Case 3: ▶ lua5.4 -e 'print(pcall(function() for _ in io.lines() do end end))' lua5.4: (command line):1: interrupted! stack traceback: [C]: in function 'pcall' (command line):1: in main chunk [C]: in ? Here pcall is simply ignored, and this happens each time io.lines or file:lines get interrupted. Interestingly, if I wrap this code in another pcall, then that outer pcall will behave as expected. 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? (I have tried Lua versions 5.4 and 5.3, and they both produce the same result.) UPDATE: Here is the comment on this issue from Roberto Ierusalimschy.
type: UnansweredQuestion
favorite count: 0
has title: Lua pcall inconsistency while dealing with SIGINT on Linux
score: 3
has comment: http://stackoverflow.com/comment/139734495
downvote count: 0
answer count: 0
tagged with: linux
upvote count: 3
type: Question
tagged with: lua

http://stackoverflow.com/comment/139573128
type: Comment
score: 1
has text: Please provide enough code so others can better understand or reproduce the problem.
type: QuestionComment
comment on: http://stackoverflow.com/q/79152919

http://stackoverflow.com/a/79083552
upvote count: 2
has body: Unlike Lua, C# is a strongly typed language. So 1 is a number, and "1" is a string containing the character 1 and they can't be used interchangeably. Your line lua["mission.coalition.blue.country.1"]; is looking for the element with key "1" - a string key - on "country" and it can't find it, so you get a null returned. 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# long type. public void LuaTest() { const string luaData = @"coalition = { [""blue""] = { [""country""] = { [1] = { [""hiddenOnPlanner""] = false, [""tasks""] = {}, [""radioSet""] = false } } } }"; Lua lua = new Lua(); lua.DoString(luaData); var country = lua["coalition.blue.country"] as LuaTable; if (country is null) throw new InvalidOperationException("Didn't find coalition.blue.country"); var bluePlanes = country[1L] as LuaTable; if (bluePlanes is null) throw new InvalidOperationException("Didn't find item 1 on country"); var dict = lua.GetTableDict(bluePlanes); Console.WriteLine("Second chunk of code:"); foreach (KeyValuePair<object, object> de in dict) { Console.WriteLine($"{de.Key} {de.Value}"); } } You'll notice that I've also added some checks for null. This is good practice: instead of a NullReferenceException at some point later in the code, you know exactly when something returned null that you were not expecting. Output: Second chunk of code: radioSet False hiddenOnPlanner False tasks table
accepted answer of: http://stackoverflow.com/q/79080682
answers question: http://stackoverflow.com/q/79080682
downvote count: 0
type: AcceptedAnswer
type: Answer
score: 2

intersection
tags question: http://stackoverflow.com/q/79160215
type: Tag
tag name: intersection

http://stackoverflow.com/a/79209782
score: 0
type: Answer
has body: It won't work as such, since table.unpack works with numbered indices. In other words, local name, age = unpack(person) is mostly equivalent to: local name, age = person[1], person[2] There is no built-in unpacking function for named keys. So you just have to write it explicitly as: local name, age = person.name, person.age Note that there is no correspondance between number and string keys at all. When you write: local t = { x = true } You cannot refer to t.x or t['x'] with t[1]. They are in completely separate table slots.
answers question: http://stackoverflow.com/q/79203333

profiler
type: Tag
tags question: http://stackoverflow.com/q/79110440
tag name: profiler

http://stackoverflow.com/q/79234692
has answer: http://stackoverflow.com/a/79235336
tagged with: lua
has title: Lua inheritance and instanceof
tagged with: instanceof
tagged with: inheritance
type: UnansweredQuestion
has body: I'm trying to port some Java code to Lua, while maintaining class inheritance I want to use an instanceof Lua implementation. Here are the modules I define: -- ClientWidget class local ClientWidget = {} ClientWidget.__index = ClientWidget ClientWidget.ClassName = "ClientWidget" local AbstractClientObject = require("df.AbstractClientObject") setmetatable(ClientWidget, {__index = AbstractClientObject}) function ClientWidget.new() local self = {} setmetatable(self, ClientWidget) AbstractClientObject.init(self) ClientWidget.init(self) return self end And, -- AbstractClientObject class local AbstractClientObject = {} AbstractClientObject.__index = AbstractClientObject AbstractClientObject.ClassName = "AbstractClientObject" function AbstractClientObject.new() local self = {} setmetatable(self, AbstractClientObject) AbstractClientObject.init(self) return self end InstanceOf is implemented as following: function Object.isInstanceOf(object, className) if not object then return false end -- Récupère la métatable de l'objet local mt = getmetatable(object) while mt do if mt.ClassName == className then return true end -- Remonte la chaîne d'héritage mt = getmetatable(mt) end return false end If I do: local widget = ClientWidget.new() Object.isInstanceOf(widget, "AbstractClientObject") it returns false, how am I supposed to implement such a feature ?
answer count: 1
score: 0
type: Question

http://stackoverflow.com/a/79228131
downvote count: 0
score: 6
accepted answer of: http://stackoverflow.com/q/79228105
type: AcceptedAnswer
type: Answer
upvote count: 6
has body: 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. 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. Here's some pseudocode: x = 0 // beginning of list y = n-1 // last item in list while (x &lt; y) { if (a[x] == -1) { // move y backwards, looking for the first non-empty element. while (y &gt; x &amp;&amp; a[y] == -1) { y = y - 1; } swap(a[x],a[y]) } x = x + 1; }
answers question: http://stackoverflow.com/q/79228105

http://stackoverflow.com/q/79149433
has body: 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 #!lua name=supported_commands local function bl_pop_test(keys, args) local test_key = keys[1] return redis.call('BLPOP', test_key, 5) end redis.register_function('bl_pop_test', bl_pop_test) My guess is that because functions block, calling a blocking command isn't supported? Just curious if anyone else has ever come across this..
has title: Is BLPOP supported in Redis Lua functions?
tagged with: lua
type: Question
accepted answer: http://stackoverflow.com/a/79154432
tagged with: redis
has answer: http://stackoverflow.com/a/79154432
answer count: 1
score: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/139678156
type: Comment
comment on: http://stackoverflow.com/q/79205736
has text: @AlexanderMashin i understand, i fixed it
type: QuestionComment
score: 0

http://stackoverflow.com/comment/139727330
type: Comment
comment on: http://stackoverflow.com/q/79238198
has text: Related: https://stackoverflow.com/questions/79231569/how-to-make-neovim-associate-tpp-file-extension-with-c-files
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139682671
type: QuestionComment
comment on: http://stackoverflow.com/q/79213245
has text: 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.
score: 1
type: Comment

http://stackoverflow.com/q/79113391
accepted answer: http://stackoverflow.com/a/79113541
tagged with: uefi
linked to: http://stackoverflow.com/q/43624089
tagged with: lua
has title: Failing to build Lua for EFI environment (EDK2)
answer count: 1
has answer: http://stackoverflow.com/a/79113541
score: 0
type: AnsweredQuestion
tagged with: edk2
has body: I am trying to build Lua for EDK2 but it fails with the following error. /home/dave/dev/edk2libc/edk2-libc/AppPkg/Applications/Lua/src/ldo.c: In function ‘luaD_throw’: /home/dave/dev/edk2libc/edk2-libc/AppPkg/Applications/Lua/src/ldo.c:122:1: error: ‘noreturn’ function does return [-Werror] 122 | } | ^ In the answers to the following post Lua.efi package for running lua in EFI environment; 'unixsmurf' mentions a patch to avoid build errors but the link is broken, so perhaps I need that patch, anyone know where it may be? I am able to build the 'Hello' sample application without issue so my build environment seems ok.
type: Question

http://stackoverflow.com/a/79174198
score: 2
downvote count: 0
has body: IDK the whole function/loop but try this algorithm : local isBattleActive = false -- new binary flag function StartBattle() if isBattleActive then return end -- battle active :do not start isBattleActive = true repeat BattleClient.PlayerAttackTween() task.wait(battleSpeed) BattleClient.EnemyAttackTween() task.wait(battleSpeed) battleRound += 1 until isInBattle.Value == false isBattleActive = false -- battle over, reset flag end
type: AcceptedAnswer
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/79171090
answers question: http://stackoverflow.com/q/79171090

http://stackoverflow.com/comment/139664804
type: QuestionComment
comment on: http://stackoverflow.com/q/79203398
score: 2
has text: 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
type: Comment

http://stackoverflow.com/comment/139723563
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/79232356
has text: local serverstorage = game:GetService("ServerStorage") local spawner = workspace["entity spawn"] local mob = {} function mob.Spawn(name, map) local mobexsists = serverstorage.mobs:FindFirstChild(name) if mobexsists then local newmob = mobexsists:Clone() newmob.HumanoidRootPart.CFrame = spawner.CFrame newmob.Parent = workspace else warn("mob isnt here") end end return mob

http://stackoverflow.com/comment/139558709
type: Comment
score: 2
type: QuestionComment
has text: 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.
comment on: http://stackoverflow.com/q/79145351

http://stackoverflow.com/a/79179832
has comment: http://stackoverflow.com/comment/139625055
answers question: http://stackoverflow.com/q/79179000
score: 5
upvote count: 5
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/139683445
accepted answer of: http://stackoverflow.com/q/79179000
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/139627893
has body: I once fell in the same trap. When a multires expression is used in a list of expressions without being the last element, or in a place where the syntax expects a single expression, Lua adjusts the result list of that expression to one element. Lua 5.4 manual. 3.4.12 – Lists of expressions, multiple results, and adjustment. So, table.unpack(…) or ... should be last in a list of expressions. Perhaps, if you literally want to insert some values into a table, you could use table.insert()?

http://stackoverflow.com/comment/139513099
comment on: http://stackoverflow.com/q/79120179
has text: 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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/79139769
score: 1
has comment: http://stackoverflow.com/comment/139548368
type: AnsweredQuestion
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/79141388
accepted answer: http://stackoverflow.com/a/79141388
favorite count: 0
type: Question
has title: Update values in a Lua table from values of another table
has body: Let's say I have the following table in Lua: t1 = { name = "alfa", weight = 10, height = 5, speed = 4, price = 100, } Now I want to clone this, but replace some values within, but not all. So it's kind of like this: -- this deepcopy function is provided by a 3rd party library t2 = deepcopy(t1) t2_diff = { name = "beta", weight = 20, speed = 6, } function_to_update_table(t2, t2_diff) -- at this point, I expect the t2 table's values to be like this: -- t2.name == "beta" -- t2.weight == 20 -- t2.height == 5 (so, no change from the value in t1) -- t2.speed == 6 -- t2.price == 100 (also no change from t1) In other words, something similar to Python's dict.update() method. Is there such a function to perform table update?
downvote count: 0
tagged with: lua

destructuring
tags question: http://stackoverflow.com/q/79203333
tag name: destructuring
type: Tag

http://stackoverflow.com/comment/139485507
has text: 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.
comment on: http://stackoverflow.com/q/79104155
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139589214
type: Comment
has text: Okay, so your question is something like "how to execute command given its name as a string".
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79162067

http://stackoverflow.com/comment/139487109
comment on: http://stackoverflow.com/a/79104208
has text: 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_
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/139649963
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79190029
has text: Thank you. I 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`

http://stackoverflow.com/q/79206391
has title: self in OnLoad function nil
tagged with: http://stackoverflow.com/tag/xml
type: Question
tagged with: world-of-warcraft
tagged with: add-on
score: 0
accepted answer: http://stackoverflow.com/a/79209062
tagged with: lua
has body: 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. MyAddonName.xml <Size x="384" y="512" /> <Size x="60" y="60" /> <Offset x="7" y="-6" /> <OnLoad function="MyAddonName_OnLoad" /> MyAddonName.lua function Print(msg, r, g, b) DEFAULT_CHAT_FRAME:AddMessage("|c0033ffccMyAddonName|r "..msg.."", r, g, b) end function MyAddonName_OnLoad(self) Print("loaded"..tostring(self), 0, 1, 0) // <- self exists self.items = {} end function MyAddonName_TestFunct() Print(MyAddonName.items) or Print(self.items) // <- not exists, attempt to index field 'items' (a nil value) end MyAddonName_TestFunct will be called later, for test purpose I just called this from /run MyAddonName_TestFunct() /run MyAddonName_TestFunct() I assumed that MyAddonName_OnLoad 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 MyAddonName_TestFunct with some initial value stored in a table accessible via self. I checked other addons (for example BetterCharacterStats) and there is a similar code, for example BetterCharacterStats.lua function BCS:OnLoad() // `BCS:` means that self passed implicitly I also noticed that table BSC created explicitly, but thus I have self during check - this is not needed for me. ---- Here is a more complete example that I tested (with more code) - I'm trying to follow some tutorial, result now a bit different And this is result of prints Image of output Can anyone suggest where I'm wrong?
has answer: http://stackoverflow.com/a/79209062
type: AnsweredQuestion
answer count: 1

http://stackoverflow.com/q/79218557
type: UnansweredQuestion
tagged with: love2d
score: 1
has title: beginCollision callback not allowing two fixtures
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/79218682
favorite count: 0
type: Question
downvote count: 0
tagged with: lua
has body: Here's where I set the callbacks: GameWorld = love.physics.newWorld(0, 0, true) GameWorld:setCallbacks(self.contact) Here's the contact method: function thisScene:contact(a, b, coll) print(a, b, coll) end Output: Fixture: 0x56e2fcb072a0 Contact: 0x56e2fd2d92e0 nil As you can see a is a fixture while b is a contact. I was expecting a and b to be the two fixtures that collided and coll to be the contact. Love Version: 11.3 Thanks in advance!

repeat
tag name: repeat
type: Tag
tags question: http://stackoverflow.com/q/79171090

http://stackoverflow.com/q/79068981
answer count: 0
has comment: http://stackoverflow.com/comment/139419296
has title: Trying to add Lua scripting support to the Zed code editor
has comment: http://stackoverflow.com/comment/139419060
type: Question
upvote count: 1
tagged with: lua
type: UnansweredQuestion
tagged with: rust
score: 1
has body: 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: use mlua::prelude::*; use std::sync::{Arc, Mutex}; use zed_extension_api as zed; struct LuaExtension { lua: Arc<Mutex<Lua>>, lua_table: Arc<Mutex<LuaTable<'static>>>, } impl zed::Extension for LuaExtension { fn new() -> Self where Self: Sized, { // Init Lua environment let lua = Lua::new(); let lua = Arc::new(Mutex::new(lua)); let lua_script = include_str!("test.lua"); let lua_table = { let lua_lock = lua.lock().unwrap(); let lua_table: LuaTable = lua_lock .load(lua_script) .eval() .expect("failed to load Lua extension"); Arc::new(Mutex::new(lua_table)) }; LuaExtension { lua, lua_table } } fn language_server_command( &mut self, _language_server_id: &zed::LanguageServerId, _worktree: &zed::Worktree, ) -> Result<zed::Command, String> { // Call the Lua method let lua_table = self.lua_table.lock().unwrap(); let result: LuaResult<Vec<String>> = lua_table.call_function("language_server_command", (_language_server_id, _worktree)); match result { Ok(command) => Ok(zed::Command::from(command[0].clone())), Err(_) => Err("failed to get command from Lua".to_string()), } } fn run_slash_command( &self, _command: zed_extension_api::Command, _args: Vec<String>, _worktree: Option<&zed_extension_api::Worktree>, ) -> zed_extension_api::Result<zed_extension_api::CommandOutput, String> { // Call the Lua method with arguments let lua_table = self.lua_table.lock().unwrap(); let result: LuaResult<String> = lua_table.call_function("run_slash_command", (_command, _args, _worktree)); result.map_err(|e| e.to_string()) } } zed::register_extension!(LuaExtension); I tried wrapping the Lua instance in a Arc<Mutex<>> but that resulted in an error as the Lua class does not implement Send and Sync.
downvote count: 0
favorite count: 0
tagged with: zed

http://stackoverflow.com/comment/139487542
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79100682
has text: @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.
type: Comment

http://stackoverflow.com/q/79197951
favorite count: 0
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79198143
answer count: 1
has title: What does "*all" mean in `io.read("*all")`?
type: Question
has body: I know format "*a" is used to read a whole file, "*l" used to read a line. But what does "*all" (which appears in the book Programming in Lua) mean? I also saw "*line" on some webpages. The Lua reference only specifies those one character formats, and doesn't say anything about longer formats. At first I thought, formats with more than one characters mean reading each format individually, like "*nn" would read two numbers, "*ll" would read two lines. But that doesn't seem to be the case. The only place I've found about this is a reddit comment say that But "umber" 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? So what's the correct behavior of "*all" and the like, or is it really defined? ps: I'm using Lua 5.3, but the relevant reference is same for other versions I have checked.
tagged with: lua
downvote count: 0
tagged with: lua-5.3
score: 2
accepted answer: http://stackoverflow.com/a/79198143

http://stackoverflow.com/q/79089890
has title: Haproxy not logging from LUA core.log()
score: 0
type: Question
tagged with: lua
answer count: 0
has body: 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. The logs from core.Info(ip) are being logged in /var/log/messages, but I need them in /var/log/haproxy.log. Here's a simplified version of my code: core.register_action("verify_request", { "http-req" }, function(txn) .... txn:Info(ip) -- this got logged into /var/log/haproxy end) core.register_service("send_response", "http", function(applet) .... core.Info(ip) -- this got logged into /var/log/messages end) HAProxy configuration (haproxy.cfg): log global option httplog option dontlognull option dontlog-normal log 127.0.0.1 local0 debug Rsyslog configuration (rsyslog.d/haproxy.conf): $ModLoad imudp $UDPServerAddress 127.0.0.1 $UDPServerRun 514 local0.* /var/log/haproxy.log Is there a specific configuration I might be missing that would direct all logs from both the Lua actions to the same log file?
has comment: http://stackoverflow.com/comment/139479635
tagged with: haproxy
type: UnansweredQuestion

http://stackoverflow.com/q/79124153
tagged with: lua
has comment: http://stackoverflow.com/comment/139520855
type: AnsweredQuestion
upvote count: 1
answer count: 1
favorite count: 0
type: Question
tagged with: luau
has title: How does obfuscated code execute a built in function in Lua
downvote count: 0
has answer: http://stackoverflow.com/a/79124446
accepted answer: http://stackoverflow.com/a/79124446
has body: I was looking at an online obfuscator (https://luaobfuscator.com/) the other day, obfuscating the code print("Hello, World"). After obfuscating: 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),"..",function(v30) if (v1(v30,2)==81) then v19=v0(v3(v30,1,1));return "";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))>=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 …
score: 1

http://stackoverflow.com/comment/139486802
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/79100682
type: Comment
score: 0

http://stackoverflow.com/comment/139683445
has text: 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.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79179832

http://stackoverflow.com/comment/139589177
score: 0
type: Comment
type: QuestionComment
has text: Did you see https://neovim.io/doc/user/lua-guide.html#lua-guide-using-Lua already?
comment on: http://stackoverflow.com/q/79162067

http://stackoverflow.com/comment/139645639
type: Comment
score: 1
comment on: http://stackoverflow.com/q/79190029
has text: If the input is ` foo `, 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".
type: QuestionComment

http://stackoverflow.com/q/79138011
tagged with: lua
type: UnansweredQuestion
has body: 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. Wireshark decoding -- Define the protocol my_proto = Proto("my_proto", "Custom UDP Tunneling Protocol") -- Define the fields for the protocol local f_id = ProtoField.string("my_proto.id", "ID", base.ASCII) local f_timestamp = ProtoField.uint64("my_proto.timestamp", "Timestamp", base.DEC) local f_tunneled_eth = ProtoField.bytes("my_proto.tunneled_eth", "Tunneled Ethernet Frame") -- Assign fields to the protocol my_proto.fields = { f_id, f_timestamp, f_tunneled_eth } -- Dissector function function my_proto.dissector(buffer, pinfo, tree) -- Set the protocol column to "Custom Proto" pinfo.cols.protocol = "MY_PROTO" -- Check if the packet is large enough for minimum fields if buffer:len() < 32 then return -- Not enough data for ID + Timestamp end -- Add protocol to the dissection tree local subtree = tree:add(my_proto, buffer(), "Custom UDP Tunneling Protocol") -- Extract the ID field (24 bytes) subtree:add(f_id, buffer(0, 24)) -- Extract the Timestamp field (8 bytes) subtree:add(f_timestamp, buffer(24, 8)) -- Extract the Tunneled Ethernet frame (starting from byte 32) local eth_buffer = buffer(32):tvb() local eth_dissector = Dissector.get("eth") -- Get the Ethernet dissector if eth_dissector then -- Call the Ethernet dissector to parse the tunneled frame properly, adding it directly to the tree eth_dissector:call(eth_buffer, pinfo, tree) else -- Fallback if Ethernet dissector is unavailable subtree:add(f_tunneled_eth, buffer(32), "Ethernet Frame (unrecognized)") end end I have tried the included lua script, expecting the tunneled Ethernet frame to be decoded correctly. However, it is displayed as a binary blob.
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/79138165
tagged with: wireshark
has title: Lua Wireshark dissector: decoding an Ethernet frame within a UDP-based custom tunneling protocol
tagged with: wireshark-dissector
type: Question

http://stackoverflow.com/q/79091521
has title: How to table.remove() nested elements in lua?
answer count: 1
has answer: http://stackoverflow.com/a/79092453
has body: a={ {11,22,33} } How to remove a[1][1] aka 11 with table.remove() so it becomes a={ {22,33} }? In the pico8 lua it is del(a[1],a[1][1]) I have no idea what table.remove(a[1],a[1][1]) is doing, it seems to do nothing. I don't understand how you would create del() in vanilla lua. I suppose you can a[1][1]=nil and then apply some sorting algorithm, but I would hope I'm just missing the simpler solution.
favorite count: 0
score: 2
type: Question
downvote count: 0
tagged with: lua
tagged with: lua-table
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/79165588
answers question: http://stackoverflow.com/q/79160215
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/139609701
has body: This is almost a purely mathematical problem. Ellipse centered on a focus in polar coordinates is ρ = ep / (1 - ecos(θ - Δ)) (ρ, θ) is a point on the ellipse e is the eccentricity, calculated from c / a Δ is the rotation of ellipse (the angle from x-axis to the major axis of ellipse) Now you have 2 ellipses. The goal is to find 2 θ values that satisfy the following equation: e₁p₁ / (1 - e₁cos(θ - Δ₁)) = e₂p₂ / (1 - e₂cos(θ - Δ₂)) Simplify this equation yields: (You need this formula: cos(a - b) = cos(a)cos(b) + sin(a)sin(b)) (e₁p₁e₂sinΔ₂ - e₂p₂e₁sinΔ₁)sinθ + (e₁p₁e₂cosΔ₂ - e₂p₂e₁cosΔ₁)cosθ = e₁p₁ - e₂p₂ The simplified equation takes the form of Asinθ + Bcosθ = C, so we can use another formula Asinθ + Bcosθ = sqrt(A² + B²)sin(θ + φ) φ = atan(b, a) to calculate the value of θ. θ = arcsin(C / sqrt(A² + B²)) - φ Other tips you may need: To calculate the angle (Δ) between 2 vectors: angle = arccos(dot(v₁, v₂) / sqrt(v₁² * v₂²)) The direction of rotation (from v₁ to v₂) can be determined by: (&gt;0 means clockwise) sign = v₁.x * v₂.y - v₁.y * v₂.x Since math.asin only returns values between -π/2 to π/2, and since sin(π-θ) = sin(θ), after getting one θ, the other one can be calculated using π-θ Here are the two points I calculated for verification (with the common focus as the origin) rho, theta P1: 46.845589263185, 0.51139848585219 P2: 24.79698629529, 3.5149426136911 x, y P1: 40.852208863237, 22.926104431619 P2: -23.088739743658, -9.044369871829
upvote count: 1
accepted answer of: http://stackoverflow.com/q/79160215
score: 1

http://stackoverflow.com/a/79232073
has body: 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. function compact(arr) local sz = 0 for i, v in ipairs(arr) do if v ~= -1 then sz = sz + 1 arr[i] = -1 -- not needed if you ignore the part of the array after the compacted portion arr[sz] = v end end return sz -- size of compacted array end Usage example: arr = {1, 3, 4, -1, 6, -1, 8, -1, -1} newSize = compact(arr) print(newSize) -- 5 print(table.concat(arr, &quot;, &quot;)) -- 1, 3, 4, 6, 8, -1, -1, -1, -1 print(table.concat({table.unpack(arr, 1, newSize)}, &quot;, &quot;)) -- get only compacted portion -- 1, 3, 4, 6, 8
upvote count: 1
answers question: http://stackoverflow.com/q/79228105
score: 1
has comment: http://stackoverflow.com/comment/139716590
type: Answer
downvote count: 0

http://stackoverflow.com/a/79128285
accepted answer of: http://stackoverflow.com/q/79128096
answers question: http://stackoverflow.com/q/79128096
type: AcceptedAnswer
type: Answer
has body: For the moment in time, I worked around with this solution although I'm not sure is the best one. 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 ... ... ... local Destination = <PATH/FILENAME> function sleep(n) local t0 = clock() while clock() - t0 <= n do end end local zzz = 10 function get_file_size(filename) local file = io.open(filename, "rb") if not file then return 0 end local size = file:seek("end") file:close() return size end local stable = false local last_size = get_file_size(Destination) while not stable do sleep(zzz) local new_size = get_file_size(Destination) if new_size > 0 and new_size == last_size then stable = true else last_size = new_size end end ... ... ...
score: 0

http://stackoverflow.com/comment/139577236
type: QuestionComment
has text: 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
score: 0
type: Comment
comment on: http://stackoverflow.com/q/79145351

http://stackoverflow.com/q/79135324
score: 0
type: Question
answer count: 0
has title: Lua Macros Second keyboard not disabled
tagged with: lua
type: UnansweredQuestion
tagged with: autohotkey
has body: I recently created script in Lua Macros. It is supposed to disable second keyboard but it does not which in some programs result in shortcuts not working properly. This is the code. lmc_assign_keyboard('MACROS'); lmc_print_devices() lmc_set_handler('MACROS',function(button,direction) if (direction == 1) then return end lmc_minimize() print(button) if (button == 27) then -- ESC lmc_send_keys('^{Num0}',50) elseif (button == 112) then -- F1 lmc_send_keys('^{NUM1}',50) elseif (button == 113) then -- F2 lmc_send_keys('^{NUM2}',50) elseif (button == 114) then -- F3 lmc_send_keys('^{NUM3}',50) elseif (button == 115) then -- F4 lmc_send_keys('^{NUM4}',50) elseif (button == 116) then -- F5 lmc_send_keys('^{NUM5}',50) elseif (button == 117) then -- F6 lmc_send_keys('^{NUM6}',50) elseif (button == 118) then -- F7 lmc_send_keys('^{NUM7}',50) end end ) I tried researching the problem on other forums but found nothing
tagged with: macros

http://stackoverflow.com/a/79162674
has body: To do this one can use the expression register: https://neovim.io/doc/user/insert.html#i_CTRL-R_%3D. Typing :&lt;c-r&gt;=GET_STRING()&lt;cr&gt; results in :THE_STRING. This calls a vimscript function though. Not sure if it can be done with a lua function.
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/79162067
downvote count: 0

http://stackoverflow.com/q/79152919
has body: 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...) So on my BillboardGui I have Max distance on and set to 40. 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. Far away... Close up... How can I fix it? I want it not to scale and not to get out of frame how do I do that?
score: 0
tagged with: user-interface
type: Question
answer count: 0
tagged with: lua
has title: Prevent BillboardGui text scaling
tagged with: roblox
has comment: http://stackoverflow.com/comment/139573128
type: UnansweredQuestion

http://stackoverflow.com/q/79228627
type: UnansweredQuestion
favorite count: 0
upvote count: 2
has title: Value not changing between tables
has answer: http://stackoverflow.com/a/79228812
answer count: 1
has body: Here's code for a timer: local copyTable = require("Helpers.copyTable") local timer = {} timer.max = 0 timer.time = 0 function timer:add(dt) timer.time = timer.time + dt end function timer:reset() timer.time = 0 end return copyTable(timer) The copy table function returns a new table containing all the values of the one copied. Here's some basic code that uses it: ovenTime = require("timer") ovenTime.add(.5) print(ovenTime.time) This gives me the output of 0. I was expecting it to output .5 since time gets .5 added onto it. Thanks in advance!
type: Question
downvote count: 0
score: 2
tagged with: lua
tagged with: lua-table

fifo
tag name: fifo
type: Tag
tags question: http://stackoverflow.com/q/79132438

ruff
tag name: ruff
type: Tag
tags question: http://stackoverflow.com/q/79107680

http://stackoverflow.com/comment/139551539
score: 2
type: Comment
comment on: http://stackoverflow.com/q/79141463
type: QuestionComment
has text: `string.gsub` does almost any operations to delete parts of strings in `Lua` : `local suffix = str:gsub('^'..prefix,"") --> 'twothree'`

http://stackoverflow.com/q/79120179
score: 0
has title: Error: Build error: Failed compiling module mime\core.dll How to solve this problem?
has body: 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. The following is the error I made when installing Luasocket under Windows 10 system 64-bit. Please give me some guidance. Thank you very much. C:\Users\40341&gt;luarocks install luasocket Installing https://luarocks.org/luasocket-3.1.0-1.src.rock luasocket 3.1.0-1 depends on lua &gt;= 5.1 (5.4-1 provided by VM: success) x86_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 x86_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 x86_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 x86_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 x86_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 x86_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 x86_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 x86_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 x86_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 x86_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 x86_64-w64-mingw32-gcc -O2 -c -o src/udp.o -IC:\…
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139513099
type: Question
tagged with: luasocket
type: UnansweredQuestion

http://stackoverflow.com/comment/139729230
comment on: http://stackoverflow.com/q/79232356
score: 0
type: QuestionComment
type: Comment
has text: If you remove the`task.wait` call, does your code work normally?

hook
type: Tag
tag name: hook
tags question: http://stackoverflow.com/q/79110440

c99
tag name: c99
type: Tag
tags question: http://stackoverflow.com/q/79106182

http://stackoverflow.com/a/79103199
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/139489576
has body: 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! Avoid big code and use the more built-in ROBLOX locking mouse, that's already shift lock code, made for you! And 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!
has comment: http://stackoverflow.com/comment/139495031
answers question: http://stackoverflow.com/q/79080159

http://stackoverflow.com/a/79228812
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/79228627
score: 4
has body: Most importantly, if you declared the method add() with a semicolon, so you should invoke it: ovenTime:add (.5), not ovenTime.add (.5). With other small improvements: timer.lua: local copyTable = require 'Helpers.copyTable' local timer = { max = 0, time = 0 } function timer:add (dt) self.time = self.time + dt end function timer:reset () self.time = 0 end -- serialisable "decorator": local function serialisable (tbl) local meta = getmetatable (tbl) or {} meta.__tostring = function (tbl) return tostring (tbl.time) end return setmetatable (tbl, meta) end return serialisable (copyTable (timer)) and the calling program: ovenTime = require 'timer' ovenTime:add (.5) -- note ':' instead of '.'. print (ovenTime) -- it will output '0.5', not 'table: 0x...' And some further simplifications of timer.lua: -- serialisable 'decorator': local function serialisable (tbl) local meta = getmetatable (tbl) or {} meta.__tostring = function (tbl) return tostring (tbl.time) end return setmetatable (tbl, meta) end return serialisable { time = 0, max = 0, add = function (self, dt) self.time = self.time + dt end, reset = function (self) self.time = 0 end } And finally, a solution that allows several independent timers, since that is what you seem to want, since you deep copied tables: timer.lua: -- serialisable 'decorator': local function serialisable (tbl) local meta = getmetatable (tbl) or {} meta.__tostring = function (tbl) return tostring (tbl.time) end return setmetatable (tbl, meta) end return function () return serialisable { time = 0, max = 0, add = function (self, dt) self.time = self.time + dt end, reset = function (self) self.time = 0 end } end and its caller: local timer = require 'timer' local ovenTime = timer () ovenTime:add (.5) print (ovenTime)
upvote count: 4

http://stackoverflow.com/comment/139484159
type: QuestionComment
comment on: http://stackoverflow.com/q/79104155
has text: See also https://stackoverflow.com/questions/7925090/lua-find-a-key-from-a-value
type: Comment
score: 0

iup
tags question: http://stackoverflow.com/q/79200725
tag name: iup
type: Tag
tags question: http://stackoverflow.com/q/79310001
tags question: http://stackoverflow.com/q/79310374

http://stackoverflow.com/q/79084279
downvote count: 0
score: 1
has body: 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 -complete flag but am wondering if any of the options are meant specifically for Lua tables where it looks to finish the Key?
tagged with: neovim-plugin
type: UnansweredQuestion
tagged with: neovim
favorite count: 0
answer count: 0
tagged with: lua
type: Question
upvote count: 1
has title: Neovim completion based on Lua table

http://stackoverflow.com/a/79077986
upvote count: 2
accepted answer of: http://stackoverflow.com/q/79077823
answers question: http://stackoverflow.com/q/79077823
downvote count: 0
type: AcceptedAnswer
has body: Just use -l lib1. I guess the book you are reading is Programming in Lua first edition, 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 .lua extension, and dot . in the module name will also be replaced with a slash / by default.
type: Answer
score: 2

http://stackoverflow.com/a/79100682
has comment: http://stackoverflow.com/comment/139486802
answers question: http://stackoverflow.com/q/79084408
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/139486161
has comment: http://stackoverflow.com/comment/139486827
has body: You need to change the Humanoid's CFrame 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 Touched event without using the MoveTo method. Here's an example: local part = script.Parent part.Touched:Connect(function(hit) local character = hit.Parent local player = game.Players:GetPlayerFromCharacter(character) if player then print(player.Name .. &quot; touched the part!&quot;) end end)
has comment: http://stackoverflow.com/comment/139487542

http://stackoverflow.com/comment/139664925
has text: Check the answers [here](https://stackoverflow.com/q/63055430/9363973), for porting existing Projects especially [this one](https://stackoverflow.com/a/77161020/9363973)
score: 1
comment on: http://stackoverflow.com/q/79203398
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139537984
score: 0
type: QuestionComment
has text: 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?
comment on: http://stackoverflow.com/q/79131716
type: Comment

http://stackoverflow.com/a/79151816
has body: Timing errors 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. The timing error arises because for (gameTick = 0; gameTick < 10; gameTick++) { print(`tick: ${gameTick}`); tasks[gameTick]?.forEach(f => f()) if (gameTick == 2) task1(); } executes a synchronous loop, calling task1 with gameTick set to 2, and exiting the loop with gameTick set to 10. The first iteration of the loop in task1 calls sleep(2) which sets up a task for gameTick = 4, before await causes task1 to return a promise to the caller. The loop in step 1 continues iterating and fulfills the task promise for gameTick 4. The loop in 1 has finished, and the await operator in task1 returns to its surrounding loop code after "execute 0" has printed. The next iteration of the loop in task1 calls sleep(2) with i set to 1 and gameTick set to 10 (by completion of the loop in 1). sleep(2) sets up a promise for a task at gameTick 12. This promise is never fulfilled in posted code, leaving task1 waiting for it with execute 1 left as the last line printed. Short Answer The await doesn't return because the promise hasn't been resolved. Debugging This first snippet added some output to show the value of i and gameTick in more places and log when await returns. It was used to uncover and confirm why the await promise operand was not fulfilled. function print(txt) {document.querySelector('#log').textContent += txt + '\n';} let gameTick = 0; const tasks = {}; function sleep(t) { const targetTick = gameTick + t; if (!tasks[targetTick]) { tasks[targetTick] = []; } return new Promise(resolve => { tasks[targetTick].push(resolve); }); } async function task1() { print('start task1'); for (let i = 0; i < 3; i++) { print(`execute: ${i}`); await sleep(2); print(` sleep await done with i = ${i}, gameTick now ${gameTick} `); } } // task1(); for (gameTick = 0; gameTick < 10; gameTick++) { print(`tick: ${gameTick} tasks lengt…
upvote count: 1
accepted answer of: http://stackoverflow.com/q/79151147
answers question: http://stackoverflow.com/q/79151147
score: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/a/79235336
downvote count: 0
score: 2
has body: You should replace: setmetatable(ClientWidget, {__index = AbstractClientObject}) By this: setmetatable(ClientWidget, AbstractClientObject) 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.
answers question: http://stackoverflow.com/q/79234692
upvote count: 2
type: Answer

http://stackoverflow.com/q/79131716
answer count: 0
tagged with: lua
type: Question
tagged with: roblox
type: UnansweredQuestion
has title: How do I change leaderstats from my other script?
has body: 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. Here is the code local values = script.Parent.Parent.Parent.Parent.Values script.Parent.Touched:Connect(function(hit) if hit.Name == "DropperPart" and hit:IsA("BasePart") then values.Money.Value += hit:FindFirstChild("CashValue").Value hit:Destroy() end end)
has comment: http://stackoverflow.com/comment/139537984
score: 0

http://stackoverflow.com/comment/139664869
type: QuestionComment
comment on: http://stackoverflow.com/q/79203398
score: 2
type: Comment
has text: 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.

http://stackoverflow.com/comment/140086949
has text: @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?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79232356
type: Comment

http://stackoverflow.com/comment/139452696
type: AnswerComment
comment on: http://stackoverflow.com/a/79086590
type: Comment
has text: 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.
score: 0

http://stackoverflow.com/comment/139504011
type: Comment
score: 0
type: AnswerComment
has text: Whole lot better than mine.
comment on: http://stackoverflow.com/a/79112340

http://stackoverflow.com/comment/139543628
has text: Thank you that fixed it, much appreciated.
comment on: http://stackoverflow.com/a/79113541
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/139589219
has text: 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`)
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79162067

http://stackoverflow.com/q/79137049
tagged with: lua
has comment: http://stackoverflow.com/comment/139546976
has comment: http://stackoverflow.com/comment/139543212
has answer: http://stackoverflow.com/a/79139733
tagged with: trigonometry
has body: I have two Points A and B (given with coordinates ax, ay and bx, by). This two points are inside of given Circle C (given with coordinates cx, cy and radius cr). How to find points T1 and T2? Points 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). Example values: A (30, 30) B (40, 20) C (50, 50, 40) right solution: T1 (28.6061, 16.202) T2 (87.3939, 35.798) I've started with the middle point M: mx, my = (ax+bx)/2, (ay+by)/2 The perpendicular line to line AB: m1x, m1y = mx + (ay-my), my - (ax-mx) m2x, m2y = mx + (by-my), my - (bx-mx) And how to get the circles D1 and D2?
upvote count: 2
answer count: 1
type: UnansweredQuestion
tagged with: math
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/139543132
downvote count: 1
tagged with: vector
has title: Find two tangent points for given circle and two points inside the circle , Lua
has comment: http://stackoverflow.com/comment/139545801
type: Question

http://stackoverflow.com/a/79231353
type: Answer
has body: 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. Implementation in Python below. def make_compressed(A): """ Compress but keep the relative order of non-free elements Returns the size of the compressed array though modifications are in-place """ free_idx = 0 new_size = 0 for i, x in enumerate(A): if x == -1: continue # locate next free index while free_idx < len(A) and A[free_idx] != -1: free_idx += 1 if free_idx > i: # don't actually swap bc the free index is on the right new_size = i + 1 continue # do swap; observe that i will later become a free index A[free_idx], A[i] = A[i], -1 # use up this index free_idx += 1 new_size = free_idx return new_size def main(): for A in [ [1, 3, 6, -1, 8, -1, -1], [-1, -1, -1, 1, 2, 3, -1, 4], [-1, -1, 1, 2, 3, 4], [5, 4, 3, 2, 1] ]: # making copies only for debugging purposes B = A.copy() new_size = make_compressed(B) print(f"{A} -> {B[:new_size]}") if __name__ == "__main__": main()
score: 0
answers question: http://stackoverflow.com/q/79228105
has comment: http://stackoverflow.com/comment/139716588

http://stackoverflow.com/comment/139645285
comment on: http://stackoverflow.com/q/79190029
type: QuestionComment
has text: Sorry I didnt put it clear cause I didnt know how to escape markdown on markdown. It has been written in the post again , it was appended the expeted output.
type: Comment
score: 0

http://stackoverflow.com/comment/139466920
type: AnswerComment
has text: lua5.1 work fine, but in lua5.4 I have to copy a new table without nil.
comment on: http://stackoverflow.com/a/79091793
type: Comment
score: 0

libreoffice-writer
tag name: libreoffice-writer
tags question: http://stackoverflow.com/q/79137236
type: Tag

http://stackoverflow.com/comment/139488707
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79106182
has text: @Jarod42 here is the full message from the output panel `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.`
type: Comment

http://stackoverflow.com/comment/139446407
has text: 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!!
score: 0
type: Comment
comment on: http://stackoverflow.com/q/79080682
type: QuestionComment

http://stackoverflow.com/comment/139533694
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/79112340
has text: 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?

http://stackoverflow.com/q/79119791
type: AnsweredQuestion
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/79120372
type: Question
has body: 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: > output = 'return { date="2024-10-23T21:24:27.227996696Z", severity="Normal", category="Hardware", message="Atmos-RX-2 is Not Present", filename="", status="Not Present", source="Atmos-RX-2" }' > event = load(output)() > print(event['message']) Atmos-RX-2 is Not Present If one of the strings contains a line break, it fails: > output = 'return { date="2024-10-23T21:24:27.227996696Z", severity="Normal", category="Hardware", message="line 1\nline 2", filename="", status="Not Present", source="Atmos-RX-2" }' > event = load(output)() stdin:1: attempt to call a nil value stack traceback: stdin:1: in main chunk [C]: in ?
tagged with: lua
has answer: http://stackoverflow.com/a/79120372
has title: How to load multiline string with Lua load()?

http://stackoverflow.com/comment/139498554
type: Comment
comment on: http://stackoverflow.com/q/79112338
score: 0
type: QuestionComment
has text: What are `player.Angle`, `player.Input` and `Vec2`? What are their values?

http://stackoverflow.com/comment/139536878
has text: 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.
type: Comment
comment on: http://stackoverflow.com/a/79112340
score: 0
type: AnswerComment

http://stackoverflow.com/q/79152996
type: UnansweredQuestion
has body: 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. function main() -- Define the number of repetitions local repetitions = 10 for i = 1, repetitions do -- Mouse left button down PressAndReleaseMouseButton(1) -- Left down Sleep(30) -- Delay 30 ms -- Mouse left button up ReleaseMouseButton(1) -- Left up Sleep(5) -- Delay 5 ms -- Move the mouse MoveMouseRelative(0, 2) -- Move right 0, down 2 end end main() And that's what chatgpt gave me: -- Define the number of repetitions local repetitions = 10 function main() OutputLogMessage("Hold 'LMB' to run the script. Release to stop.\n") while true do -- Check if the left mouse button is held down if IsMouseButtonPressed(1) then OutputLogMessage("LMB is pressed. Running actions...\n") for i = 1, repetitions do -- Mouse left button down PressAndReleaseMouseButton(1) -- Left down Sleep(30) -- Delay 30 ms -- Mouse left button up ReleaseMouseButton(1) -- Left up Sleep(5) -- Delay 5 ms -- Move the mouse MoveMouseRelative(0, 2) -- Move right 0, down 2 end -- Optionally, log that the actions are complete OutputLogMessage("Completed %d repetitions.\n", repetitions) -- Optional: Wait a moment before checking the button again Sleep(100) -- Delay to prevent rapid retriggering end Sleep(10) -- Prevent high CPU usage when the button is not pressed end end main() Yes, it works, but not the way I need it.
score: 0
has comment: http://stackoverflow.com/comment/139672848
answer count: 0
tagged with: lua
linked to: http://stackoverflow.com/q/73365404
has title: i with the lua script in the logitech g hub program
type: Question
tagged with: logitech-gaming-software

http://stackoverflow.com/comment/139664784
type: Comment
score: 0
has text: Are you talking about Lua or other similar language? `local name, age = person` will just assign `person` to `name` in Lua.
type: QuestionComment
comment on: http://stackoverflow.com/q/79203333

http://stackoverflow.com/comment/139570447
type: AnswerComment
has text: @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.
score: 0
comment on: http://stackoverflow.com/a/79151155
type: Comment

http://stackoverflow.com/a/79124446
score: 3
has body: I am not planning to study how this obfuscator actually works. Here is a way to explain how to call print without explicitly referencing it. In Lua, you can use the load function (or loadstring in Lua 5.1) to execute a string as Lua code. load('print("Hello world")')() 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 string.char function: local v0 = string.char(0x70,0x72,0x69,0x6E,0x74,0x28,0x22,0x48,0x65,0x6C,0x6C,0x6F, 0x2C,0x20,0x57,0x6F,0x72,0x6C,0x64,0x22,0x29) -- v0 equals 'print("Hello world")' load(v0)() And you can futher obfuscate the load function: local v1 = _ENV[string.char(0x6C,0x6F,0x61,0x64)] v1(v0)() ....
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/79124153
answers question: http://stackoverflow.com/q/79124153

http://stackoverflow.com/comment/139716588
type: Comment
comment on: http://stackoverflow.com/a/79231353
has text: This seems unnecessarily complicated.
score: 0
type: AnswerComment

lua-5.3
type: Tag
tag name: lua-5.3
tags question: http://stackoverflow.com/q/79197951

http://stackoverflow.com/a/79141625
type: Answer
downvote count: 0
score: 2
answers question: http://stackoverflow.com/q/79141463
has body: in Lua you can use string.sub to create a substring that removes the prefix. 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. — Programming in Lua Chapter: 20 – The String Library Here is a function example using the string.sub to remove prefix p from string s: function removeprefix(s, p) return (string.sub(s, 0, #p) == p) and string.sub(s, #p+1) or s end You can also leverage the string metatable to simplify the code: function removeprefix(s, p) return (s:sub(0, #p) == p) and s:sub(#p+1) or s end
upvote count: 2

http://stackoverflow.com/q/79231157
type: Question
has body: I'm wondering if this is a version mismatch? I needed to use a Lua 5.1.x version to interface with Love2D [Due to use of LuaJIT] 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. -- defines a factorial function function fact (n) if n == 0 then return 1 else return n * fact(n-1) end end print("Enter a number:") a = io.read("*number") -- read a number print(fact(a)) Attached is a snapshot of that section in the book; It feels bizarre that the official book would be wrong so I am assuming it is something I am doing and I must be silly. The exact error, which was already described above: attempt to perform arithmetic on local 'n' (a nil value) As far as I can tell, the "a" variable is not getting it's value transferred to "n" when it tries to run fact(a) in print(). 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 "Lua" into the command line both show that the system is using the provided 5.1 Lua] Thank you for your time! ♥
has title: Second Example in Lua 2nd Book Attempts To Perform Arithmetic On Nil Value
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139715460
score: 0
has comment: http://stackoverflow.com/comment/139717625
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139715503

http://stackoverflow.com/a/79151155
has comment: http://stackoverflow.com/comment/139570249
score: 0
answers question: http://stackoverflow.com/q/79151147
type: Answer
has comment: http://stackoverflow.com/comment/139570447
has body: The problem is that promises are asynchronous, but your game loop is synchronous. When you call resolve(), that does not directly continue executing the coroutine. It only resolves the promise, which schedules any registered promise reactions (such as the continuation of the asynchronous code that awaited that promise, or callback functions added via .then()) 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: (tasks[2] ??= []).push(task1); let gameTick = 0; while (gameTick &lt; 10) { print(`tick: ${gameTick}`); tasks[gameTick]?.forEach(f =&gt; f()) await Promise.resolve(); // if not even setTimeout() gameTick++; }

http://stackoverflow.com/comment/139717625
comment on: http://stackoverflow.com/q/79231157
type: Comment
type: QuestionComment
has text: 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
score: 0

http://stackoverflow.com/comment/139722447
type: Comment
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/79232356
score: 0

http://stackoverflow.com/comment/139727342
score: 0
comment on: http://stackoverflow.com/q/79238198
type: QuestionComment
type: Comment
has text: @Someprogrammerdude not related

http://stackoverflow.com/comment/140021296
type: QuestionComment
comment on: http://stackoverflow.com/q/79232356
has text: @LakshyaK2011 No it says nothing
type: Comment
score: 0

http://stackoverflow.com/comment/139445365
has text: Thanks, that's easier to work with. Answered, below.
comment on: http://stackoverflow.com/q/79080682
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139556639
has text: I think I might have an idea why my code is not working. 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. So, 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. Unfortunately, I have no idea how to do this... ;/
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79140278
type: Comment

http://stackoverflow.com/comment/139643432
type: Comment
has text: what's the question? I don't understand the sentence "I was expecting the output in the gfm"
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79190029

http://stackoverflow.com/comment/139520855
has text: check the result: `for k,v in pairs(v9()) do print(k,v) end` - will see many functions, and `print` too
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79124153

esp32
type: Tag
tag name: esp32
tags question: http://stackoverflow.com/q/79165559

http://stackoverflow.com/comment/139727479
score: 0
type: Comment
has text: [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)
comment on: http://stackoverflow.com/q/79238198
type: QuestionComment

http://stackoverflow.com/comment/139645420
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79191945
has text: thanks @shingo, I couldn't find this issue, will write an answer for future readers.

http://stackoverflow.com/comment/139522604
has text: 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...
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79124389

http://stackoverflow.com/comment/139526444
has text: 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).
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/79126377

http://stackoverflow.com/a/79167596
has body: The error is telling you that Models don't have a Position property. If you want to move Models around, you can use the GetPivot() and PivotTo(CFrame) methods. Try this: wait(1) local orchooseLimboModel : Model = game.Workspace.Orchooselimbo local targetPosition : CFrame = orchooseLimboModel:GetPivot() Player.Character:PivotTo(targetPosition)
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/79165928
upvote count: 1

http://stackoverflow.com/a/79197117
accepted answer of: http://stackoverflow.com/q/79196930
answers question: http://stackoverflow.com/q/79196930
score: 4
upvote count: 4
downvote count: 0
type: AcceptedAnswer
type: Answer
has body: The io.read("*n") parses the number, but it does not consume the end-of-line symbol. So the next io.read() 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 3 hello when asked for a number of names, and then you will see the hello being the first name read. As a simple workaround you can try to change maxNames = io.read("*n") to maxNames = io.read("*n", "*l"). The idea is to read the number, then read and discard the rest of the line.

autohotkey
type: Tag
tag name: autohotkey
tags question: http://stackoverflow.com/q/79135324

algorithm
type: Tag
tags question: http://stackoverflow.com/q/79228105
tag name: algorithm
tags question: http://stackoverflow.com/q/79495515

pyright
tag name: pyright
type: Tag
tags question: http://stackoverflow.com/q/79107680

http://stackoverflow.com/a/79238245
has body: Use an autocommand using the vim API: vim.api.nvim_create_autocmd("InsertLeave", { callback = function() print("Exited insert mode!"); end });
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79237808
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/79237808
score: 5

http://stackoverflow.com/comment/139441402
score: 0
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/79080682
type: Comment

http://stackoverflow.com/comment/139548368
comment on: http://stackoverflow.com/q/79139769
type: Comment
has text: You can choose one you like: https://github.com/search?q=%22function+table.update%22+language%3Alua&type=code
type: QuestionComment
score: 0

http://stackoverflow.com/comment/139625055
comment on: http://stackoverflow.com/a/79179832
type: Comment
score: 0
has text: 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. ``` local function recursive_insert(x, n) if n == 1 then return {x} end local l = table.pack(table.unpack(recursive_insert(x, n-1))) table.insert(l, x) return l end ```
type: AnswerComment

odt
type: Tag
tag name: odt
tags question: http://stackoverflow.com/q/79137236

http://stackoverflow.com/comment/139543132
comment on: http://stackoverflow.com/q/79137049
type: Comment
has text: [How do I ask and answer homework questions?](https://meta.stackoverflow.com/q/334822)
type: QuestionComment
score: 0

http://stackoverflow.com/q/79128096
answer count: 1
score: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/79128285
tagged with: yt-dlp
tagged with: lua
has title: How to ensure yt-dlp completes all tasks (including --recode option) before continuing in Lua script?
type: Question
has answer: http://stackoverflow.com/a/79128285
has body: I am using yt-dlp in a Lua script to download and then recode a video to MP4 format. Here’s a simplified version of my Lua code: local command = "yt-dlp.exe --recode mp4 <URL>" os.execute(command) print("End") The issue is that "End" gets printed as soon as yt-dlp finishes downloading, but before the --recode mp4 operation completes. It appears that os.execute doesn’t wait for the recoding process to finish, only the initial download. 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 "End"? Any suggestions for synchronizing this properly would be much appreciated! I tied this way but didn't bring any result var = "yt-dlp.exe --recode mp4 <URL>" os.execute(var) -- Wait for the recode process to finish local recode_done = false while not recode_done do -- Check if there are any processes with "ffmpeg" or other expected recoding process names local handle = io.popen("tasklist /FI \"IMAGENAME eq ffmpeg.exe\"") local result = handle:read("*a") handle:close() -- If "ffmpeg.exe" isn't found in the task list, we assume recoding is complete if not result:find("ffmpeg.exe") then recode_done = true end -- Wait briefly before checking again os.execute("timeout /t 1 >nul") end print("End") I've also searched on the internet for similar problems but I didn't get anything that could help.

ellipse
type: Tag
tag name: ellipse
tags question: http://stackoverflow.com/q/79160215

http://stackoverflow.com/comment/139543212
comment on: http://stackoverflow.com/q/79137049
type: Comment
score: 0
type: QuestionComment
has text: 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.

http://stackoverflow.com/q/79130745
score: 2
tagged with: lua
type: UnansweredQuestion
upvote count: 2
tagged with: neovim
has title: How to use a string value as a command in Lua
answer count: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/79139300
downvote count: 0
has body: Using the following code: local keymap = vim.keymap local opts = { noremap = true, silent = true } function jumpToClassDef() local test1 = "" local myClass = "<cmd> tag ." .. vim.fn.expand('<cword>') .. "<cr>" assert(loadstring(myClass)) return print(myClass) end keymap.set("n", "<leader>-", function() jumpToClassDef() end, opts) When I place the cursor on test1 and hit <leader>-, I receive the following error: unexpected symbol near < Why does this error occur and how do I solve it?

http://stackoverflow.com/comment/139734495
has text: It looks like a bug, please report it on the [Lua mailing list](https://lua.org/lua-l.html)
type: QuestionComment
comment on: http://stackoverflow.com/q/79194247
type: Comment
score: 0

http://stackoverflow.com/a/79110751
type: Answer
has comment: http://stackoverflow.com/comment/139497967
answers question: http://stackoverflow.com/q/79110440
has body: You not only have to worry about errors, but also about tail calls. The usual method is to use the func field returned by getinfo 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. local call_stack = {} function my_hook(event, line) local info = debug.getinfo(2, 'f') -- push "call" and "tail call" onto the stack if event == 'call' then table.insert(call_stack, {func = info.func, is_tail_call = false}) elseif event == 'tail call' then table.insert(call_stack, {func = info.func, is_tail_call = true}) elseif event == 'return' then local ci repeat -- pop the last call info from the stack ci = table.remove(call_stack) if ci and ci.func ~= info.func then -- The stack is unbalanced -- An error was occured in ci.func end until ci == nil or ci.func == info.func while ci and ci.is_tail_call do ci = table.remove(call_stack) -- If the popped call is a tail call -- this "ci" (the preceding call) is also returned here end end end
score: 0

http://stackoverflow.com/comment/139522552
score: 0
comment on: http://stackoverflow.com/a/79113541
type: AnswerComment
has text: 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?
type: Comment

http://stackoverflow.com/a/79198143
score: 6
accepted answer of: http://stackoverflow.com/q/79197951
answers question: http://stackoverflow.com/q/79197951
type: AcceptedAnswer
type: Answer
downvote count: 0
upvote count: 6
has body: Lua does not check the whole word. It only tests the first symbol after the optional asterisk sign. If you look at the lua sources, the liolib.c file that has io library functions - you'll find that the first * 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.

http://stackoverflow.com/q/79151316
has answer: http://stackoverflow.com/a/79151785
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: pandoc
answer count: 1
type: Question
upvote count: 1
has body: 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: If an element has a class or classes that aren't in the passed-in list, it gets removed, including its whitespace. If the element has no class, it remains. The markdown I would use to test it would be something like this: --- title: Example doc --- ## Images ![Generic image](generic_image.png) ![Generic image](generic_image.png){width=30px} ![Color only image](color_image.png){.color-only} ![Color only image](color_image.png){.color-only width=30px} ![Color only image](color_image.png){width=30px .color-only} ![BW only image](bw_image.png){.bw-only} ![BW only image](bw_image.png){.bw-only width=30px} ![BW only image](bw_image.png){width=30px .bw-only} ## Blocks ::: {.other} Block that shouldn't be filtered. ::: ::: Block that shouldn't be filtered. ::: ::: {.color-only} Color only block. ::: ::: {.bw-only} BW only block. ::: ## Spans [Span that shouldn't be filtered]{.other} [Color only span]{.color-only} [BW only span]{.bw-only} ## Links [Link that shouldn't be filtered](link.html) [Link that shouldn't be filtered](link.html){.other} [Color only link](link.html){.color-only} [BW only link](link.html){.bw-only} 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? Thanks I
tagged with: markdown
tagged with: lua
has title: Filter out unwanted classes with Pandoc and Lua

http://stackoverflow.com/a/79139300
score: 0
answers question: http://stackoverflow.com/q/79130745
type: Answer
has body: 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. Inferring from your function names and the use of the Neovim tag 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 :, and then entering the following: tag <some_identifier> To do the same via Lua code in Neovim, you would call vim.cmd with the above as a string argument: vim.cmd(":tag <some_identifier>") 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: vim.cmd(":tag " .. vim.fn.expand("<cword>") Finally, you can map this function to the <leader>- key sequence via the following: vim.keymap.set("n", "<leader>-", function() vim.cmd(":tag " .. vim.fn.expand("<cword>")) end, { noremap = true, silent = true }) To address the second question regarding the unexpected symbol, the error comes from the call to loadstring. loadstring takes a chunk, compiles it, and returns a function that can be called to execute the chunk. In parsing the chunk passed in, Lua unexpectedly 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 loadstring. However, you shouldn't need to use it in Neovim. Note that loadstring has been deprecated since Lua 5.2. You should now just use load.

http://stackoverflow.com/q/79200725
type: UnansweredQuestion
tagged with: mingw
tagged with: mingw-w64
score: 0
tagged with: iup
type: Question
has body: I cannot find a detailed guide on how to compile IM/CD/IUP under Mingw64. The instructions in the website do not help. I used tecmake and mingw32-make to no avail. Is it still supported? I get c:\work\luvit\cd&gt;cd src c:\work\luvit\cd\src&gt;tecmake all-gcc_dll The system cannot find the path specified. c:\work\luvit\tecmake\tecmakewin.mak:1835: dep/cd.dep.dllw6: No such file or directory mingw32-make: *** [c:\work\luvit\tecmake\tecmakewin.mak:1814: dep/cd.dep.dllw6] Error 255 The system cannot find the path specified. c:\work\luvit\tecmake\tecmakewin.mak:1835: dep/cd.dep.dllw6_64: No such file or directory mingw32-make: *** [c:\work\luvit\tecmake\tecmakewin.mak:1814: dep/cd.dep.dllw6_64] Error 255
answer count: 0
has title: How to compile IUP/CD/IM under mingw
tagged with: lua

http://stackoverflow.com/comment/139724129
comment on: http://stackoverflow.com/q/79234493
score: 0
type: Comment
has text: 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.
type: QuestionComment

http://stackoverflow.com/comment/139891434
type: Comment
score: 0
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/79145351

http://stackoverflow.com/a/79209062
has body: The issue you're encountering with self being nil during the OnLoad event is a common problem in World of Warcraft UI scripting, especially for custom frames. This typically happens because when the OnLoad 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. Here's why: In WoW, the self parameter is typically passed in automatically by the system when you use the OnLoad event in combination with a frame or button. However, if the OnLoad event is handled within XML, the frame might not have been fully initialized when the event fires, or the XML setup might not be correctly linked to the Lua function. The Root Cause The OnLoad 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. Reference the Frame Directly in Lua If you don’t want to change the XML, 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 frame by name within the MyAddonName_OnLoad function. fix: local frame = self or MyAddonName -- Fallback to MyAddonName if self is nil
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/79206391
answers question: http://stackoverflow.com/q/79206391

http://stackoverflow.com/comment/139715503
type: Comment
type: QuestionComment
score: 0
has text: Maybe it's how you run the file. Try saving that as fac.lua and running in a terminal `$ lua fac.lua`
comment on: http://stackoverflow.com/q/79231157

instanceof
tag name: instanceof
type: Tag
tags question: http://stackoverflow.com/q/79234692

http://stackoverflow.com/comment/139543841
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79124389
has text: 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... I 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.
type: Comment

http://stackoverflow.com/comment/139549993
comment on: http://stackoverflow.com/a/79124389
type: Comment
has text: 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....
score: 0
type: AnswerComment

goto
tag name: goto
tags question: http://stackoverflow.com/q/79166496
type: Tag

http://stackoverflow.com/a/79104208
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/139486609
has comment: http://stackoverflow.com/comment/139487109
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79104155
answers question: http://stackoverflow.com/q/79104155
has body: for i, creature in pairs(creatureArray) When looping through a table or dictionary, it returns a key/value pair. The i is considered the key, and the creature is considered the value. Here's an example: local t = { ["Item"] = "Value", ["Another Item"] = "Another Value", } for i, value in pairs(t) do print(i, value) end The output would be: Item Value Another Item Another Value

http://stackoverflow.com/comment/139545875
has text: Unfortunately, it's the same. I end up with plain text.
comment on: http://stackoverflow.com/q/79137236
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/a/79135390
has body: Adding this to my code: package.cpath =&quot;/Users/user_name/.luarocks/lib/lua/5.4/?.so;&quot; .. package.cpath package.path = &quot;/Users/user_name/.luarocks/share/lua/5.4/?.lua;&quot; .. package.path ... worked.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/79118768
answers question: http://stackoverflow.com/q/79118768

http://stackoverflow.com/comment/139654111
type: Comment
has text: @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.
type: AnswerComment
comment on: http://stackoverflow.com/a/79146726
score: 0

http://stackoverflow.com/comment/139678159
has text: @mikyll98, thank you
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79205736

yt-dlp
tags question: http://stackoverflow.com/q/79128096
type: Tag
tag name: yt-dlp

http://stackoverflow.com/comment/139546390
type: Comment
has text: 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...
score: 1
comment on: http://stackoverflow.com/q/79137236
type: QuestionComment

http://stackoverflow.com/comment/139504215
score: 0
comment on: http://stackoverflow.com/q/79112338
has text: ''''player.angle'''' is angle player is looking stored in degrees, Vec2 is just used to iterate for loops twice
type: QuestionComment
type: Comment

http://stackoverflow.com/a/79209376
answers question: http://stackoverflow.com/q/79203333
score: 0
type: Answer
has body: Here is a cute trick. It does not set local variables but allows us to use table field as global variables: local person = { name = 'James', age = 30, } do local print = print _ENV = person print(name,age) end

http://stackoverflow.com/comment/139465909
score: 1
type: Comment
has text: `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 }`
comment on: http://stackoverflow.com/q/79086554
type: QuestionComment

code-completion
tags question: http://stackoverflow.com/q/79238198
type: Tag
tag name: code-completion

http://stackoverflow.com/a/79218682
has body: I figured it out. The first argument was thisScene due to the &quot;:&quot; Corrected code: function thisScene.contact(a, b, coll)
upvote count: 1
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/79218557

http://stackoverflow.com/a/79202412
score: 0
type: Answer
answers question: http://stackoverflow.com/q/79179000
has body: Deep unpack table: function unpackAll(...) local args = {...} local result = {} local function unpackNested(tbl) for _, v in ipairs(tbl) do if type(v) == "table" then unpackNested(v) else table.insert(result, v) end end end unpackNested(args) return table.unpack(result) end Example: print(unpackAll({1,2,3},"a")) 1 2 3 a

http://stackoverflow.com/comment/139669595
has text: You `run` command does not include `command`, unlike the docker compose fragment.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/79205736
type: QuestionComment

firmware
tags question: http://stackoverflow.com/q/79165559
type: Tag
tag name: firmware

http://stackoverflow.com/comment/139488329
type: Comment
score: 0
comment on: http://stackoverflow.com/q/79106182
type: QuestionComment
has text: 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.

http://stackoverflow.com/a/79124389
has comment: http://stackoverflow.com/comment/139522604
score: 0
has comment: http://stackoverflow.com/comment/139543841
has comment: http://stackoverflow.com/comment/139526966
has body: The return directive is a part of ngx_http_rewrite_module, which means it's executed before the access phase (see a diagram below), and, according to the nginx docs, it “Stops processing and returns the specified code to a client”, that is, the access_by_lua_block is not executed at all, see this issue. rewrite_by_lua_block won't work either, as “this handler always runs after the standard ngx_http_rewrite_module”, that is, with return it also doesn't have a chance to be executed. set_by_lua_block runs before return, but the cosocket API is disabled in the context of this directive, which means ngx.req.read_body() won't work (API disabled in the context of set_by_lua* [...] in function 'read_body'). I would get rid of return and use content_by_lua_block to read the request body and produce the response.
has comment: http://stackoverflow.com/comment/139549993
type: Answer
answers question: http://stackoverflow.com/q/79124307

http://stackoverflow.com/comment/139525874
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/79113541
has text: I updated my answer, you also need to mark longjmp in the stdlib package with the noreturn attribute.
score: 0

http://stackoverflow.com/a/79217415
type: Answer
has body: In the end I changed 2 lines of code and now this works: client.connect_signal("unfocus", function(c) awful.spawn.easy_async_with_shell("xkb-switch", function(stdout) if c.valid then -- To avoid 'Invalid Object' error c.keyboard_layout = stdout end end) end) client.connect_signal("focus", function(c) if c.keyboard_layout == nil then c.keyboard_layout = "us(altgr-intl)" end awful.spawn("xkb-switch -s "..c.keyboard_layout, false) -- `false` to prevent cursor being stuck in 'loading' state end)
score: 0
answers question: http://stackoverflow.com/q/79217152

http://stackoverflow.com/comment/139572489
has text: @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?
comment on: http://stackoverflow.com/q/79145351
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139486609
type: AnswerComment
has text: 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.
comment on: http://stackoverflow.com/a/79104208
type: Comment
score: 0

http://stackoverflow.com/comment/139577522
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79145351
has text: 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.
type: Comment

node.js
tag name: node.js
tags question: http://stackoverflow.com/q/79151147
type: Tag
tags question: http://stackoverflow.com/q/79360326

http://stackoverflow.com/comment/139488320
type: Comment
score: 0
comment on: http://stackoverflow.com/q/79106182
has text: 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).
type: QuestionComment

.net
type: Tag
tag name: .net
tags question: http://stackoverflow.com/q/79203398
tags question: http://stackoverflow.com/q/79461719

http://stackoverflow.com/comment/139488712
comment on: http://stackoverflow.com/q/79106182
type: Comment
type: QuestionComment
score: 0
has text: @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 `premake5.exe --shell=posix gmake` as well as `premake5.exe gmake --shell=posix` I will be updating the post accordingly

nginx-location
tag name: nginx-location
type: Tag
tags question: http://stackoverflow.com/q/79124307

http://stackoverflow.com/comment/139926168
comment on: http://stackoverflow.com/q/79232356
type: Comment
has text: check console if it says anything.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139488336
type: Comment
type: QuestionComment
has text: Which version of premake5 do you use?
score: 0
comment on: http://stackoverflow.com/q/79106182

http://stackoverflow.com/comment/139716590
type: Comment
comment on: http://stackoverflow.com/a/79232073
score: 0
has text: I'm not sure OP is looking to maintain relative order either since the question states "least amount of movement of items".
type: AnswerComment

http://stackoverflow.com/comment/139545801
type: Comment
score: 0
has text: 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.
type: QuestionComment
comment on: http://stackoverflow.com/q/79137049

http://stackoverflow.com/comment/139644471
has text: https://github.com/lgi-devs/lgi/issues/196
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/79191945

async-await
type: Tag
tag name: async-await
tags question: http://stackoverflow.com/q/79151147

http://stackoverflow.com/comment/139488607
has text: @Jarod42 the latest version
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/79106182

http://stackoverflow.com/a/79299605
has body: I modified components/modules/node.c by replacing BUILDINFO_LFS_SIZE with 0 due to the following error during make (later changing to 256K) To calculate BUILDINFO_LFS_SIZE, awk &quot;{print strtonum( $1 )}&quot; is currently used. The strtonum() function is a gawk extension. But the gawk package is not included by default in Debian stable. You should either install the gawk package or apply PR#3675. EDIT. After installing gawk you need to perform make clean
score: 0
type: Answer
answers question: http://stackoverflow.com/q/79165559

http://stackoverflow.com/comment/139558005
has text: 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.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79140278

http://stackoverflow.com/comment/139488062
type: Comment
comment on: http://stackoverflow.com/q/79106182
score: 0
has text: the question is not about programming, but about the tool. can you edit the tags?
type: QuestionComment

mingw
tag name: mingw
type: Tag
tags question: http://stackoverflow.com/q/79200725

typescript
tag name: typescript
type: Tag
tags question: http://stackoverflow.com/q/79151147
tags question: http://stackoverflow.com/q/79360326

focus
tags question: http://stackoverflow.com/q/79160215
tag name: focus
type: Tag

http://stackoverflow.com/comment/139492131
has text: Where is the programming aspect?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/79105654
type: QuestionComment

http://stackoverflow.com/comment/139803160
type: Comment
comment on: http://stackoverflow.com/q/79180391
score: 0
has text: It seems you have to provide a [definition-file](https://luals.github.io/wiki/definition-files/).
type: QuestionComment

http://stackoverflow.com/comment/140021295
type: Comment
score: 0
has text: @kylaaa yes it does
type: QuestionComment
comment on: http://stackoverflow.com/q/79232356

http://stackoverflow.com/comment/139582605
type: Comment
has text: Why did you create a new project? Why not build with luarocks or create the project with cmake?
comment on: http://stackoverflow.com/q/79158510
score: 0
type: QuestionComment

gtk3
type: Tag
tag name: gtk3
tags question: http://stackoverflow.com/q/79191945

http://stackoverflow.com/comment/139545478
type: Comment
score: 0
has text: Can you try with `{['custom-style'] = "StrongEmphasis"}` instead of `class`?
comment on: http://stackoverflow.com/q/79137236
type: QuestionComment

zed
type: Tag
tag name: zed
tags question: http://stackoverflow.com/q/79068981

http://stackoverflow.com/q/79284034
tagged with: lua
has title: Embeding Lua with sol2 in C++ not working as intended with shared_ptr
type: Question
has body: I have a C++ Project and want to use Lua with sol2 for scripting but I have some trouble with shared_ptr. There is a function in my class SceneNode which takes an shared_ptr as Argument, but I always get an error... Function: std::shared_ptr<SceneNode> SceneNode::addChild(std::shared_ptr<SceneNode> child) { child->setParent(std::weak_ptr(shared_from_this())); children.push_back(child); return child; } Here I want to set everything up for Lua: void setup_lua() { sol::state lua; lua.open_libraries(sol::lib::base); lua.new_usertype<SceneNode>("SceneNode", sol::constructors< void(), void(std::string)>(), //sol::base_classes, sol::bases<std::enable_shared_from_this<SceneNode>>(), "id", &SceneNode::id, "name", &SceneNode::name, "addChild", &SceneNode::addChild ); lua.script_file("/Path/to/setup_lua.lua"); } setup_lua.lua looks like this: local node = SceneNode:new("node") print(node.name) print(node.id) local childNode = SceneNode:new("child") node:addChild(childNode) print(childNode.name) print(childNode.id) print(node) print(childNode) When I run the program, I get this output: node -2472761803519894154 [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<SceneNode>(std::shared_ptr<SceneNode>)') stack traceback: [C]: in method 'addChild' /Path/to/setup_lua.lua:13: in main chunk terminate called after throwing an instance of 'sol::error' 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<SceneNode>(std::shared_ptr<SceneNode>)') stack traceback: [C]: in method 'addChild' /Path/to/setup_lua.lua:13: in main chunk Aborted (core dumped) I tried to add a Child to my parent node but always get an error: sol: runtime error: stack index 2, expected userdata, received so…
type: UnansweredQuestion
tagged with: c++
has comment: http://stackoverflow.com/comment/139813086
score: 0
tagged with: shared-ptr
answer count: 0
has comment: http://stackoverflow.com/comment/139811275

http://stackoverflow.com/q/79267808
upvote count: 1
favorite count: 0
type: AnsweredQuestion
answer count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/79267878
has body: Like I got two tables: {["a"] = "aaa"} and {["b"] = "bbb"} And make it into one table: {["a"] = "aaa", ["b"] = "bbb"} I am already tried this code: function ListConcat(t1,t2) for i=1,#t2 do t1[#t1+1] = t2[i] end return t1 end local function getkeys(tab) local keyset={} local n=0 for k,v in pairs(tab) do n=n+1 keyset[n]=k end return keyset end local function has_value (tab, val) for index, value in ipairs(tab) do if value == val then return true end end return false end function TableConcat(t1, t2) local key1s = getkeys(t1) local key2s = getkeys(t2) local keys = ListConcat(key1s, key2s) local rtb = {} for i=1,#keys do local key = keys[i] if has_value(key1s, key) then rtb[key] = t1[key] else rtb[key] = t2[key] end end return rtb end Where am I wrong, and is there are easier solution? Nothing works, tried other codes. And I don't need to print it like in other people's question. Dummy code: local funcs = require("funcs") a = {["a"] = "a"} b = {["b"] = "b"} print(funcs.TableConcat(a, b)) -- Wanted: {["a"] = "a", ["b"] = "b"} -- Returns: {["a"] = "a"}
tagged with: lua
tagged with: lua-table
score: 1
accepted answer: http://stackoverflow.com/a/79267878
has title: Any way to combine two tables in lua?

http://stackoverflow.com/q/79358608
upvote count: 2
tagged with: love2d
answer count: 1
favorite count: 0
downvote count: 1
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/79358892
accepted answer: http://stackoverflow.com/a/79358892
tagged with: lua
tagged with: timer
score: 1
has body: below is where the error may occur Here 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? I'm learning Downwell's effect and the tutorial link is here:https://github.com/a327ex/blog/issues/9 Object = require("classic") GameObject = require("GameObject") Timer = require 'hump/timer' function love.load() Game_objects = {} Game_object = createGameObject('GameObject',100, 100) --dealing with canvas main_canvas = love.graphics.newCanvas(320, 240) main_canvas:setFilter("nearest", "nearest") love.window.setMode(960, 720) timer = Timer() --Here! timer.after(4, function() Game_object.dead = true end) end function love.update(dt) timer.update(dt) for i = #Game_objects, 1, -1 do Game_object = Game_objects[i] Game_object:update(dt) if Game_object.dead then table.remove(Game_objects, i) end end end function love.mousepressed(x,y,button) if button == 1 then Game_object.dead =true end end function love.draw() love.graphics.setCanvas(main_canvas) love.graphics.clear() for _, Game_object in ipairs(Game_objects) do Game_object:draw() end love.graphics.setCanvas() love.graphics.draw(main_canvas, 0, 0, 0, 3, 3) end function createGameObject(type,x, y, opts) local game_object = _G[type](x, y, opts) table.insert(Game_objects, game_object) return game_object -- return the instance in case we wanna do anything with it end just dont know and it had took me 2 days. can anyone help me~ :(
has title: Using love2d timer, bug reporting 'Error hump/timer.lua:78: attempt to index local 'self' (a number value) '

http://stackoverflow.com/q/79387197
downvote count: 1
type: Question
tagged with: lua
tagged with: http://stackoverflow.com/tag/pdf
score: 1
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/79387878
favorite count: 0
has body: 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. What I tried: Checked the script logs: everything indicates that page 2 has been generated and included. Validated the structure of PDF objects in the file: all objects (pages, references, xref) seem to be in place. Checked cross-reference structure (xref) and /Kids entries for page tree. local function creerPDF(fichierPDF, data) local fichier = assert(io.open(fichierPDF, "w")) fichier:write("%PDF-1.4\n") local pages = {} local kids = {} local positionY = 700 local lignesParPage = 30 local function nouvellePage() local pageObj = #pages * 2 + 3 local contentObj = pageObj + 1 table.insert(kids, pageObj .. " 0 R") table.insert(pages, {page = pageObj, content = contentObj, stream = ""}) positionY = 700 end local function ajouterEnTete(page) local header = "q\n" header = header .. "BT /F1 12 Tf 20 820 Td (Programmeur : LumiArt-Studio) Tj ET\n" header = header .. "BT /F1 12 Tf 20 800 Td (Date : " .. os.date("%d/%m/%Y %H:%M") .. ") Tj ET\n" header = header .. "BT /F1 12 Tf 20 780 Td (Machine : TestMachine) Tj ET\n" header = header .. "BT /F1 12 Tf 50 720 Td (ID) Tj ET\n" header = header .. "BT /F1 12 Tf 150 720 Td (Type) Tj ET\n" header = header .. "BT /F1 12 Tf 250 720 Td (Name) Tj ET\n" header = header .. "BT /F1 12 Tf 350 720 Td (FixtureType) Tj ET\n" header = header .. "BT /F1 12 Tf 450 720 Td (U.Addrs) Tj ET\n" header = header .. "Q\n" page.stream = page.stream .. header end local function ajouterDonnee(page, ligne) local columnPositions = {50, 150, 250, 350, 450} local values = {ligne.id, ligne.idtype, ligne.name, ligne.fixturetype, ligne.uaddrs} for i, value in ipairs(values) do page.stream = page.stream .. string.format("BT /F1 10 Tf %d %d Td (%s) Tj ET\n", …
has title: Problem with a missing page when generating a PDF in Lua
upvote count: 2

http://stackoverflow.com/a/79318877
type: AcceptedAnswer
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/139875077
has body: Short answer: not possible. Longer: As you've correctly identified, the syntactic sugar exp ::= functiondef functiondef ::= function funcbody funcbody ::= ‘(’ [parlist] ‘)’ block end stat ::= function funcname funcbody stat ::= local function Name funcbody funcname ::= Name {‘.’ Name} [‘:’ Name] that enables the shorthand function name () end syntax (and thus the form with an implicit self variable) changes the function definition from an expression to a statement by introducing the assignment. There is no mechanism to interrupt this syntactically, in order to insert an arbitrary expression in to the assignment (desired here: a functioncall, coroutine.wrap). Similarly, the arguments to a function call must be expressions - so something like coroutine.wrap(function Foo:bar() end) is also not possible. Short of modifying the language with a new keyword (think async function Foo:bar() end), your example of Foo.bar = coroutine.wrap(function(self) ... end) is as good as it gets. For what it is worth, this example is perfectly understandable, and self-documenting (IMO; pun intended). Lua 5.4: 3 – The Language | 3.3.3 – Assignment | 3.4.10 – Function Calls | 3.4.11 – Function Definitions | 9 – The Complete Syntax of Lua
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/139874376
accepted answer of: http://stackoverflow.com/q/79318781
answers question: http://stackoverflow.com/q/79318781

http://stackoverflow.com/q/79419434
type: Question
has comment: http://stackoverflow.com/comment/140062616
has answer: http://stackoverflow.com/a/79420312
has title: Parsing Regex in Lua returns nil
score: 2
tagged with: lua
downvote count: 0
answer count: 1
tagged with: regex
favorite count: 0
accepted answer: http://stackoverflow.com/a/79420312
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/140062873
upvote count: 2
has body: I'm attempting to parse some output from CMake, but I keep getting nil when I attempt to loop over all the matches. local s = Available configure presets: "x64-debug" - x64 Debug "x64-release" - x64 Release "x86-debug" - x86 Debug "x86-release" - x86 Release for word in string.gmatch(s, [["(.*?)"\s{1,}-\s{1,}(.*)]]) do print(word) end Expected output: x64-debug x64 Debug x64-release x64 Release ... 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: https://regex101.com/r/jP3jBk/1) Here's the regex: "(.*?)"\s{1,}-\s{1,}(.*)

http://stackoverflow.com/q/79369109
tagged with: roblox
has body: The animation is owned by the group and the game is also owned by the group. I created the animation on a R6 rig and all the players in the game is R6. The priority is set to the highest (action 4) The animation id is correct Animation is publish to roblox. The console says it's playing. Player is not doing the animation. local Players = game:GetService("Players") local selectedPlayer = game:GetService('ReplicatedStorage'):WaitForChild("Events"):WaitForChild("SelectedPlayer") local tool = script.Parent local blade = tool:WaitForChild('Blade') local slashAnim = tool:WaitForChild('SlashAnim') local debounce = false local playersHit = {} local COOLDOWN = 1 tool.Activated:Connect(function() if debounce then return end local humanoid : Humanoid = tool.Parent:FindFirstChild("Humanoid") if not humanoid then warn("Humanoid not found in tool.Parent:", tool.Parent.Name) return end local animator : Animator = humanoid:FindFirstChild("Animator") or Instance.new("Animator", humanoid) local animTrack : AnimationTrack = animator:LoadAnimation(slashAnim) --animTrack:AdjustWeight(1) print(animator:GetPlayingAnimationTracks()) repeat task.wait() until animTrack.Length > 0 animTrack:Play() print("Animaion ID: ", animTrack.Animation.AnimationId) print("Animation Playing:", animTrack.IsPlaying) print("Animation Priority:", animTrack.Priority) debounce = true animTrack.Stopped:Wait() -- Wait for animation to complete debounce = false end) blade.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild('Humanoid') if not humanoid or hit.Parent == tool.Parent or playersHit[hit.Parent] or not debounce then return end selectedPlayer:FireServer(humanoid) -- Prevents overloading server when player has activated tool playersHit[hit.Parent] = true task.wait(COOLDOWN) playersHit[hit.Parent] = nil end) Console Prints this. { [1] = ToolNoneAnim, [2] = Animation1, [3] = SlashAnim } - Client - WeaponScript:25 Animaion ID: rbxassetid://107803674678292 - Client - WeaponScript:29 Animatio…
answer count: 1
type: UnansweredQuestion
tagged with: animation
has title: Roblox Animation Not Playing Even Though Animation Owned by Group and Game Owned by Group and Priority Is Highest
score: 0
has answer: http://stackoverflow.com/a/79369134
type: Question
tagged with: lua

http://stackoverflow.com/q/79420032
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/140068872
score: 1
tagged with: neovim
favorite count: 0
has body: 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 local function assemble_abspath_candidates() -- Make sure user data path preceedes the system paths local user_data = vim.fn.stdpath('data') local data_dirs = vim.fn.stdpath('data_dirs') -- Make sure user config path preceedes system config paths local user_config = vim.fn.stdpath('config') local config_dirs = vim.fn.stdpath('config_dirs') -- Print data_dirs for i, val in ipairs(data_dirs) do vim.print("datadir " .. i .. ": " .. val) end -- Print config dirs for i, val in ipairs(config_dirs) do vim.print("config dir " .. i .. ": " .. val) end local combined_paths = { user_data, user_config, unpack(data_dirs), unpack(config_dirs) } -- Print it all for i, val in ipairs(combined_paths) do vim.print(i .. ": " .. val) end return combined_paths end The outcome of this however is not how I expected it: datadir 1: /usr/share/i3/nvim datadir 2: /usr/share/gnome/nvim datadir 3: /usr/local/share/nvim datadir 4: /usr/share/nvim datadir 5: /var/lib/snapd/desktop/nvim config dir 1: /etc/xdg/xdg-i3/nvim config dir 2: /etc/xdg/nvim 1: /home/myuser/.local/share/nvim 2: /home/myuser/.config/nvim 3: /usr/share/i3/nvim 4: /etc/xdg/xdg-i3/nvim 5: /etc/xdg/nvim For some reason only the first value from datadir is taken. Why does this happen? The question is different from unpack as function argument since I don't call a function but I want to expand a table using the unpack results (which according to this documentation should result in the expanded values being reimagined as table elements). 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.. (NVIM v0.11.0-dev-1161+g6ef80eb42c LUA 5.1 interpreter)
linked to: http://stackoverflow.com/q/37372182
type: Question
has comment: http://stackoverflow.com/comment/140063978
has comment: http://stackoverflow.com/comment/140063495
has comment: http://stackoverflow.com/comment/140063344
has title: Two unpacks into one table doesn't work in lua
upvote count: 1
answer count: 0
tagged with: lua
duplicate of: http://stackoverflow.com/q/37372182
downvote count: 0
linked to: http://stackoverflow.com/q/79179000

http://stackoverflow.com/a/79270481
accepted answer of: http://stackoverflow.com/q/79270435
answers question: http://stackoverflow.com/q/79270435
has comment: http://stackoverflow.com/comment/139785507
score: 3
downvote count: 0
type: AcceptedAnswer
type: Answer
upvote count: 3
has body: When I'm going to compile &amp; dump, should I bind C functions before compile? No, just like how you can run luac to compile a single lua script. When I'm going to use the precompiled binary, do I need to bind C functions again, before loading the binary? Yes, but not before loading, but before running, so the only difference is that you can save compilation time.

http://stackoverflow.com/q/79322739
tagged with: lua-patterns
has answer: http://stackoverflow.com/a/79322777
score: -1
downvote count: 1
has body: I would like to use "words" instead of individual characters in Lua's char-set functionality. My toy-example below should illustrate my problem. https://www.lua.org/pil/20.2.html -- print (string.find('Animal=Dog','Animal=[(Dog)(Cat)]')) -- gets a match, good print (string.find('Animal=Cat','Animal=[(Dog)(Cat)]')) -- gets a match, good print (string.find('Animal=DogCat','Animal=[(Dog)(Cat)]')) -- gets a match as expected, but not what I want print (string.find('Animal=CatDog','Animal=[(Dog)(Cat)]')) -- to my surprise, this one matches -- so I try to anchor the string for an exact match, but it yields nil? print (string.find('Animal=Dog','^Animal=[(Dog)(Cat)]$')) -- nil, but this is what I think should work
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/10438358
duplicate of: http://stackoverflow.com/q/10438358
upvote count: 0
tagged with: lua
type: Question
has title: lua string pattern matching - using specific words as char-sets
type: UnansweredQuestion

http://stackoverflow.com/q/79338135
tagged with: openresty
has body: lua-resty-openidc version 1.8.0 OpenID Connect provider Spring Authotrization Server Question In this code local state = resty_string.to_hex(resty_random.bytes(16)) When state will be set in session, should check session has already exists state? Expected When state has already in session, use it. When state not in session, generate a new and set in session. local function openidc_authorize(opts, session, target_url, prompt) local resty_random = require("resty.random") local resty_string = require("resty.string") local err -- generate state and nonce local state = resty_string.to_hex(resty_random.bytes(16)) local nonce = (opts.use_nonce == nil or opts.use_nonce) and resty_string.to_hex(resty_random.bytes(16)) local code_verifier = opts.use_pkce and b64url(resty_random.bytes(32)) -- assemble the parameters to the authentication request local params = { client_id = opts.client_id, response_type = "code", scope = opts.scope and opts.scope or "openid email profile", redirect_uri = openidc_get_redirect_uri(opts, session), state = state, } if nonce then params.nonce = nonce end if prompt then params.prompt = prompt end if opts.display then params.display = opts.display end if code_verifier then params.code_challenge_method = 'S256' params.code_challenge = openidc_s256(code_verifier) end if opts.response_mode then params.response_mode = opts.response_mode end -- merge any provided extra parameters if opts.authorization_params then for k, v in pairs(opts.authorization_params) do params[k] = v end end -- store state in the session session:set("original_url", target_url) session:set("state", state) session:set("nonce", nonce) session:set("code_verifier", code_verifier) session:set("last_authenticated", ngx.time()) if opts.lifecycle and opts.lifecycle.on_created then err = opts.lifecycle.on_created(session, params) if err then log(WARN, "failed in `on_created` handler: " .. err) return err end end local res res, err = session:save() if err then log(WARN, "unable to save sessio…
type: UnansweredQuestion
score: 0
tagged with: lua-resty-openidc
has title: When Authorize should state check in session?
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139910389
type: Question
has comment: http://stackoverflow.com/comment/139932002

http://stackoverflow.com/a/79303247
answers question: http://stackoverflow.com/q/79303030
score: 0
type: Answer
has body: The % in expand("%:p:h") represents the name of the current buffer, which… doesn't seem to be what you are actually after, and can reasonably be assumed to be different from plugin to plugin anyway. Furthermore, the gx 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 can implement a gx 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 "guideline" to help with that. All you have at your disposal is, at a low level: Vim's own file-related functions found at :help file-functions, functionalities provided by embedded scripting languages like Lua, Ruby, Python, etc. and, at a higher level: whatever API, if any, is exposed by those plugins. FWIW, the general pattern is to: yank the word under the cursor, put it into a variable, try to get a proper filename out of it with some of the functions under :help file-functions. Note that it may require some context that may or may not be available at the time of execution, like parent directory, filetype, etc. Here is a very good low-level gx rewrite to serve as inspiration. Expanding on @Matt's comment, there are dozens of file explorers out there, and they all work around the lack of an actual "common API for Vim file managers" with various mutually incompatible hacks. That lack of common API will undoubtedly force you to make a choice: implement your generic gx-like command entirely on your own, only using low-level methods, implement your generic gx-like command using the private APIs of some or all of the myriad file explorers, eventually implementing a low-level fallback anyway. None of those seem particularly thrilling to me.

http://stackoverflow.com/q/79297042
tagged with: lua
tagged with: vim-registers
has comment: http://stackoverflow.com/comment/139832590
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/139832646
has body: Background: Currently, I am forwarding a selection to Telescope's Live-Grep-Args plugin via a register by using the following code: ... -- Forward Visual Selection to Live-Grep-Args -- local function grep_visual_selection() -- Yank the current visual selection into to register "a" vim.cmd('normal! "ay') -- Get the content of register "a" and escape spaces local visual_selection = vim.fn.escape(vim.fn.getreg('a'), ' ') -- Call Telescope live_grep with the escaped visual selection vim.cmd('Telescope live_grep default_text=' .. visual_selection) end ... keymap('v', '<leader>fs', grep_visual_selection, { noremap = true, silent = true }) While this works, I am wondering myself why the unnamed register is also modified in parallel to the register "a". This behaviour also persists when yanking manually a selection to a specific register (in this case register "a"). I would have expected only the register "a" to be modified. Because of this behaviour, the following questions came up to my mind Questions Does yanking in vim/nvim always modify the unnamed register? (Even when depositing a selection in a special register) Are there any approaches which do not modify the unnamed register?
tagged with: neovim
score: 0
has title: Forward Visual Mode Selection in Neovim to Telescope's Live-Grep-Args via Register
type: Question
answer count: 0

http://stackoverflow.com/q/79417967
type: Question
tagged with: lua
tagged with: copas
has answer: http://stackoverflow.com/a/79499000
accepted answer: http://stackoverflow.com/a/79499000
type: AnsweredQuestion
answer count: 1
score: 0
tagged with: terminal
has title: how to implement the event loop in copas and how does it work?
has body: 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: [==============]40% press 'q' to go back You can switch between the menu while the progress bar runs. Here's the code for the main application and the progress bar ui file : main.lua local sys = require("system") local UI = require("ui") local copas = require("copas") function displayMenu() print("=============") print("1. Check Time") print("2. Get Mono Time") print("3. Give Feedback") print("4. Progress Bar Demo") print("6. Exit") print("=============") end function sleep() local input = io.read() local gotInput = sys.readkey(input) print(gotInput) end function getTime() local time = sys.gettime() local date = os.date("Current Time: %Y-%m-%d %H:%M:%S", time) print(date) end function monoTime() local response = sys.monotime() print(response) end function UI.prompt(message) print(message .. " (yes/no):") local response = io.read() if response == "yes" then return true else return false end end function uiPrompt() local response = UI.prompt("Do you like lua?") if response == true then print("Thats great!") else print("So sad to hear :(") end end while true do displayMenu() io.write("Select an Option: ") local choice = tonumber(io.read()) if choice == 1 then getTime() elseif choice == 2 then monoTime() elseif choice == 3 then uiPrompt() elseif choice == 4 then copas.addthread( function () local total = 100 for i=1, total do UI.progressBar(i, total) copas.pause(0.1) end print() end) elseif choice==6 then break end end copas.loop() ui.lua UI={} function UI.progressBar(current, total) local widthOfBar = 50 local progress = math.floor((current / to…

http://stackoverflow.com/q/79293179
has title: How to Disable Syntax Highlighting in LuaHelper While Keeping Debugger and Formatter Features?
type: Question
tagged with: lua
has answer: http://stackoverflow.com/a/79296448
tagged with: visual-studio-code
tagged with: visual-studio-debugging
answer count: 1
tagged with: syntax-highlighting
type: UnansweredQuestion
has body: I am working with Lua in VS Code and using two extensions: LuaHelper by Tencent (provides debugging and formatting features). MTA:SA Lua by Dominic Hock (provides syntax highlighting for MTA-specific functions). The issue arises when I enable LuaHelper after MTA:SA Lua is already active. LuaHelper seems to override the syntax highlighting provided by MTA:SA Lua, causing the MTA-specific syntax highlighting to disappear. I want to disable syntax highlighting in LuaHelper while keeping its other features, such as the debugger and formatter. Is there a way to achieve this? Steps to reproduce: Install and activate the MTA:SA Lua extension. Enable the LuaHelper extension. Notice that MTA:SA Lua's syntax highlighting is overridden. What I've tried: Checking LuaHelper's settings for an option to disable syntax highlighting (couldn't find one). Reordering the extensions in VS Code's settings (didn't help). Any advice or workarounds would be greatly appreciated! Environment: VS Code Version: version 1.96.1 LuaHelper Version: version 0.2.29 MTA:SA Lua Version: version 2.4.0 GitHub
score: 0

http://stackoverflow.com/q/79408191
tagged with: lua
tagged with: scripting
tagged with: logitech-gaming-software
type: UnansweredQuestion
tagged with: logitech
has comment: http://stackoverflow.com/comment/140077413
answer count: 0
score: 0
type: Question
has title: Abort script with same command as started with Lua in Logitech G HUB
has body: 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: function OnEvent(event, arg) if event == "MOUSE_BUTTON_PRESSED" and arg == 9 then --Skipping over string end end I've tried setting global flags and a few other solutions but I can't seem to get it right.

http://stackoverflow.com/a/79289781
has comment: http://stackoverflow.com/comment/139819624
has body: From Lua, if the debug library is available, you can use debug.getmetatable and debug.setmetatable to change the metatables for non table types. As with any metatable, the __index metamethod can be used to make the object respond to key indexing. A cursory example. Note that in debug.getmetatable(0) and debug.setmetatable(0, mt), 0 is a chosen as an arbitrary number value. Passing any number value to these functions will work to access the metatable for the type. local mt = debug.getmetatable(0) or {} local methods = {} mt.__index = methods function methods:clamp(lower, upper) if lower &gt; self then return lower end if upper &lt; self then return upper end return self end debug.setmetatable(0, mt) for i = 1, 5 do local n = math.random(100) print(n, n:clamp(33, 66)) end 88 66 48 48 46 46 20 33 70 66 See Lua 5.4: 2.1 - Values and Types | 2.4 – Metatables and Metamethods | 6.10 – The Debug Library
has comment: http://stackoverflow.com/comment/139819571
accepted answer of: http://stackoverflow.com/q/79289693
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/79289693
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/139819465
score: 3
has comment: http://stackoverflow.com/comment/139819597

http://stackoverflow.com/comment/140031081
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/79353612
score: 0
type: QuestionComment

http://stackoverflow.com/q/79275737
type: Question
downvote count: 0
answer count: 0
tagged with: lua
has title: Can I copy the vim api in neovim
score: 1
tagged with: neovim-plugin
type: UnansweredQuestion
tagged with: neovim
favorite count: 0
has body: 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 backup = vim -- do some stuff with `vim` vim = backup I tried to do it like written above lua vim.o.number = true lua backup = vim lua vim.o.number = false lua vim = backup but the line numbers didn't reappear once I tried to resign vim = backup I also tried to do backup = vim.deepcopy(vim) but it got worst as this time I got an error E5108: Error executing lua vim/shared.lua:0: Cannot deepcopy object of type userdata I also tried to read the neovim documentation but didn't found the information 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
upvote count: 1

http://stackoverflow.com/q/79407984
type: UnansweredQuestion
tagged with: neovim
has title: How to move in neovim insertmode
upvote count: 1
favorite count: 0
has body: Hi I wanted to create a key map of ctrl + {hjkl} to be able to move through the code, with these keys while I'm in insert mode. Here is what i wrote in my keymaps.lua file: local function map(mode, lhs, rhs, opts) local options = { noremap = true, silent = true } if opts then options = vim.tbl_extend('force', options, opts) end vim.api.nvim_set_keymap(mode, lhs, rhs, options) end -- InsertMode movement map('i', '&lt;C-h&gt;', '&lt;Left&gt;') map('i', '&lt;C-j&gt;', '&lt;Down&gt;') map('i', '&lt;C-k&gt;', '&lt;Up&gt;') map('i', '&lt;C-l&gt;', '&lt;Right&gt;') The problem is that and are working correctly but and do not seem to do any thing at all. I also checked if terminal is sending the correct keys when I press them and i think it was OK. Anyone has any idea about it or any better ways to move in insert mode would be appreciated. Update: I tried 4 different terminals (Ghostty - Kitty - xterm - cosmic terminal) and none worked so it is not terminal related issue I tried removing keymaps first and It throw an error saying the keymaps does not exist to delete them I tried modern way of setting the keymaps and they did not worked For some reason none of the mappings in insert mode were listed in :map commands output while two of them were working.
tagged with: config
answer count: 3
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/79408046
tagged with: lua
has answer: http://stackoverflow.com/a/79408064
score: 1
has answer: http://stackoverflow.com/a/79408069

http://stackoverflow.com/comment/140077413
score: 0
comment on: http://stackoverflow.com/q/79408191
type: Comment
type: QuestionComment
has text: Can you share the solution using a flag? It seems like that should work if done correctly.

http://stackoverflow.com/q/79358250
favorite count: 0
type: Question
tagged with: luaj
tagged with: java
answer count: 0
tagged with: lua
has body: I have some Lua scripts that serve as LIBs, they create custom methods to be used later, for example: function Player:addPartner() print('Party partner added from Lua script!' .. tostring(self)) end I have the player class like this: class Player { private String name; public Player(String name) { this.name = name; } @Override public String toString() { return "Player{name='" + name + "'}"; } } What I need is for the addPartner method to be available to all instances of Player that are created, remembering that this is just one example of a method, there may be several others with or without parameters. In addition, within the method, self must be accessible within the method. I need this method to be available to be accessed via Java and via Lua Script
upvote count: 1
score: 1
has title: Create a function in Lua script and associate an object in java using luaJ
type: UnansweredQuestion
downvote count: 0
tagged with: function

http://stackoverflow.com/q/79395710
has body: 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. 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? local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local Workspace = game:GetService("Workspace") local LOBBY_START_TIME = 5 local MIN_PLAYERS = 1 local carsFolder = Workspace:WaitForChild("Cars") local lobbySpawn = Workspace:WaitForChild("LobbySpawn") local function assignCarToPlayer(player) for _, car in pairs(carsFolder:GetChildren()) do if car:FindFirstChild("DriveSeat") and not car.DriveSeat.Occupant then local character = player.Character or player.CharacterAdded:Wait() if character and character:FindFirstChild("Humanoid") then local humanoid = character:FindFirstChild("Humanoid") character:SetPrimaryPartCFrame(car.DriveSeat.CFrame) car.DriveSeat:Sit(humanoid) print(player.Name .. " seating in car!") break end end end end local function startGame() print("Game is started!") for _, player in pairs(Players:GetPlayers()) do assignCarToPlayer(player) end end local function waitForPlayers() while true do if #Players:GetPlayers() >= MIN_PLAYERS then print("Enought players " .. LOBBY_START_TIME .. " seconds.") wait(LOBBY_START_TIME) startGame() break else print("Waiting Players... " .. #Players:GetPlayers() .. "/" .. MIN_PLAYERS) end wait(1) end end Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:SetPrimaryPartCFrame(lobbySpawn.CFrame) end) end) waitForPlayers()
has answer: http://stackoverflow.com/a/79428838
answer count: 1
type: UnansweredQuestion
has title: How to spawn a player in a car?
has comment: http://stackoverflow.com/comment/140030963
score: 0
tagged with: roblox
type: Question
has comment: http://stackoverflow.com/comment/140051250
tagged with: lua

http://stackoverflow.com/a/79257991
downvote count: 0
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/79255304
has body: A function may not behave like a table, but a table may behave like a function through the __call metamethod. A __call metamethod is invoked whenever the associated table is called as if it were a function. For example: local describe = setmetatable({}, { __call = function (self) print('describe() called', self) end }) function describe.skip() print('describe.skip() called') end describe() describe.skip() describe() called table: 0x5570496f0890 describe.skip() called Additionally, __index and __newindex may be used to create complete proxies. See also PIL 13.4.4 – Tracking Table Accesses, which discusses proxy tables.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/79255304
type: Answer
has comment: http://stackoverflow.com/comment/139763978

http://stackoverflow.com/a/79300385
type: Answer
has comment: http://stackoverflow.com/comment/139885259
score: 0
has body: I had the same problem try disabling StreamingEnabled from Worksapce that worked for me. Edit: You can also put your cameras in ReplicatedFirst so don't gets deleted. Example https://devforum.roblox.com/t/issue-with-parts-disappearing-in-studio/2478353
answers question: http://stackoverflow.com/q/79299671

http://stackoverflow.com/comment/140043859
score: 0
type: AnswerComment
has text: can you tell me what the internal representation of the table means? how does it influence the index chosen to assign the value? (if you can even explain it to me, I'm quite new to this, thanks anyway).
type: Comment
comment on: http://stackoverflow.com/a/79398500

http://stackoverflow.com/a/79330294
answers question: http://stackoverflow.com/q/79285284
has body: 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: In require("mysqloo"), you're assuming that a table or function called ASAPDriver has a MySQLQuery property (e.g., ASAPDriver = {}; ASAPDriver.MySQLQuery = function(perform sql connection)). Since your current library may not be well maintained, I recommend switching to a more actively maintained alternative. Example of such is https://github.com/FredyH/MySQLOO You can use this library to query your MySQL connection and map the response to your UI or cache it in a global table. Also, check if ASAPDriver 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. Additionally, see if you follow the instruction as described here https://nodecraft.com/support/games/gmod/adding-mysqloo-to-your-gmod-server
score: 0
type: Answer

http://stackoverflow.com/comment/139741466
comment on: http://stackoverflow.com/q/79246572
has text: 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.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/79328249
has answer: http://stackoverflow.com/a/79328257
tagged with: string
tagged with: file
upvote count: 4
has comment: http://stackoverflow.com/comment/139888624
favorite count: 0
has title: How do I convert a string to a table in Lua?
has body: I have a string like such: {a="foo", b="bar", c=12345} (imported & read from a file) 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? 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. I am a beginner with Lua, so would greatly prefer something simple.
downvote count: 0
tagged with: set
tagged with: http://stackoverflow.com/tag/json
tagged with: lua
type: AnsweredQuestion
answer count: 1
accepted answer: http://stackoverflow.com/a/79328257
score: 4
has comment: http://stackoverflow.com/comment/139888626
type: Question

http://stackoverflow.com/q/79250441
tagged with: protofield
type: Question
has title: Initialize lua dissector ProtoField table inside protocol init function
tagged with: lua
answer count: 1
type: UnansweredQuestion
has body: I would like to initialize the fields protocol table inside the protocol init function, is it possible ? I've tried the following but it doesn't seem to be working: function my_protocol_addProtoFieds() local field_table = {} local attr_id = "test" local field_name = "proto." .. attr_id local field_abbr = attr_id local ltype = ftypes.BOOLEAN if ltype ~= nil then local field = ProtoField.new(field_name, field_abbr, ltype) table.insert(field_table, field) end my_protocol.fields = field_table end function my_protocol.init() -- read some initialization files my_protocol_addProtoFieds() end
linked to: http://stackoverflow.com/q/75379622
has answer: http://stackoverflow.com/a/79253063
score: 0

http://stackoverflow.com/a/79313082
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79283384
answers question: http://stackoverflow.com/q/79283384
score: 2
has body: You need to retrieve these functions as values that live in the Lua state. You must not store pointers to values managed by Lua. These may become invalid at any point because the GC does not know you are holding them. For example one option are global callbacks, or global callback tables. In this case the function is identified by the "path" of names that leads for it. On the C side of things, you then just index _G["callback"] and call that, or you get _G["myapitable"]["mycallbacks"], iterate that and call each callback. If you want to "hide" these functions for encapsulation purposes, use the registry. 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 "callbacks" to this table as you please.
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/comment/139919096
type: Comment
score: 0
comment on: http://stackoverflow.com/a/79344006
type: AnswerComment
has text: This is not quite what I am looking for. Nevermind.

http://stackoverflow.com/q/79318781
tagged with: lua
type: Question
tagged with: coroutine
score: 2
upvote count: 2
accepted answer: http://stackoverflow.com/a/79318877
answer count: 1
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79318877
has body: In Lua, I can define a member function like this: Foo = {} function Foo:bar() ... end I realise this is just syntactic sugar for this: Foo = {} foo.bar = function(self) ... end Is there a way to write an anonymous function with an implicit self parameter or do I always have to spell out the self parameter on anonymous functions? The motivation is to create coroutine member functions in a way most analogous to ordinary functions. I can do this: Foo.bar = coroutine.wrap(function(self) ... end) Or this: function Foo:bar() ... end Foo.bar = coroutine.wrap(Foo.bar) But is there a way to do a one-line declaration with an implicit self parameter?
downvote count: 0
has title: Can Lua define anonymous member functions?

http://stackoverflow.com/comment/139939697
type: QuestionComment
comment on: http://stackoverflow.com/q/79350389
score: 1
type: Comment
has text: 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.

http://stackoverflow.com/q/79398465
answer count: 1
favorite count: 0
downvote count: 0
upvote count: 3
has body: I started learning Lua recently, as far as I can tell, when I don't specify the index, the function table.insert tries to put the value in the first nil in the table. Why then is it that in table t the 10 ends up at index 4, in table y the 10 ends up at index 2, and in table x it ends up at index 5? local t = {1, nil, 2} table.insert(t,10) for i = 1, 6 do print(string.format("t[%d] = %s", i, t[i])) end print() local y = {1, nil, 2} y[5]= 3 table.insert(y, 10) for i = 1, 6 do print(string.format("y[%d] = %s", i, y[i])) end print() local x = {1, nil, 2} table.insert(x,2,20) x[6]= 3 table.insert(x,10) for i = 1, 6 do print(string.format("x[%d] = %s", i, x[i])) end Terminal result: t[1] = 1 t[2] = nil t[3] = 2 t[4] = 10 t[5] = nil t[6] = nil y[1] = 1 y[2] = 10 y[3] = 2 y[4] = nil y[5] = 3 y[6] = nil x[1] = 1 x[2] = 20 x[3] = nil x[4] = 2 x[5] = 10 x[6] = 3
type: Question
tagged with: lua
tagged with: lua-table
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/79398500
has title: table.insert not replacing the first nil position in the table
score: 3

http://stackoverflow.com/q/79320906
has body: I am trying to use luv 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. As a minimal reproducible example, use the following lua script: local uv = require("luv") local stdin = uv.new_poll(1) stdin:start("r", function() print("uv callback") end) uv.run("once") When I press enter manually, everything works as expected: % lua-5.1 min.lua uv callback % However, passing in a blank line from another program via a pipe does not appear to work: % echo | lua-5.1 min.lua -- nothing happens, and lua-5.1 does not exit I believe from additional testing that this is not a buffering issue: writing a program that manually flushes to put in place of echo and adding io.stdin:setvbuf("no") 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!) Why doesn't my script see the piped-in data, and how can I change it so that it does?
upvote count: 1
answer count: 1
score: 1
favorite count: 0
has title: how to use luv with pipes?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79320920
accepted answer: http://stackoverflow.com/a/79320920
type: Question
downvote count: 0
tagged with: lua
tagged with: libuv

windows-subsystem-for-linux
tag name: windows-subsystem-for-linux
tags question: http://stackoverflow.com/q/79268224
type: Tag

http://stackoverflow.com/q/79316557
tagged with: lua
has body: 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. Here's the code for the timer script. It is in a local script. local minutes = 0 local seconds = 15 local player = game.Players.LocalPlayer local leaderstats = player:FindFirstChild("leaderstats") local money = leaderstats:FindFirstChild("Effect Coins") while true do for i = 1, 15 do wait(1) if seconds == 0 then minutes = minutes - 1 secconds = 59 else seconds = seconds - 1 end if seconds < 10 then script.Parent.Text = tostring(minutes)..":0"..tostring(seconds) else script.Parent.Text = tostring(minutes)..":"..tostring(seconds) end end money += 1 minutes = 0 seconds = 15 end I tried changing the value of the time lengths, but it doesn't seem to work.
has comment: http://stackoverflow.com/comment/139866898
answer count: 1
tagged with: game-development
score: 0
type: AnsweredQuestion
tagged with: luau
has answer: http://stackoverflow.com/a/79316568
type: Question
tagged with: roblox
has title: Roblox: Function not looping or adding to the "money" value
accepted answer: http://stackoverflow.com/a/79316568

http://stackoverflow.com/comment/139741463
score: 0
type: QuestionComment
has text: The documentation mentions `FullscreenType` and specific behavior. Did you check this? Which version of love2d are you using?
comment on: http://stackoverflow.com/q/79246572
type: Comment

http://stackoverflow.com/a/79370491
upvote count: 1
has body: Oh, I just knew the problem. In Lua, we can not create keys from this source. A_PRIVATE_KEY="w2UwuwmF9h5p02fnr3MkxtKoDTl8aTtJXqLbsPwbqPg=" B_PRIVATE_KEY="ZyoPMal0TZzNwDyUUE30iThXCKgPOthPaIN2qnOhkNs=" So, these syntaxes are wrong. local a_key = openssl_pkey.new({ type = "EC", params = { private = a_bn, group = "prime256v1" } }) local b_key = openssl_pkey.new({ type = "EC", params = { private = b_bn, group = "prime256v1" } }) These AI-suggested syntaxes are also wrong. local a_key = openssl_pkey.new({ type = "X25519", curve = "prime256v1", private_key = a_decoded_key, }) We need to convert the source to the PEM keys first. So, the correct source would be like this. A_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_CONTENT_HERE\n-----END PRIVATE KEY-----" B_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYOUR_CONTENT_HERE\n-----END PRIVATE KEY-----" Then, the correct Lua syntax would be like this. local a_key = openssl_pkey.new(a_private_key) local b_key = openssl_pkey.new(b_private_key)
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79360326
answers question: http://stackoverflow.com/q/79360326
score: 1

http://stackoverflow.com/comment/139922265
type: AnswerComment
comment on: http://stackoverflow.com/a/79345720
score: 0
type: Comment
has text: 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.

http://stackoverflow.com/a/79307172
score: 1
has body: 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: -- 0.3r + 0.59g = luminance -- r = (luminance - 0.59g) / 0.3 local red_min = (luminance - 255 * 0.59) / 0.3 local red_max = luminance / 0.3 if red_min &lt; 0 then red_min = 0 end if luminance &lt;= 76 then red = math.random(red_min, luminance/0.3) elseif luminance &gt;= 179 then red = math.random(math.max(red_min, (luminanceStart-179)/0.3), red_max) else red = math.random(red_min, red_max) end
downvote count: 0
answers question: http://stackoverflow.com/q/79307097
type: Answer
upvote count: 1

http://stackoverflow.com/comment/139811275
type: Comment
has text: "`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?
score: 0
comment on: http://stackoverflow.com/q/79284034
type: QuestionComment

http://stackoverflow.com/q/79358099
type: Question
tagged with: lua
tagged with: istio-sidecar
tagged with: istio-prometheus
tagged with: envoyproxy
has title: Istio EnvoyFilter Lua HTTP Filter - Is it possible publish a prometheus metic from the filter?
type: UnansweredQuestion
has body: I'm using the envoyfilter to read requests and make some decisions. I'm interested to log how long the script took to run. I 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?
answer count: 0
tagged with: istio
score: 0

http://stackoverflow.com/comment/140017449
comment on: http://stackoverflow.com/a/79393988
type: Comment
has text: Its still not working only upper part of the script works the lower doesn't work.
type: AnswerComment
score: 0

http://stackoverflow.com/q/79289693
favorite count: 0
type: AnsweredQuestion
has body: 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? I want to add a clamp function to numbers. If this is not possible, please let me know.
has answer: http://stackoverflow.com/a/79289781
has title: How to Extend Existing Types with Methods in Lua, Similar to Swift Extensions or JavaScript Prototypes?
score: 3
accepted answer: http://stackoverflow.com/a/79289781
upvote count: 3
type: Question
downvote count: 0
tagged with: lua
answer count: 1

http://stackoverflow.com/q/79291948
score: 0
type: Question
has body: Client-side RegisterNetEvent('ch_nui:bob') AddEventHandler('ch_nui:bob',function (identifier) print('1' ) CreateThread(function () print('1' ) while true do Wait(50) local playerId = PlayerPedId() local playerCoords = GetEntityCoords(playerId) local playerHeading = GetEntityHeading(playerId) SendNUIMessage({ type = 'position', x = playerCoords.x, y = playerCoords.y, z = playerCoords.z, heading = playerHeading, }) SendNUIMessage({ type='identifierr', identifierr = identifier }) end end) end) TriggerServerEvent('ch_nui:kok') Server-side RegisterNetEvent('ch_nui:kok') AddEventHandler('ch_nui:kok',function () print('2') local identifier = GetPlayerIdentifierByType(source,'license') TriggerClientEvent('ch_nui:bob',identifier) end) 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? My js file is this if(data.type === 'identifier'){ const identifier = data.identifierr } const money = MySQL.scalar('SELECT `money` FROM `money` WHERE `identifier` = ? LIMIT 1', [ identifier ]) console.log(money) Although it doesn't matter because the problem is that the client event doesn't get triggered. I tried the code, played around with events stuff and nothing worked.
has title: How to send data from a fivem FXServer server script to JavaScript
answer count: 1
type: UnansweredQuestion
tagged with: lua
tagged with: javascript
has answer: http://stackoverflow.com/a/79445755
tagged with: fivem

http://stackoverflow.com/q/79303030
has answer: http://stackoverflow.com/a/79303247
type: Question
has comment: http://stackoverflow.com/comment/139843410
tagged with: vim
downvote count: 0
tagged with: lua
answer count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
has body: 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. As an example, in Netrw it would look like: local path = netrw_call('NetrwFile', vim.fn['netrw#Call']('NetrwGetWord')) And in Oil.nvim, it would look like: local oil = require('oil') local path = oil.get_current_dir() .. oil.get_cursor_entry().name 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. So 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. After much research, I found the command vim.fn.expand("%:p:h"), but this did not work. As a test, I used Oil.nvim to open a specific directory on Windows (say C:\Windows) and ran this command and got the following result: oil:///C/Windows This differs from the result of executing a similar command on a regular buffer: C:\Windows I think I can implement it by handling exceptions, but I'm wondering if there might be a more efficient method. If anyone knows of a better method, I would be very grateful to hear it.
has title: I would like to know how the gx command gets the file path on the file manager
tagged with: neovim
upvote count: 1

http://stackoverflow.com/q/79326633
has answer: http://stackoverflow.com/a/79326731
type: Question
tagged with: lua
has comment: http://stackoverflow.com/comment/139886929
has comment: http://stackoverflow.com/comment/139885617
has title: Can a Redis key expire between two commands inside a Lua script?
has body: 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: local v0 = redis.call('exists', KEY); local v1 = redis.call('exists', KEY); I appreciate your help.
tagged with: redis
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/78446476
answer count: 1
score: 0

http://stackoverflow.com/a/79358892
has comment: http://stackoverflow.com/comment/139947288
upvote count: 1
accepted answer of: http://stackoverflow.com/q/79358608
answers question: http://stackoverflow.com/q/79358608
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: In terms of classical OOP, with timer = Timer() timer is considered a new instance of the Timer class1. When calling methods, the colon syntax should be used (in love.load) timer:after(4, function() Game_object.dead = true end) and (in love.update) timer:update(dt) so that the implicit self inside the method references the calling instance. More completely, when a function is defined with the colon syntax function foo:bar(arg) print(self, arg) end it is syntactic sugar for the following assignment, where the function has an explicit first argument named self: foo.bar = function (self, arg) print(self, arg) end Likewise, the syntax of calling a function as foo:bar(42) is syntactic sugar for foo.bar(foo, 42), inserting that implicit first self argument. This is why timer.after(4, function () ... end) is assigning 4 to the implicit local self inside the method. The after method is defined1 as function Timer:after(delay, func) return self:during(delay, _nothing_, func) end which in your case leads to (4):during(delay, _nothing_, func), hence the error. 1. Source code from hump/timer * Lua 5.1: 2.5.8 – Function Calls | 2.5.9 – Function Definitions
score: 1

http://stackoverflow.com/q/79285284
score: -1
type: Question
tagged with: mysql
has comment: http://stackoverflow.com/comment/139811908
has title: Gmod lua mysql attempt to index global "" (a nil value) (DarkRP)
downvote count: 2
has body: 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. Thank you! In short: https://pastebin.com/QxHwz7Cj One of the lua : &lt;https://pastebin.com/9GzVKPeH&gt; (sorry about pastebin i don't know how to paste here)
upvote count: 1
tagged with: garrys-mod
tagged with: lua
has answer: http://stackoverflow.com/a/79330294
type: UnansweredQuestion
tagged with: indexing
answer count: 1
favorite count: 0

http://stackoverflow.com/a/79263888
accepted answer of: http://stackoverflow.com/q/79261190
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: If you simplify your process, it would be: lua_getglobal(L, func_name.c_str()); // push WaterBall if (lua_isfunction(L, -1)) SkillMap[id] = ...blabla lua_pop(L, 1); // pop WaterBall auto _func1 = SkillMap.find(id)-&gt;second; double damage1 = _func1(&amp;data); // call WaterBall See? You want to call WaterBall, but WaterBall is popped before that, so a nil gets called. I see that your lambda function captured the variable func_name, do you want to get the function first? SkillMap[id] = [L, func_name](ComplexData* info) -&gt; double { lua_getglobal(L, func_name.c_str()); stack_struct(L, *info); ... Or do you want to cache the function? if (lua_isfunction(L, -1)) { int func = luaL_ref(L, LUA_REGISTRYINDEX); // cache function SkillMap[id] = [L, func](ComplexData* info) -&gt; double { lua_rawgeti(L, LUA_REGISTRYINDEX, func); // get function stack_struct(L, *info); .... } //lua_pop(L, 1); luaL_ref can save the object to the registry and pop the object from the stack, so the call to lua_pop after the if block should be removed.
upvote count: 1
answers question: http://stackoverflow.com/q/79261190

http://stackoverflow.com/q/79360326
tagged with: lua
has body: Go and NodeJS produced the same result, but not Lua. I want Lua to produce the same one. package main import ( "crypto/ecdh" "encoding/base64" "log" "os" "github.com/joho/godotenv" ) func main() { _ = godotenv.Load() aDecodedPrivateKey, _ := base64.StdEncoding.DecodeString(os.Getenv("A_PRIVATE_KEY")) bDecodedPrivateKey, _ := base64.StdEncoding.DecodeString(os.Getenv("B_PRIVATE_KEY")) aPrivateKey, _ := ecdh.P256().NewPrivateKey(aDecodedPrivateKey) bPrivateKey, _ := ecdh.P256().NewPrivateKey(bDecodedPrivateKey) sharedSecret, _ := aPrivateKey.ECDH(bPrivateKey.PublicKey()) log.Println(base64.StdEncoding.EncodeToString(sharedSecret)) } require('dotenv').config() import { createECDH } from 'crypto' const aKey = createECDH('prime256v1') const bKey = createECDH('prime256v1') aKey.setPrivateKey(Buffer.from(String(process.env.A_PRIVATE_KEY), 'base64')) bKey.setPrivateKey(Buffer.from(String(process.env.B_PRIVATE_KEY), 'base64')) console.log(aKey.computeSecret(bKey.getPublicKey()).toString('base64')) local openssl_pkey = require "resty.openssl.pkey" local openssl_bn = require "resty.openssl.bn" local ngx = require "ngx" local function ecdh() local a_decoded_key = ngx.decode_base64(a_private_key) local b_decoded_key = ngx.decode_base64(b_private_key) local a_bn = openssl_bn.new(a_decoded_key, 2) local b_bn = openssl_bn.new(b_decoded_key, 2) local a_key = openssl_pkey.new({ type = "EC", params = { private = a_bn, group = "prime256v1" } }) local b_key = openssl_pkey.new({ type = "EC", params = { private = b_bn, group = "prime256v1" } }) local b_public_key = openssl_pkey.new(b_key:to_PEM('public')) return ngx.encode_base64(a_key:derive(b_public_key)) end Please help me create the Lua version that produces the same result as Go and NodeJS. In case you need environment variables, take this .env. A_PRIVATE_KEY="w2UwuwmF9h5p02fnr3MkxtKoDTl8aTtJXqLbsPwbqPg=" B_PRIVATE_KEY="ZyoPMal0TZzNwDyUUE30iThXCKgPOthPaIN2qnOhkNs=" Here is my testing environment. Go 1.23.4 NodeJS v22.12.0 Lua 5.1 Ref…
score: 1
tagged with: node.js
has title: ECDH Exchange in Go, NodeJS, and Lua
type: AnsweredQuestion
answer count: 2
possible better answer: http://stackoverflow.com/a/79360347
accepted answer: http://stackoverflow.com/a/79370491
tagged with: typescript
downvote count: 2
tagged with: ecdh
favorite count: 0
type: Question
linked to: http://stackoverflow.com/q/12480776
upvote count: 3
tagged with: go
has answer: http://stackoverflow.com/a/79370491
has answer: http://stackoverflow.com/a/79360347

http://stackoverflow.com/comment/139958906
type: AnswerComment
score: 1
type: Comment
has text: @user29212913 It looks like you took care of my first two points but completely ignored my third point.
comment on: http://stackoverflow.com/a/79360347

http://stackoverflow.com/q/79283384
type: Question
has title: How to call lua functions from another language
tagged with: lua
tagged with: lua-c++-connection
downvote count: 1
upvote count: 1
answer count: 1
favorite count: 0
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79313082
tagged with: luac
has body: Trying to make an engine that calls other language from lua code. And the problem that I stuck into is callbacks. Converting strings, ints and so on is easy, but what to do with functions? Lua 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.
accepted answer: http://stackoverflow.com/a/79313082

http://stackoverflow.com/comment/139857905
type: AnswerComment
has text: Yes, that's right. It needs the IUP-IM binding. You you are dynamically loading with require it does not need any additional link. And iupimlua_open will automatically be called by require("iupluaim")
type: Comment
comment on: http://stackoverflow.com/a/79311441
score: 1

http://stackoverflow.com/q/79261190
tagged with: c++
type: Question
accepted answer: http://stackoverflow.com/a/79263888
has comment: http://stackoverflow.com/comment/139767618
linked to: http://stackoverflow.com/q/3771784
has body: 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? #include <sol/sol.hpp> #include <iostream> #include <string> #include <unordered_map> struct NestedData { int a; float b; }; struct ComplexData { int id; std::string name; NestedData nested; }; void stack_struct(lua_State* L, const ComplexData& data) { lua_newtable(L); lua_pushstring(L, "id"); lua_pushinteger(L, data.id); lua_settable(L, -3); lua_pushstring(L, "name"); lua_pushstring(L, data.name.c_str()); lua_settable(L, -3); lua_pushstring(L, "nested"); { lua_newtable(L); lua_pushstring(L, "a"); lua_pushinteger(L, data.nested.a); lua_settable(L, -3); lua_pushstring(L, "b"); lua_pushnumber(L, data.nested.b); lua_settable(L, -3); lua_settable(L, -3); } } int main() { lua_State* L = luaL_newstate(); luaL_openlibs(L); std::unordered_map<int64_t, std::function<double(ComplexData*)>> SkillMap; std::string script_name = "register.lua"; std::string func_name = "WaterBall"; int64_t id = 100; if (!L) { std::cerr << "Lua interpreter is not initialized!" << std::endl; return 0; } if (luaL_dofile(L, script_name.c_str()) != LUA_OK) { std::cerr << "Error loading Lua script: " << lua_tostring(L, -1) << std::endl; lua_pop(L, 1); return 0; } lua_getglobal(L, func_name.c_str()); // anonymity function at the top of the stack if (lua_isfunction(L, -1)) { SkillMap[id] = [L, func_name](ComplexData* info) -> double { stack_struct(L, *info); // print table here, values are correct if (lua_pcall(L, 1, 1, 0) != LUA_OK) { std::cerr << "Error calling Lua function: " << lua_tostring(L, -1) << std::endl; lua_pop(L, 1); return 0.0; } double result = 0.0; if (lua_isnumber(L, -1)) { result = lua_tonumber(L, -1); } else { std::cerr << "Lua function did not return a number!" << std::endl; } lua_pop(L, 1); return result; }; std::cout << "Lua function …
has title: Pass NestedStruct from c++ to lua
has answer: http://stackoverflow.com/a/79263888
upvote count: 1
favorite count: 0
downvote count: 0
score: 1
tagged with: lua
type: AnsweredQuestion
answer count: 1

http://stackoverflow.com/comment/140050837
comment on: http://stackoverflow.com/a/79408069
score: 0
type: AnswerComment
has text: 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, you 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.
type: Comment

http://stackoverflow.com/q/79413710
favorite count: 0
type: Question
downvote count: 0
tagged with: nlua
answer count: 0
tagged with: lua
tagged with: monogame
has title: Error calling a C# generic method from Lua script with NLua
tagged with: c#
upvote count: 1
has body: I am making a game with Monogame and NLua, but running into an error. This is the Lua script, where the issue occurs on the third line, and stops before moving into the C# method: function instant_growth.activate() local farmList = Environment:GetMapFeatures("farm") local farmTable = LsLua.ConvertToLuaTable(farmList) -- error here for i, farmObj in ipairs(farmTable) do farmObj.LuaData.growProgress = farm.growTime end return nil end This is the generic C# method (inside of the static LsLua class): public static LuaTable ConvertToLuaTable<T>(List<T> list) { LuaTable table = CreateEmptyTable(); foreach (var item in list) { _addToTable.Call(table, null, item); } return table; } And this is the error: InvalidOperationException: Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true. 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. So even doing this breaks: local farmList = Environment:GetMapFeatures("farm") local farmTable = LsLua.ConvertToLuaTable(farmList) farmTable = LsLua.ConvertToLuaTable(farmList) 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.
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/79398648
type: Question
favorite count: 0
upvote count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/79399780
accepted answer: http://stackoverflow.com/a/79399780
tagged with: lua
score: 3
answer count: 1
tagged with: luajit
has title: 'isPacked' is not a member of 'Lua::jitComposer"
type: AnsweredQuestion
tagged with: c++
tagged with: qt-creator
has body: I am trying to build Simula67 parser, in QT 5.14.2 in the Qt Creator. It depends on LjTools, and luajit, 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. My 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. GuiTools LjTools Simula I commented out the include( ../LuaJIT/src/LuaJit.pri ){ Libs += -ldl } else { LIBS += -lluajit } and used the built in Qt library importer to import the external library libluajit.so win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../LuaJIT-2.0/src/release/ -lluajit else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../LuaJIT-2.0/src/debug/ -lluajit else:unix: LIBS += -L$$PWD/../../LuaJIT-2.0/src/ -lluajit INCLUDEPATH += $$PWD/../../LuaJIT-2.0/src DEPENDPATH += $$PWD/../../LuaJIT-2.0/src In SimLjEditor.pro (from Simula) as well as the LjAsmEditor.pro and LjBcViewer.pro (from LjTools) Here is my error message: /home/alex/Simula67/Simula/SimLjEditor.cpp:362: error: ‘isPacked’ is not a member of ‘Lua::JitComposer’ 362 | if( Lua::JitComposer::isPacked(lnr) ) | ^~~~~~~~ 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.

http://stackoverflow.com/q/79303141
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/139843943
has answer: http://stackoverflow.com/a/79304674
has body: Use lib classic. I have next code: Combination = Object:extend() function Combination:new(level, score) self.curentCombinationValues = 0 self.curentCombination = {} self.level = level self.score = score end NonPair = Combination:extend() function NonPair:new() NonPair.super:new(1, 2) end OnePair = Combination:extend() function OnePair:new() OnePair.super:new(1, 3) end When I create two objects, the second one replaces the variables of the inherited object, which means the first one also changes. local one = NonPair() local second = OnePair() one.level = second.level . Why?
has comment: http://stackoverflow.com/comment/139843875
upvote count: 2
type: Question
downvote count: 0
has title: How to extend classes in Lua
tagged with: lua
accepted answer: http://stackoverflow.com/a/79304674
score: 2
answer count: 1

http://stackoverflow.com/a/79408069
answers question: http://stackoverflow.com/q/79407984
upvote count: 1
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/140050837
has body: I think they are not applying because of the default behavior in some Neovim configurations. -- first unset it, vim.keymap.del('i', '&lt;C-h&gt;', '&lt;Left&gt;') ... -- and then set it vim.keymap.set('i', '&lt;C-h&gt;', '&lt;Left&gt;') ... So, the use of vim.keymap.set is preferable for your configuration. If, the issue resides, let me know.
has comment: http://stackoverflow.com/comment/140042238

http://stackoverflow.com/a/79398500
has body: From table.insert, we can see that table.insert(t, 42) behaves as t[#t + 1] = 42 From 3.4.7 – The Length Operator: 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: (border == 0 or t[border] ~= nil) and (t[border + 1] == nil or border == math.maxinteger) [ ... ] A table with exactly one border is called a sequence. [ ... ] When t is a sequence, #t returns its only border, which corresponds to the intuitive notion of the length of the sequence. When t is not a sequence, #t can return any of its borders. (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.) In other words, calling table.insert on tables with multiple borders, without specifying a position, will insert the value at an index determined by the internal representation of the table. Avoid this if portability is a concern. For example, on my system, the results of your program differ between the reference implementation of Lua and LuaJIT. $ lua -v Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio $ luajit -v LuaJIT 2.1.1734355927 -- Copyright (C) 2005-2023 Mike Pall. https://luajit.org/ $ diff &lt;(lua example.lua) &lt;(luajit example.lua) 2c2 &lt; t[2] = nil --- &gt; t[2] = 10 4c4 &lt; t[4] = 10 --- &gt; t[4] = nil 17,19c17,19 &lt; x[3] = nil &lt; x[4] = 2 &lt; x[5] = 10 --- &gt; x[3] = 2 &gt; x[4] = 10 &gt; x[5] = nil
has comment: http://stackoverflow.com/comment/140055820
has comment: http://stackoverflow.com/comment/140043859
answers question: http://stackoverflow.com/q/79398465
downvote count: 0
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/140055802
type: Answer

http://stackoverflow.com/comment/139866898
comment on: http://stackoverflow.com/q/79316557
type: QuestionComment
has text: Is money value text label or some other object in game?
type: Comment
score: 0

http://stackoverflow.com/q/79409178
has title: Why is this Lua code sending increasingly more messages per execution of the code?
upvote count: 2
type: Question
answer count: 0
has body: 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: _G.petTarget = "their target" -- Default value for pet's target -- Create a frame to listen for combat log events local frame = CreateFrame("Frame") frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") frame:SetScript("OnEvent", function() local _, subEvent, _, sourceGUID, _, _, _, _, destName = CombatLogGetCurrentEventInfo() -- If the event is a successful spell cast by your pet, store the target's name if subEvent == "SPELL_CAST_SUCCESS" and sourceGUID == UnitGUID("pet") then if destName then -- Prevent overwriting with nil _G.petTarget = destName end -- Delay calling the emote slightly to ensure the pet’s target updates in-game C_Timer.After(0.1, PetCommandEmote) end end) function PetCommandEmote() local petName = UnitName("pet") or "my pet" -- Get pet's name local petTarget = _G.petTarget -- Fetch the most recent target local phrases = { "commands " .. petName .. " to devour magic from " .. petTarget .. ". Good puppy!", "orders " .. petName .. " to feast on the magic of " .. petTarget .. ". Well done!", "directs " .. petName .. " to absorb magical energy from " .. petTarget .. ". Good job!", "commands " .. petName .. " to siphon power from " .. petTarget .. ". Atta boy!" } SendChatMessage(phrases[math.random(#phrases)], "EMOTE") -- Sends the emote to chat end 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.
tagged with: lua
type: UnansweredQuestion
score: 2
downvote count: 0
favorite count: 0
tagged with: world-of-warcraft
has comment: http://stackoverflow.com/comment/140043388

http://stackoverflow.com/q/79320852
has title: Passing a Model through a Remote Function
tagged with: roblox
tagged with: lua
has comment: http://stackoverflow.com/comment/139877395
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/79324699
upvote count: 1
favorite count: 0
score: 0
type: Question
downvote count: 1
has answer: http://stackoverflow.com/a/79324699
has body: I am having trouble passing a model through a remote event the model (tower) is stored originally in replicated storage before being cloned and moved a folder in the workspace (local script) tower = game.ReplicatedStorage.Towers.Boxer:Clone() tower.Parent = workspace.Map.TowersToPlace Then I pass it through the remote event. print(tower) replicatedStorage.SpawnTowerEvent:FireServer(tower, mouse.Hit.Position) end) The print line is printing the tower correctly but the server script is erroring saying the tower variable is nil (server script) game.ReplicatedStorage.SpawnTowerEvent.OnServerEvent:Connect(function(plr, towerToPlace, pos) print(towerToPlace) end) -- returns nil Anyone know why the variable is not being passed despite being defined correctly in the local script.
answer count: 1
has comment: http://stackoverflow.com/comment/139875113

http://stackoverflow.com/a/79324906
answers question: http://stackoverflow.com/q/79324878
upvote count: 5
type: Answer
has body: From the Lua documentation on multiple results: 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. We get all results only when the call is the last (or the only) expression in a list of expressions. So table.unpack(a), table.unpack(b) doesn't concatenate all return values from both calls. You get the first return value of table.unpack(a), followed by all return values of table.unpack(b).
score: 5
downvote count: 0

http://stackoverflow.com/comment/139745832
type: Comment
score: 0
has text: I thought I'd included this in my previous reply, but I'm using Love 11.5.0.
type: QuestionComment
comment on: http://stackoverflow.com/q/79246572

http://stackoverflow.com/q/79386149
tagged with: lua
accepted answer: http://stackoverflow.com/a/79386188
has answer: http://stackoverflow.com/a/79386188
has title: Generate PDF with LUA
answer count: 1
tagged with: generate
tagged with: http://stackoverflow.com/tag/pdf
favorite count: 0
type: AnsweredQuestion
upvote count: 4
score: 4
has body: I wrote this piece of code to generate a pdf without external modules like (LUApdf). 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. If you have a solution or an idea, Thanks local patch = { {FID = 17, IDType = "nothing", CID = "nothing", Name = "Mac Aura PXL 1", Mode = "Standard", Uaddrs = 1.301}, {FID = 18, IDType = "something", CID = "controller", Name = "Spot Moving Head", Mode = "Advanced", Uaddrs = 2.101}, {FID = 19, IDType = "example", CID = "another", Name = "Wash Light", Mode = "Standard", Uaddrs = 3.401} } local function escape_pdf_string(str) return str:gsub("\\", "\\\\"):gsub("%(", "\\("):gsub("%)", "\\)") end local file = io.open("patch_corrected.pdf", "wb") file:write("%PDF-1.4\n") file:write("1 0 obj\n<< /Type /Catalog /Pages 2 0 R >>\nendobj\n") file:write("2 0 obj\n<< /Type /Pages /Count 1 /Kids [3 0 R] >>\nendobj\n") file:write("3 0 obj\n<< /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>\nendobj\n") local content_stream = "BT\n/F1 12 Tf\n" local y_position = 800 for index, element in ipairs(patch) do local line = string.format("FID: %d, IDType: %s, CID: %s, Name: %s, Mode: %s, Uaddrs: %.3f", element.FID, element.IDType, element.CID, element.Name, element.Mode, element.Uaddrs) line = escape_pdf_string(line) content_stream = content_stream .. string.format("50 %d Td\n(%s) Tj\n", y_position, line) y_position = y_position - 40 content_stream = content_stream .. "ET\n" print("Contenu complet de content_stream :\n" .. content_stream) file:write(string.format("4 0 obj\n<< /Length %d >>\nstream\n%s\nendstream\nendobj\n", #content_stream, content_stream)) file:write("5 0 obj\n<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>\nendobj\n") file:write("xref\n") file:write("0 6\n") file:write("0000000000 65535 f \n") file:write("0000000009 00000 n \n") file:write("00000…
type: Question
downvote count: 0

http://stackoverflow.com/comment/139780064
score: 0
type: QuestionComment
has text: @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.
comment on: http://stackoverflow.com/q/79267713
type: Comment

http://stackoverflow.com/q/79356193
upvote count: 2
type: AnsweredQuestion
answer count: 1
type: Question
downvote count: 0
has body: I'd like to capture all occurrences of a pattern between 2 strings using Lua. This is the current pattern I built: do%(%).-(mul%(%d+%,%d+%))[don't%(%)]? This does what I want except that it only captures a single occurrence between "do()" and "don't()" example: do()mul(41,51)mul(1,1)don't() only mul(41,51) is captured Is it possible to achieve what I want in Lua?
has title: Capture pattern multiple times between 2 strings in Lua
tagged with: lua
has comment: http://stackoverflow.com/comment/139942541
has answer: http://stackoverflow.com/a/79356474
score: 2
tagged with: lua-patterns
accepted answer: http://stackoverflow.com/a/79356474
favorite count: 0

http://stackoverflow.com/comment/139947288
type: Comment
score: 0
type: AnswerComment
has text: Thanks soooo much! my project is running properly now!
comment on: http://stackoverflow.com/a/79358892

http://stackoverflow.com/comment/139875113
comment on: http://stackoverflow.com/q/79320852
score: 0
has text: 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
type: QuestionComment
type: Comment

http://stackoverflow.com/q/79261586
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/139818813
has body: I want to practice Lua writing EdgeTX scripts for FPV drone telemetry. I have found a pretty decent documentation for edge tx 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 (see MSP communication). There is a nice lua script for communication with betaflight (see here) 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 So far, I have found that crossfireTelemetryPush function sends a request via telemetry to receiver. This is the starting point. An example of using this function you can see here: local function crsfDisplayPortCmd(cmd, data) local payloadOut = { CONST.address.betaflight, CONST.address.transmitter, cmd } if data ~= nil then for i = 1, #(data) do payloadOut[3 + i] = data[i] end end return crossfireTelemetryPush(CONST.frameType.displayPort, payloadOut) end Another one example might be found in ELRS lua script: crossfireTelemetryPush(0x2D, { deviceId, handsetId, fieldPopup.id, 5 }) Here you can find a documentation to this function but as you might have noticed it is poorly explained what is going on there. To summarize I'd like to understand more hot to make a payload and send it from radio with help of Lua script to flight controller.
tagged with: lua
type: UnansweredQuestion
tagged with: protocols
score: 0
has title: How to make a payload in Edge TX and send it with ELRS telemetry package to flight controller (Betaflight, MSP)?

http://stackoverflow.com/q/79289046
tagged with: lua
tagged with: keyboard-events
type: UnansweredQuestion
tagged with: neovim
has body: I have the following script, which checks the current keyboard layout (Ubuntu 22.04) and changes the color. local function set_cursor_color() -- Get the current keyboard layout local layout = vim.system({"xkblayout-state", "print", "%n"}, { text = true }):wait() -- vim.notify("layout = " .. layout.stdout, "info", { title = "Layout" }) if layout.stdout == "English" then -- Change cursor color for English layout vim.cmd(highlight CursorLine cterm=NONE ctermbg=DarkGray guibg=#373944) else -- Change cursor color for other layouts vim.cmd(highlight CursorLine cterm=NONE ctermbg=DarkGray guibg=#44373f) end end -- Call set_cursor_color when cursor moved. vim.api.nvim_create_autocmd({"CursorMoved", }, { callback = set_cursor_color, }) However, I'm frustrated by the fact that it executes every time I move the cursor, even though there's no need for it. Is it possible to hook it to a more appropriate event in the autocommand, like a non-interceptive CapsLock key press (which I use for switching), a change in an environment variable, or some temporary file (this I can set up)? And is there a way to notify all running nvim processes about the change?
has title: Changing the appearance depending on the keyboard layout
score: 1
upvote count: 1
tagged with: keyboard-layout
favorite count: 0
type: Question
downvote count: 0
answer count: 0

http://stackoverflow.com/comment/140063978
comment on: http://stackoverflow.com/q/79420032
score: 1
type: Comment
has text: 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.
type: QuestionComment

http://stackoverflow.com/a/79246061
score: 1
upvote count: 1
has body: Ok so I found out a method that fixed my load times. I had my data script create a BoolValue and parent it to each player when they join called hasLoaded. I set it to true after the profile loaded and stopped my other scripts from doing anything until hasLoaded == true. local function PlayerAdded(player: Player) local hasLoaded = Instance.new("BoolValue") hasLoaded.Name = "hasLoaded" hasLoaded.Value = false hasLoaded.Parent = player local profile = ProfileStore:LoadProfileAsync("Player_"..player.UserId.."_Save5") hasLoaded.Value = true -- Unrelated code end And here's the script where I manage all of my client scripts: local player = game.Players.LocalPlayer local hasLoaded = player:WaitForChild("hasLoaded") while hasLoaded.Value == false do task.wait(1) end -- Variables for my scripts and calls to their start functions 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!
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79245681
answers question: http://stackoverflow.com/q/79245681

http://stackoverflow.com/q/79378695
has answer: http://stackoverflow.com/a/79380536
favorite count: 0
has title: How to Externalize Lua Code in APISIX serverless-pre-function Plugin?
type: AnsweredQuestion
has body: 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. Here’s my current setup: JSON Configuration { "plugins": { "serverless-pre-function": { "phase": "access", "functions": [ "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" ] } } } Goal I 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. Attempted Solution I tried referencing the file like this: { "plugins": { "serverless-pre-function": { "phase": "access", "functions": [ { "file": "/usr/local/apisix/lua_scripts/extract_userinfo.lua" } ] } } } However, this results in an error: {"error_msg":"failed to check the configuration of plugin serverless-pre-function err: property \"functions\" validation failed: failed to validate item 1: wrong type: expected string, got table"} config.yaml of apisix docker: apisix: node_listen: 9080 enable_admin: true log_level: debug lua_module_cache: true lua_path: "/usr/local/apisix/lua_scripts/?.lua;;" extra_lua_path: /usr/local/apisix/lua_scripts/?.lua proxy: ssl: verify: true trusted_ca_certificates: /usr/local/apisix/keycloak-cert.pem plugins: # plugin list - authz-keycloak - basic-auth - clickhouse-logger - client-c…
downvote count: 0
tagged with: apache-apisix
tagged with: lua
type: Question
accepted answer: http://stackoverflow.com/a/79380639
has answer: http://stackoverflow.com/a/79380639
score: 1
answer count: 2
possible better answer: http://stackoverflow.com/a/79380536
upvote count: 1

http://stackoverflow.com/comment/140012884
has text: 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.
comment on: http://stackoverflow.com/q/79393939
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/79417630
has body: So i get this when i open a .java file when using my nvim setup like here: https://github.com/elmcgill/neovim-config/tree/main &quot; There were issues reported with your which-key mappings. Use :checkhealth which-key to find out more. &quot; &amp; &quot; No LSP client found that supports vscode.java.resolveMainClass &quot;
answer count: 0
score: 0
type: Question
tagged with: lua
tagged with: neovim
has title: Problems with nvim setup for java development: LSP Client not found
type: UnansweredQuestion

http://stackoverflow.com/comment/139779487
type: QuestionComment
score: 0
type: Comment
has text: Is nested tables okay for you? Then you could do `a[1][2] = 6`
comment on: http://stackoverflow.com/q/79267713

http://stackoverflow.com/q/79416299
upvote count: 1
type: Question
has title: Ellipses used when declaring a variable
has answer: http://stackoverflow.com/a/79417279
has body: 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. local _, own_path = ... -- needs at least Lua 5.2 local LIBDIR = own_path:match(&quot;(.*&quot;..package.config:sub(1,1)..&quot;)&quot;) 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.
downvote count: 0
tagged with: lua
type: UnansweredQuestion
score: 1
favorite count: 0
answer count: 1

http://stackoverflow.com/a/79499000
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: there's a number of issue with the code you provided. calling copas.loop(), only makes sense if you first add 'work' to the scheduler (a task, timer, server socket) io.read should not be used. Since it will block the process, without ever yielding to the Copas scheduler. Use system.readansi() instead, and give it copas.pause as the sleep method such that Copas can go of and do other work while this task is waiting. for readansi to work properly, the terminal must be set up properly, make it non-blocking for reading, and disable canonical mode (canonical is "line mode", it reads a line, until a user presses enter) I added comments to your code, and fixed the above items: local sys = require("system") -- local UI = require("ui") local copas = require("copas") -- define the UI library in line here local UI = {} function UI.progressBar(current, total) local widthOfBar = 50 local progress = math.floor((current / total) * widthOfBar) local remaining = widthOfBar - progress local bar = "[" .. string.rep("=", progress) .. string.rep(" ", remaining) .. "]" io.write("\r" .. bar .. math.floor((current / total) * 100) .. "%") -- carriage return for progress bar to stay on the same line io.flush() end function UI.prompt(message) print(message .. " (y/n):") --local response = io.read() -- io.read is blocking, use readansi instead local response = sys.readansi(math.huge, copas.pause) -- use readansi, and pass a NON-blocking sleep function for use with Copas if response == "y" then -- readansi only return 1 character return true elseif response == "n" then -- check for the other result as well return false else -- report an error and retry the prompt print("Invalid input") return UI.prompt(message) end end -- end of UI library definition local function displayMenu() print("=============") print("1. Check Time") print("2. Get Mono Time") print("3. Give Feedback") print("4. Progress Bar Demo") print("6. Exit") print("=============") end local function getTime() local time = math.floo…
score: 1
accepted answer of: http://stackoverflow.com/q/79417967
answers question: http://stackoverflow.com/q/79417967

http://stackoverflow.com/comment/140245500
type: QuestionComment
comment on: http://stackoverflow.com/q/79306019
type: Comment
score: 0
has text: `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. If 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.

http://stackoverflow.com/q/79253802
score: 0
answer count: 0
tagged with: lua
type: Question
has title: How to connect Lua module with Simion workbench program
has body: ​ Hi, 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) I would like to realize some useful Simion functions as separate Lua modules, that will be required from Simion workbench program. Say, I have the following Lua module test.lua test = {} function test.print_ion_number() print("ion number = ", ion_number) end return test And I want to use it in segment.other_actions() function of Simion workbench program as test = require "test" simion.workbench_program() function segment.other_actions() test.print_ion_number() end But what I get is nil, since my function from test module doesn't see Simion ion_number variable. 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? Thank you ​
type: UnansweredQuestion

http://stackoverflow.com/q/79383237
has title: Attempt to call missing method of table
tagged with: roblox
has answer: http://stackoverflow.com/a/79384666
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/79384666
answer count: 1
score: 0
type: Question
tagged with: lua
has body: I'm trying to make my first Roblox studio game and I ran into this problem: attempt to call missing method 'UpdateCharacter' of table attempt to call missing method 'Equip' of table Any function that is called from FistCombat even if it is declared. I attach the 3 scripts that I believe are the problem. local RS = game:GetService("ReplicatedStorage") local UIS = game:GetService("UserInputService") local Player = game:GetService("Players").LocalPlayer local Camera = workspace.CurrentCamera local GUI = Player.PlayerGui:WaitForChild("CombatGui") local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid local Backpack = Player.Backpack local CharacterConnections = { } --ReplicateRemote local ReplicateRemote = RS.Remotes.Replicate --CameraShaker local function ShakeCamera(ShakeCFrame) Camera.CFrame = Camera.CFrame * ShakeCFrame end local CameraShaker = require(RS.Modules.Auxillary.CameraShaker).new(Enum.RenderPriority.Camera.Value, ShakeCamera) CameraShaker:Start() --CooldownManager local CooldownManager = require(RS.Modules.Auxillary.CooldownManager).new(Player, GUI) --Status Manager local StatusManager = Character:WaitForChild("StatusFolder") local StatusManager = require(RS.Modules.Auxillary.StatusManager).new(Player) local AuxObjects = { ["CameraShaker"] = CameraShaker, ["CooldownManager"] = CooldownManager, ["StatusManager"] = StatusManager, } --Default current weapon to fist local BaseCombat = require(RS.Modules.Items.FistCombat).new(Player, AuxObjects) local CurrentItem = BaseCombat CurrentItem:Equip() function HandleInputs(UserInput, GPE) if GPE then return end --Convert UserInput into a String for ease of use local InputName = UserInput.KeyCode.Name if UserInput.UserInputType == Enum.UserInputType.MouseButton1 then InputName = "M1" elseif UserInput.UserInputType == Enum.UserInputType.MouseButton2 then InputName = "M2" end --Input Validation if CurrentItem.Keys[InputName] then if UserInput.UserInputState == Enum.UserInputState.Begin then C…
tagged with: lua-table

visual-studio-debugging
type: Tag
tags question: http://stackoverflow.com/q/79293179
tag name: visual-studio-debugging

http://stackoverflow.com/q/79375093
has body: I am trying to configure Harpoon in Neovim to allow seamless navigation between files using Ctrl-h, Ctrl-j, Ctrl-k, and Ctrl-l keybindings. My goal is to replace the default numeric bindings (<leader>1, <leader>2, etc.) with these keys to switch between the first four files in the Harpoon list. Additionally, I want to bind <leader>a to add files to the Harpoon list and <leader>o to toggle the Harpoon menu. However, after configuring these bindings, they don’t seem to work as expected. What I Tried Installed Harpoon and added it to my lazy.nvim setup. Configured the plugin and added the following keybindings: local harpoon_mark = require("harpoon.mark") local harpoon_ui = require("harpoon.ui") -- Add files to Harpoon vim.keymap.set("n", "<leader>a", harpoon_mark.add_file) -- Toggle Harpoon menu vim.keymap.set("n", "<leader>o", harpoon_ui.toggle_quick_menu) -- Navigate between files with Ctrl-h/j/k/l vim.keymap.set("n", "<C-h>", function() harpoon_ui.nav_file(1) end) vim.keymap.set("n", "<C-j>", function() harpoon_ui.nav_file(2) end) vim.keymap.set("n", "<C-k>", function() harpoon_ui.nav_file(3) end) vim.keymap.set("n", "<C-l>", function() harpoon_ui.nav_file(4) end) Opened two Lua files (foo.lua and init.lua) in Neovim. Pressed <leader>a to add each file to the Harpoon list. Tried navigating between them using Ctrl-h and Ctrl-j. What I Expected So! The files would be added to Harpoon, and I could switch between them with Ctrl-h and Ctrl-j. What Actually Happened The <leader>a keybinding worked, and I could see the files in the Harpoon menu (opened with <leader>o). However, the navigation bindings (Ctrl-h/j/k/l) didn’t work. Instead of switching files, they either did nothing or conflicted with existing Neovim behavior for Ctrl-h and Ctrl-l.
tagged with: neovim
upvote count: 1
has title: How to configure Harpoon in Neovim to navigate between files using Ctrl-hjkl?
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: configuration
tagged with: lua
type: Question
favorite count: 0
answer count: 0

http://stackoverflow.com/comment/139877395
type: Comment
has text: 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.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79320852

http://stackoverflow.com/comment/139886929
score: 0
comment on: http://stackoverflow.com/q/79326633
has text: related: https://stackoverflow.com/questions/78446476/will-key-expire-during-transaction-in-redis
type: Comment
type: QuestionComment

http://stackoverflow.com/q/79318506
tagged with: aerospike-ce
has answer: http://stackoverflow.com/a/79318802
accepted answer: http://stackoverflow.com/a/79318802
tagged with: user-defined-functions
tagged with: aerospike
answer count: 1
has title: UDF Write Generation Check within UDF context
score: 0
type: AnsweredQuestion
tagged with: lua
has body: I Have Use case for Aerospike where I have multiple Records like: +--------+---------+ | PK | signal | +--------+---------+ | 123451 | 1 | | 102221 | 1.0816 | +--------+---------+ I have Service A running on VM fleet of ~1000 Vms, which read this signal value every 3 mins. Now 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. Also all 1000 vms need to see the same updated value of signals at the same time. 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. So to do it in the Service A, I can follow a CAS(Check and Set) pattern, at every VM Where I have a scheduler doing this every 3 mins interval synced to epoch: Read the Signals Compute updated signals Write back new compute Signals 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 Write contention(Key busy) due to 1000 concurrent writes Different signals being written back due to edge cases of different dynamic values of X and Y in different contexts. Thought about using Write policy generation to achieve this where: I read all keys, preserve generation of all keys Compute all new keys. Write all new keys back, with match generation check on write policy Raad back final updated key (Is this needed?) Looks clumsy, so tried an UDF like this: function updateSignal(rec, binName, someParamX, someParamY, hyperParameter, resetFlag) if aerospike:exists(rec) then local currentSignal = rec[binName] local geneneration = record.gen(rec) if (someParamX &gt; someParamY) then local multiplier = someFunction() local updatedSignal = currentSignal * multiplier rec[binName] = updatedSignal else rec[binName] = 1 end aerospike:upda…
type: Question

http://stackoverflow.com/a/79328257
answers question: http://stackoverflow.com/q/79328249
has body: You can use the table interpreter within Lua to interpret your string using load (formerly known as loadstring): local s = [[{a="foo", b="bar", c=12345}]] local t = load("return "..s)() print(t.a) -- foo print(t.b) -- bar print(t.c) -- 12345 This works as long as your table has the same syntax as a valid Lua table.
score: 6
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/139889537
downvote count: 0
upvote count: 6
accepted answer of: http://stackoverflow.com/q/79328249

ecdh
tags question: http://stackoverflow.com/q/79360326
type: Tag
tag name: ecdh

http://stackoverflow.com/q/79299671
tagged with: roblox
has answer: http://stackoverflow.com/a/79300385
tagged with: lua
has title: Parts get deleted when I run and camera is scripted in Roblox Studio
score: 0
type: UnansweredQuestion
tagged with: camera
has body: 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? Edit: Forgot to say, it only happens in client, while in server everything is there.
answer count: 1
type: Question

http://stackoverflow.com/q/79246572
answer count: 1
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/139741466
downvote count: 0
has title: screen resolution always overridden
has comment: http://stackoverflow.com/comment/139741467
upvote count: 2
has comment: http://stackoverflow.com/comment/139741439
tagged with: lua
type: Question
has comment: http://stackoverflow.com/comment/139745832
has comment: http://stackoverflow.com/comment/139741452
has body: 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: t.window.width = 1280 t.window.height = 720 t.window.fullscreen = true 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: local mode_flags = {} mode_flags['fullscreen'] = true love.window.setMode(1280, 720, mode_flags) 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? EDIT: Having found this forum discussion, 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.
score: 2
tagged with: love2d
has answer: http://stackoverflow.com/a/79249530
has comment: http://stackoverflow.com/comment/139741463

http://stackoverflow.com/q/79354895
tagged with: nodemcu
type: Question
tagged with: lua
has body: 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? local turn = function(type, pos, when) print(type, pos, when, sv.value) if type == rotary.TURN then local move = sv.last - pos sv.last = pos sv.x = sv.value + move local tm if tm == nil then tm = tmr.create() tm:register(500, tmr.ALARM_SINGLE, function() setTo(sv) end) end tm:start() end end local setupRotary = function(sv) local ch, a, b, sw = sv.rotary_ch, sv.rotary_a, sv.rotary_b, sv.rotary_sw print(ch, a, b, sw) rot.init(ch, a, b, 1, sw) sv.last = 0 rot.on(ch, rot.TURN, turn) end By the way, "rot" is also a lua module. When I rotate the encoder, I get "attempt to index global 'sv' (a nil value)" at the first line of th "turn" function.
has title: Problem with upvalue in nodemcu on ESP8266
has answer: http://stackoverflow.com/a/79354976
accepted answer: http://stackoverflow.com/a/79354976
answer count: 1
score: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/140033777
comment on: http://stackoverflow.com/a/79403586
type: Comment
has text: 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?
type: AnswerComment
score: 1

http://stackoverflow.com/comment/139819624
type: Comment
comment on: http://stackoverflow.com/a/79289781
score: 1
has text: Yes, exactly. The same logic applies to strings, functions, *light userdata*, booleans, and even *nil*.
type: AnswerComment

http://stackoverflow.com/q/79397267
has answer: http://stackoverflow.com/a/79397540
tagged with: lua
type: Question
upvote count: 1
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/79397540
has body: I'm trying to use Lua to test the Serialization and Deserialization I have message_pb.lua which has below content cat message_pb.lua local pb = require "pb" local message_pb = {} pb.load([[ syntax = "proto3"; message Request { string user_id = 1; int32 action = 2; } ]]) return message_pb -- Return module for require() Executing this command works lua message_pb.lua This is my test.lua file which should load message_pb and do seriazation desriazation test local pb = require("pb") -- Use pb module require("message_pb") -- Load the compiled protobuf schema local request_data = { user_id = "user_123", action = 1 } -- Serialize the request local encoded = pb.encode("Request", request_data) if not encoded then print("Encoding failed!") return end print("Serialized:", encoded) -- Deserialize the request local decoded = pb.decode("Request", encoded) if not decoded then print("Decoding failed!") return end print("Deserialized:") for k, v in pairs(decoded) do print(k, v) end when I ran test.lua it throws error lua test.lua lua: test.lua:7: bad argument #1 to 'encode' (type 'Request' does not exists) stack traceback: [C]: in function 'pb.encode' test.lua:7: in main chunk [C]: in ?
answer count: 1
favorite count: 0
has title: Lua serialize failing
type: AnsweredQuestion
tagged with: protocol-buffers

http://stackoverflow.com/q/79345546
has body: I'm trying to create a hierarchical UI in Lua. The following code is called with local ui = UI:new() and then local w = ui.addWidget(). But the child Widget doesn't inherit the __tostring metamethod of the parent "class" (UI). Printing it outputs the default string ("table 0x..."). What am I doing wrong here? function UI:new() local o = { type = 'UI', x = 0, y = 0, widgets = {} } o.root = o setmetatable(o, self) self.__index = self self.__tostring = function() return 'whatever' end return o end function UI:addWidget(widget) local w = widget or UI.Widget:new() w.root = self.root table.insert(self.widgets, w) return w end UI.Widget = {} setmetatable(UI.Widget, {__index = UI }) function UI.Widget:new() local o = { type = 'UI.Widget', root = self, isEnabled = true, --- more fields... } setmetatable(o, self) self.__index = self return o end ```
upvote count: 1
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/79345720
favorite count: 0
answer count: 1
type: Question
downvote count: 0
tagged with: oop
tagged with: lua
has title: How to inherit both methods and metamethods in Lua

dynamic
tag name: dynamic
tags question: http://stackoverflow.com/q/79370237
type: Tag

http://stackoverflow.com/q/79298598
answer count: 0
tagged with: awesome-wm
type: Question
downvote count: 0
tagged with: lua
has title: children of wibox.layout.ratio.vertical in custom widget are not visible
score: 1
upvote count: 1
type: UnansweredQuestion
favorite count: 0
has body: Edit: GitHub link: https://github.com/Unique-Digital-Resources/my-awesome-wm-config/blob/main/wibar/custom_tasklist.lua I am trying to create a custom widget using containers and layouts, inner_layout has two children, clienticon and textbox under it, however, function create_client_widget and function create_client_widget only displays the background shape only, without the inner_layout. when widget is awful.widget.clienticon(c) in local icon, the icon shows, as expected: local icon = wibox.widget { { { { widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon }, margins = 4, -- Margins around the icon widget = wibox.container.margin, }, shape = gears.shape.circle, -- Shape of the background to circle bg = "#FF0000", -- Background color of the circle widget = wibox.container.background, }, margins = 1, -- Margins around the icon background widget = wibox.container.margin, } local icon = wibox.widget { { { { widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon }, margins = 4, -- Margins around the icon widget = wibox.container.margin, }, shape = gears.shape.circle, -- Shape of the background to circle bg = "#FF0000", -- Background color of the circle widget = wibox.container.background, }, margins = 1, -- Margins around the icon background widget = wibox.container.margin, } but when widget is inner_layout, clienticon nor textbox displayed: local icon = wibox.widget { { { { widget = inner_layout, -- widget = awful.widget.clienticon(c), -- Use awful.widget.clienticon to get the client's icon }, forced_width = 40, forced_height = 40, margins = 4, -- Margins around the icon widget = wibox.container.margin, }, shape = gears.shape.circle, -- Shape of the background to circle bg = "#FF0000", -- Background color of the circle widget = wibox.container.background, }, margins = 1, -- Margins around the icon background widget = wibox.container.margin, } local icon = wibox.widget { { { { widget = inner_…

http://stackoverflow.com/q/79374805
tagged with: lua
type: UnansweredQuestion
has body: 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'] [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). ] 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? local dbh = freeswitch.Dbh(DSN); dbh:query("update tbl_channel set msisdn = 100 where chan_name = 'CH001'"); dbh:release();
tagged with: freeswitch
has title: Is there any way lua script to capture the exception error in freeswitch.Dbh?
score: 0
type: Question
answer count: 0
has comment: http://stackoverflow.com/comment/139977121
has comment: http://stackoverflow.com/comment/139980595

http://stackoverflow.com/q/79394748
type: Question
has title: HAProxy Lua: Loading Protobuf Modules with Dependencies
tagged with: haproxy
tagged with: lua
has comment: http://stackoverflow.com/comment/140077460
type: UnansweredQuestion
has body: I'm working with HAProxy and have generated Lua code from Protobuf files. These files are structured as follow in the /etc/haproxy/lua The HAproxy is compiled with LUA flag tree . └── beeswax ├── adgroup │ ├── ghost_bidding_pb.lua │ └── vendor_fee_pb.lua ├── base │ └── eventid_pb.lua ├── bid │ ├── adcandidate_pb.lua │ └── request_pb.lua ├── currency │ └── currency_pb.lua └── openrtb ├── extension_pb.lua ├── openrtb_common_pb.lua ├── openrtb_pb.lua └── seat_constraints_pb.lua For example, request_pb.lua has the following dependencies local protobuf = require "protobuf" local beeswax/bid/adcandidate_pb = require("beeswax/bid/adcandidate_pb") local beeswax/openrtb/openrtb_pb = require("beeswax/openrtb/openrtb_pb") local beeswax/adgroup/ghost_bidding_pb = require("beeswax/adgroup/ghost_bidding_pb") module('beeswax/bid/request_pb') I'm trying to load the local request_pb = require("beeswax/bid/request_pb") and parse the bid request but it's failing on dependencies resolution How can I correctly resolve the dependencies between my Protobuf-generated Lua files within the HAProxy environment?
answer count: 0
score: 0

http://stackoverflow.com/q/79346707
type: Question
answer count: 0
has body: 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. 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: function findClosestSite(x, y, sites) local minDistance = math.huge local closestSite = nil local isTie = false for _, site in ipairs(sites) do local distance = math.abs(x - site[1]) + math.abs(y - site[2]) if distance &lt; minDistance then minDistance = distance closestSite = site isTie = false elseif distance == minDistance then isTie = true end end return closestSite, isTie end 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. 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?
tagged with: diagram
tagged with: lua
type: UnansweredQuestion
tagged with: voronoi
tagged with: manhattan
score: 0
has title: Manhattan Voronoi Diagram: Resolving Ties When Sites Are on the Same Diagonal

http://stackoverflow.com/a/79367457
type: Answer
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/79366750
has body: Just write a function: local function nestedIndexOrNil(t, ...) for _, k in ipairs{...} do if not t then return nil end t = t[k] end return t end nestedIndexOrNil(a, 'b', 'c')

http://stackoverflow.com/q/79366750
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/139962915
has comment: http://stackoverflow.com/comment/139962427
has body: In lua, if we try to index a series of nested table (any of which can be nil), we might write code like this: -- try to get a.b.c local ret if a then local b = a.b if b then ret = b.c end end Which I think is lenthy and ugly. There are also simpler ways: -- method 1 local ret = a and a.b and a.b.c -- method 2 local ret = ((a or {}).b or {}).c 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. So I wonder if there is a way with no side-effect like '?.' in C#? Or '?.' operator violates lua's design philosophy?
tagged with: lua
tagged with: lua-table
has title: Lua equivalent for null conditional operator?
type: Question
upvote count: 1
duplicate of: http://stackoverflow.com/q/36489928
type: UnansweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/79367457

drawing
type: Tag
tag name: drawing
tags question: http://stackoverflow.com/q/79307097

http://stackoverflow.com/comment/139774541
type: Comment
has text: Try `env | grep UID`.
comment on: http://stackoverflow.com/q/79263801
score: 0
type: QuestionComment

voronoi
tag name: voronoi
type: Tag
tags question: http://stackoverflow.com/q/79346707

http://stackoverflow.com/q/79246582
has title: Freeswitch mask and unmask commands doesnt work when recording is started by lua script
type: Question
answer count: 0
has body: 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. here is the lua script. package.cpath ="/usr/lib/x86_64-linux-gnu/lua/5.2/?.so;" .. package.cpath package.path = "/usr/share/lua/5.2/?.lua;" .. package.path local callType = session:getVariable("sip_h_X-CallType") local record_path = session:getVariable("record_path") local uuid = session:getVariable("uuid") local ext = session:getVariable("record_ext") local customer_leg_uuid = '' local api = freeswitch.API(); -- can be consult, OUT, MONITOR, PROGRESSIVE, local function fileExists(file) local f = io.open(record_path .. '/' .. file, 'r') if f == nil then -- freeswitch.consoleLog("ERROR", "set_recording_name.lua FILE NOT FOUND: " .. file) return false; end io.close(f); -- freeswitch.consoleLog("ERROR", "set_recording_name.lua FILE WAS FOUND: " .. file) return true; end local destination = tostring(session:getVariable("destination_number")) -- freeswitch.consoleLog("NOTICE", " \n set_recording_name.lua DESTINATION \n " .. destination) if (callType == "CONSULT") then freeswitch.consoleLog("NOTICE", " \n set_recording_name.lua RECORDING CONSULT CALL \n") session:execute("stop_record_session","all") if (string.match(tostring(destination), "99887766")) then return end return elseif (callType == "MONITOR") then -- no recording enabled here return -- callType == "PROGRESSIVE" or elseif (callType == "OUT") then -- for manual outbound use the preset other leg uuid i.e. customer leg uuid customer_leg_uuid = session:getVariable("customer_leg_uuid") freeswitch.consoleLog("NOTICE", " \n set_recording_name.lua UUID \n " .. uuid) freeswitch.consoleLog("NOTICE", " \n set_recording_name.lua CUSTOMER \n" .. customer_leg_uuid) if (uuid ~= customer_leg_uuid) then freeswitch.consoleLog("NOTICE", " \n set_recording_name.lua RECORDING MANUAL OUTBOUND CALL \n") session:setVariable("reco…
tagged with: fusionpbx
downvote count: 0
tagged with: contact-center
tagged with: lua
type: UnansweredQuestion
score: 1
tagged with: dialplan
favorite count: 0
tagged with: freeswitch
upvote count: 1

keyboard-layout
tag name: keyboard-layout
tags question: http://stackoverflow.com/q/79289046
type: Tag

http://stackoverflow.com/comment/139811908
type: QuestionComment
comment on: http://stackoverflow.com/q/79285284
score: 1
has text: Please provide enough code so others can better understand or reproduce the problem.
type: Comment

http://stackoverflow.com/comment/140051250
comment on: http://stackoverflow.com/q/79395710
type: Comment
score: 0
type: QuestionComment
has text: @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. You can check it yourself on a realistic car model from the toolbox from a-chassis

user-defined-functions
tag name: user-defined-functions
tags question: http://stackoverflow.com/q/79318506
type: Tag

http://stackoverflow.com/a/79318802
has body: 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).
score: 3
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/79318506
upvote count: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79318506

http://stackoverflow.com/comment/139980595
type: Comment
score: 0
has text: tried using xpcall but the err return nil instead of exception error message
type: QuestionComment
comment on: http://stackoverflow.com/q/79374805

http://stackoverflow.com/comment/139843943
comment on: http://stackoverflow.com/q/79303141
score: 0
type: QuestionComment
has text: @shingo add : print(one.score) print(second.score) and recive 3 - 3 but it was necessary to get 2 - 3
type: Comment

http://stackoverflow.com/q/79395533
favorite count: 0
type: Question
upvote count: 1
has body: 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? --Servicios local player = game:GetService("Players").LocalPlayer local repStorage = game:GetService("ReplicatedStorage") local UIS = game:GetService("UserInputService") local runservice = game:GetService("RunService") local debris = game:GetService("Debris") local character = player.Character or player.CharacterAdded:Wait() local loadedAnimation local fxFolder = repStorage.Fx local dustFx = fxFolder.DustFx local smokeFx = fxFolder.SmokeFx -- Configuracion Dash local key = Enum.KeyCode.Q -- Tecla para hacer el Dash local velocity = 20000 -- velocidad del dash local debounce = false local cooldown = 0.20 -- Cooldown despues del Dash local duration = 0.25 -- duracion del dash local sideDash = false local DashLeft = script:WaitForChild("DashLeft") local DashRight = script:WaitForChild("DashRight") --Variables para DustFX local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") --Partes donde se adjunatara el efecto local lfoot = character:WaitForChild("LeftFoot") --LeftLowerLeg / LeftFoot local rfoot = character:WaitForChild("RightFoot") --RightLowerLeg / RightFoot --Aca las Particulas del efecto local fx1 = game.ReplicatedStorage.Dash.Fx.DusFX.Dust:Clone() --Fx.DusFX.ef:Clone() fx1.Parent = rfoot local fx2 = game.ReplicatedStorage.Dash.Fx.DusFX.Dust:Clone() fx2.Parent = lfoot fx1.Enabled = false fx2.Enabled = false local function UserInputButton (input, Keyboard) --si esta suando el teclado para escribir en el chat salgo if Keyboard == true then return end --si no esta suando el teclado para escribir continuo if input.KeyCode == key then Dash() end end UIS.InputBeg…
answer count: 0
tagged with: lua
tagged with: roblox
downvote count: 0
type: UnansweredQuestion
score: 1
has title: Animation script Roblox Studio
tagged with: animation

http://stackoverflow.com/comment/139802149
has text: I have tested few things by building a simple web app with oak and react. I am seeing some error messages like: ```Cannot find module '@oak/oak' or its corresponding type declarations. [2307]``` If I am importing the package `import {} from "../.";` The this run perfectly if I try to run the app but that annoying error is not going away. I trying the test my deno setup by making this project https://docs.deno.com/examples/create_react_tutorial/
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/79276795

http://stackoverflow.com/a/79393988
type: Answer
answers question: http://stackoverflow.com/q/79393939
downvote count: 0
has body: Simply put the bodies of the two functions in a single function. It also looks like you forgot the final end. So function OnEvent(event, arg) if IsKeyLockOn ("scrolllock") then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0,1) Sleep(13) MoveMouseRelative(0,1) Sleep(14) MoveMouseRelative(0,1) Sleep(15) MoveMouseRelative(0,1) Sleep(14) MoveMouseRelative(0,1) Sleep(15) MoveMouseRelative(0,2) Sleep(16) MoveMouseRelative(0,1) until not IsMouseButtonPressed(1) end until not IsKeyLockOn ("scrolllock") end -- Quick Peek Movement Script (Activated when Num Lock is ON) if IsKeyLockOn("numlock") and event == "MOUSE_BUTTON_PRESSED" and arg == 5 then repeat PressKey("e") -- Right peak Sleep(50) PressKey("n") -- Aim before crouch Sleep(50) PressKey("c") -- Crouch Sleep(50) ReleaseKey("n") -- Release Aim ReleaseKey("c") PressKey("n") -- Press Aim again after crouch release Sleep(50) PressKey("q") -- Left peak Sleep(50) ReleaseKey("n") -- Release Aim after Left Peek ReleaseKey("q") ReleaseKey("e") Sleep(50) until not IsMouseButtonPressed(5) end end
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/140017449

http://stackoverflow.com/comment/139785507
has text: Also, luac can compile and combine multiple Lua scripts.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/79270481
score: 0

http://stackoverflow.com/comment/139741467
score: 0
comment on: http://stackoverflow.com/q/79246572
has text: And then there is https://www.love2d.org/wiki/love.window.getFullscreenModes to check.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/139942541
has text: 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.
comment on: http://stackoverflow.com/q/79356193
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/79343722
score: -2
type: Question
has answer: http://stackoverflow.com/a/79344006
upvote count: 0
tagged with: immutability
tagged with: lua
has body: I am interested in knowing how to code a single assignment variable in Lua, similar to this example in Rust. fn main() { println!("Hello, world!"); let x; //---> This is the single assignment variable let y = 20; x = 10; x = 20; //---> This will cause a compiler error println!("{} + {} = {}",x,y,x+y); }
has title: How to code a run-time, single-assignment, variable in Lua?
type: UnansweredQuestion
favorite count: 0
downvote count: 2
answer count: 1

http://stackoverflow.com/comment/140043398
comment on: http://stackoverflow.com/a/79408046
type: Comment
type: AnswerComment
has text: @AlirezaBahrami What's your Neovim version?
score: 0

http://stackoverflow.com/a/79417279
score: 0
type: Answer
answers question: http://stackoverflow.com/q/79416299
has body: local _, own_path = ... -- needs at least Lua 5.2 ... is known as the vararg expression, for use directly inside variadic functions. Note that a chunk (e.g., a Lua program file) is treated as the body of an anonymous variadic function. The vararg expression was introduced in Lua 5.1, as a replacement for Lua 5.0's implicit arg variable (which collected variadic arguments into a table). The major change in Lua 5.2 was with how function environments are handled - a separate topic from variadic functions. This comment looks like a misunderstanding. local LIBDIR = own_path:match(&quot;(.*&quot;..package.config:sub(1,1)..&quot;)&quot;) Assuming this is the source, the unmodified version reads as -- Change this as necessary to point to where [lib?]pollnet.dll|.so|.dylib -- is actually located. local LIBDIR = &quot;./&quot; so your example appears to be generating the path for the shared library, given whatever calls your code provides it a file path. package.config:sub(1, 1) yields the directory separating character, which is used to match and capture the leading directory path.

http://stackoverflow.com/q/79318816
tagged with: roblox
has answer: http://stackoverflow.com/a/79319171
upvote count: 1
has title: Humanoid not moving with mouse on Rbx Studio
score: 1
favorite count: 0
type: AnsweredQuestion
has body: I am trying to make a humanoid move with the mouse cursor in Roblox Studio. local player = game.Players.LocalPlayer local mouse = player:GetMouse() local tower = getTower(towerOneIndex):Clone() tower.Parent = workspace.Map1.Towers local towerHum = tower:WaitForChild("HumanoidRootPart") mouse.Move:Connect(function() print("moved") towerHum.CFrame = mouse.Hit print(towerHum.CFrame) print(mouse.Hit) end) The 'tower' humanoid spawns on the map but does not follow the mouse The final two print functions return the same value but despite the tower humanoid CFrame being updated the humanoid does not movve
answer count: 1
accepted answer: http://stackoverflow.com/a/79319171
type: Question
downvote count: 0
tagged with: lua

http://stackoverflow.com/q/79245681
type: AnsweredQuestion
answer count: 1
accepted answer: http://stackoverflow.com/a/79246061
tagged with: roblox
type: Question
upvote count: 1
has title: Roblox ProfileService: What would cause LoadProfileAsync() to take a full minute to load?
tagged with: lua
has answer: http://stackoverflow.com/a/79246061
downvote count: 0
has body: 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, ProfileStore:LoadProfileAsync() 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. 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. local Players = game:GetService("Players") local serverScriptService = game:GetService("ServerScriptService") local Template = require(serverScriptService.PlayerData.Template) local ProfileService = require(serverScriptService.Modules.ProfileService) local ProfileStore = ProfileService.GetProfileStore("Test", Template) local function PlayerAdded(player: Player) print("TEST1") local profile = ProfileStore:LoadProfileAsync("Player_"..player.UserId) print("TEST2") -- Cut out a lot of code that I don't think is relevant end Players.PlayerAdded:Connect(PlayerAdded) 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. Players.PlayerRemoving:Connect(function(player) local profile = Manager.Profiles[player] if not profile then return end profile:Release() end) game:BindToClose(function() for _, profile in Manager.Profiles do profile:Release() end end) I do have these functions to handle releasing profiles upon players leaving or the server closing.
score: 1
favorite count: 0

timer
tag name: timer
tags question: http://stackoverflow.com/q/79358608
type: Tag

vim-registers
type: Tag
tags question: http://stackoverflow.com/q/79297042
tag name: vim-registers

http://stackoverflow.com/a/79380536
answers question: http://stackoverflow.com/q/79378695
has body: amazing how I've come across the same need on the same day with you! Managed to do this as follows: Set the extra_lua_path variable in the Apisix config as you do. I set it to /opt/?.lua but I doubt this makes any difference. Created a docker volume to map the .lua file from my local drive to the extra_lua_path location (as read-only), as I guess you also do. Set the functions variable in the JSON configuration to "functions": ["local test=require('test');return test;"] (my file is test.lua).
score: 0
type: Answer

http://stackoverflow.com/q/79248704
has title: Avante plugin won't generate Responses
tagged with: cursor-ide
answer count: 1
score: 1
favorite count: 0
type: AnsweredQuestion
tagged with: neovim-plugin
tagged with: neovim
upvote count: 1
has body: Problem: Avante plugin never responds with a generated response. It just hangs forever. Suspicion: There is something wrong with the API key or way it is being used. Question: How do I properly set and verify my API Key? How do I get Avante to respond with it's generated response; rather than hang forever. Setup: I copied the standard avante install with lazy to ~/.config/nvim/lua/plugins/avante' as shown below. I pay for Claude. I created my anthropic api key by going to: https://console.anthropic.com/settings/keys and creating a new key. I tried setting this key three ways: in ~/.config/fish/config.fish I added set -gx ANTHROPIC_API_KEY <MY-API-KEY>. I verified it was set by running source ~/.config/fish/config.fish then echo $ANTHROPIC_API_KEY. With no env var. I execute <leader>aa in neovim. I am prompted to enter ANTHROPIC_API_KEY by Avante and I enter my real api key. With no env var. I execute <leader>aa in neovim. I am prompted to enter ANTHROPIC_API_KEY by Avante and I enter my something random like: asdfasdfjkl. Then I nvim index.js and <leader>aa to open Avante. I enter a prompt, eg. Write a Javascript function that takes in two arguments and returns their sum. then Ctrl-S and I see Generating response ... forever. It never outputs anything. It just hangs here forever: --- - Datetime: 2024-12-03 09:43:21 - Model: claude/claude-3-5-sonnet-20241022 - Selected file: index.js > Write a Javascript function that takes in two arguments and returns their sum. **Generating response ...** 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. return { "yetone/avante.nvim", event = "VeryLazy", lazy = false, version = false, -- set this if you want to always pull the latest change opts = { -- add any opts here }, -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` build = "make", -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFro…
accepted answer: http://stackoverflow.com/a/79248795
type: Question
downvote count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/79248795

lua-resty-openidc
type: Tag
tags question: http://stackoverflow.com/q/79338135
tag name: lua-resty-openidc

probability
tag name: probability
tags question: http://stackoverflow.com/q/79350389
type: Tag

http://stackoverflow.com/a/79354976
score: 0
accepted answer of: http://stackoverflow.com/q/79354895
type: AcceptedAnswer
has body: The manual describes upvalue as follows: A local variable used by an inner function is called an upvalue, or external local variable, inside the inner function. turn is not an inner function of setupRotary, so sv will not be passed. You can fix this problem by moving the function inside: local turn local setupRotary = function(sv) turn = function(type, pos, when) -- here sv is visible end end
type: Answer
answers question: http://stackoverflow.com/q/79354895

http://stackoverflow.com/comment/140042227
has text: Sorry for the misunderstanding only the keys <C-l> and <C-h> does not work. And 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
comment on: http://stackoverflow.com/a/79408064
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/79267878
upvote count: 4
has body: That's a really overly complicated way to do it. In any case, the error lies in ListConcat. This function should return a new list, but you are actually modifying the first list and returning that one. This causes that key1s and keys will be identical. Which makes if has_value(key1s, key) then be true for all keys. A much simpler solution is to just do this function TableConcat(t1, t2) local rtb = {} for k,v in pairs(t2) do rtb[k] = v end for k,v in pairs(t1) do rtb[k] = v end return rtb end
downvote count: 0
answers question: http://stackoverflow.com/q/79267808
score: 4
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79267808

http://stackoverflow.com/a/79403586
upvote count: 2
has comment: http://stackoverflow.com/comment/140033777
type: AcceptedAnswer
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/79402036
answers question: http://stackoverflow.com/q/79402036
downvote count: 0
has body: As pointed out in this answer, It is up to the designer of the module to decide what can be seen from the outside. The working require("telescope.builtin") approach loads a separate module that contains the find_files function. However, that module, and so its function, apparently is not automatically part of the telescope table/module. Since the builtin module is not accessible from the outside by default, Lua in this instance assumes that builtin in the reference telescope.builtin is a field of the telescope module, which it isn't, resulting in the error "attempt to index **field** 'builtin' (a nil value)." Now, if you really want to use the require("some").module approach, you may add a line to expose builtin as a field of telescope explicitly, like so: local telescope = require("telescope") telescope.builtin = require("telescope.builtin") -- Add this line Then the line in question would work correctly: telescope.builtin.find_files({ cwd = selection.path }) But to avoid ambiguity and unnecessary additions to the telescope namespace, I'd say it’s better to stick with the working version: local builtin = require("telescope.builtin") ... builtin.find_files({ cwd = selection.path }) Finally, I think it was a deliberate intention by the developers of the telescope module to have that structure, as their own code snippets show the require("some.module") approach: --- To use any of Telescope's default options or any picker-specific options, call your desired picker by passing a lua --- table to the picker with all of the options you want to use. Here's an example with the live_grep picker: --- --- --- :lua require('telescope.builtin').live_grep({ --- prompt_title = 'find string in open buffers...', --- grep_open_files = true --- }) --- -- or with dropdown theme --- :lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{ --- previewer = false --- }) --- You can check such things by iterating over the module's fields (as it typically has the…

http://stackoverflow.com/q/79402036
score: 1
type: AnsweredQuestion
tagged with: neovim-plugin
tagged with: neovim
accepted answer: http://stackoverflow.com/a/79403586
downvote count: 0
has title: Difference between require("some.module") and require("some").module?
favorite count: 0
type: Question
answer count: 1
tagged with: module
has answer: http://stackoverflow.com/a/79403586
upvote count: 1
has body: I currently have this (working) configuration in my neovim: { "nvim-telescope/telescope.nvim", dependencies = { ... "jvgrootveld/telescope-zoxide", }, config = function() -- First setup telescope local telescope = require("telescope") local builtin = require("telescope.builtin") telescope.setup({ ... extensions = { zoxide = { mappings = { default = { keepinsert = true, action = function(selection) builtin.find_files({ cwd = selection.path }) -- the line in question end, }, }, }, }, }) telescope.load_extension("zoxide") end, ... }, If I change the line in question to telescope.builtin.find_files({ cwd = selection.path }) I get the following error: E5108: Error executing lua: /home/sbeer/.config/nvim/lua/plugins/telescope.lua:38: attempt to index field 'builtin' (a nil value) stack traceback: /home/sbeer/.config/nvim/lua/plugins/telescope.lua:38: in function 'action' ...lescope-zoxide/lua/telescope/_extensions/zoxide/list.lua:86: in function 'run_replace_or_original' ...re/nvim/lazy/telescope.nvim/lua/telescope/actions/mt.lua:65: in function 'key_func' ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:253: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:252> What exactly is the difference between the two?
linked to: http://stackoverflow.com/q/34714439
tagged with: lua

http://stackoverflow.com/a/79344006
upvote count: 4
score: 3
answers question: http://stackoverflow.com/q/79343722
has comment: http://stackoverflow.com/comment/139919096
type: Answer
has comment: http://stackoverflow.com/comment/139919585
downvote count: 1
has body: In Lua 5.4, a local declaration may contain the &lt;const&gt; attribute, creating a constant variable. Attempting to reassign a constant variable throws an error: local foo &lt;const&gt; = 42 foo = 99 -- error: attempt to assign to const variable 'foo' Lua 5.4: 3.3.7 – Local Declarations

http://stackoverflow.com/q/79263801
type: Question
has comment: http://stackoverflow.com/comment/139774541
downvote count: 0
tagged with: lua
has body: I'm writing a yazi 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. According to Programming in Lua 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 nil The thing is, UID it's indeed defined [user@hostname ~]$ echo $UID 1000 What I've tried is to use os.getenv("UID") but the function returns nil. On the other hand, other environment variables such as XDG_RUNTIME_DIR or HOME are retrieved successfully. For instance ... local user_id = os.getenv("UID") local run_dir = os.getenv("XDG_RUNTIME_DIR") local tmp_dir = run_dir .. "/office.yazi-" .. user_id .. "/" local pdf_file = tmp_dir .. self.file.name:gsub("%..*$", ".pdf") ... Fails to concatenate a nil value assigned to user_id due to os.getenv("UID") Another approach I've tried is to use io.popen() instead ... local handle = io.popen("id -u") local user_id = handle:read("*a") handle:close() local run_dir = os.getenv("XDG_RUNTIME_DIR") local tmp_dir = run_dir .. "/office.yazi-" .. user_id .. "/" local pdf_file = tmp_dir .. self.file.name:gsub("%..*$", ".pdf") ... But the problem with said approach is that returns a trailing newline character as 1000\n And maybe I can remove it somehow, but as it's a plugin what I'm writing I would prefer to go down the os.getenv route and keep it simple as far it's possible. If what I'm asking it's not possible, please let me know. My guess is os.getenv("UID") not reading the correct variable name or trying to read it from the wrong place. Does someone has any idea as to why is this happening or any suggestion as to read the UID env?
tagged with: getenv
upvote count: 1
answer count: 1
type: UnansweredQuestion
score: 1
favorite count: 0
tagged with: environment-variables
tagged with: uid
has title: Lua os.getenv("UID") returns `nil` but environment variable it's already set
has answer: http://stackoverflow.com/a/79263823

fusionpbx
tag name: fusionpbx
type: Tag
tags question: http://stackoverflow.com/q/79246582

http://stackoverflow.com/a/79263823
has comment: http://stackoverflow.com/comment/139774554
answers question: http://stackoverflow.com/q/79263801
has body: $UID is not an environment variable, thus you cannot get it with os.getenv Your another approach can work, just change the mode to read one line: local handle = io.popen("id -u") local user_id = handle:read("l") handle:close() Or you can pass $UID to your lua script as an argument: $ lua example.lua $UID -- example.lua local user_id = arg[1];
type: Answer
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/q/79324878
type: Question
favorite count: 0
upvote count: 2
score: 2
has body: Suppose I have two Lua arrays a = {1, 2, 3} and b = {4, 5, 6}. And then do the following assignation q, w, e, r, t, y = table.unpack(a), table.unpack(b) I would expect to get that q == 1 and w == 2 and e == 3 and r == 4 and t == 5 and y == 6 But I get that q == 1 and w == 4 and e == 5 and r == 6 and t, y are nil! Could you please explain such a strange behavior?
has title: strange behavior of table.unpack
type: UnansweredQuestion
downvote count: 0
tagged with: lua
has answer: http://stackoverflow.com/a/79324906
answer count: 1

http://stackoverflow.com/comment/139832646
comment on: http://stackoverflow.com/q/79297042
type: QuestionComment
has text: Ahh I see, reading the doc would have been helpful. Ok thanks @romainl
type: Comment
score: 0

tmux
type: Tag
tags question: http://stackoverflow.com/q/79306019
tag name: tmux

http://stackoverflow.com/a/79324699
has body: 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. 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 the docs regarding the limitations of RemoteEvent arguments : Non-Replicated Instances 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. That's why you are seeing nil when you try to print it out. 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. So in your LocalScript : -- tell the server to create a tower local tower = "Boxer" game.ReplicatedStorage.SpawnTowerEvent:FireServer(tower, mouse.Hit.Position) Then your Script finds which tower the client is talking about and creates it : game.ReplicatedStorage.SpawnTowerEvent.OnServerEvent:Connect(function(plr, towerName, pos) -- make sure that the requested tower actually exists local towerTemplate = game.ReplicatedStorage.Towers[towerName] if not towerTemplate then warn(string.format("Could not find a tower named %s", tostring(towerName)) return end -- TO DO : make sure the player can create this kind of tower -- clone the tower into the workspace local towerToPlace = towerTemplate:Clone() towerToPlace:PivotTo(CFrame.new(pos)) towerToPlace.Parent = workspace.Map.TowersToPlace print(towerName, " created at ", pos) end)
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79320852
answers question: http://stackoverflow.com/q/79320852
score: 0

http://stackoverflow.com/a/79384666
score: 1
answers question: http://stackoverflow.com/q/79383237
upvote count: 1
accepted answer of: http://stackoverflow.com/q/79383237
downvote count: 0
has body: When working with OOP in lua, there's 3 things to double check are all present and working properly : -- 1. The base table is defined local Thing = {} -- 2. The base table has a self referential __index meta method Thing.__index = Thing function Thing.new() -- 3. A call to setmetatable to link the new object to the base table return setmetatable({}, Thing) end And looking at your code... FistCombat._index = FistCombat It looks like you didn't set the __index metamethod properly. Notice that __index has two underscores at the front. When you defined it, it looks like you only used one. So change that line to this : FistCombat.__index = FistCombat And see if that helps
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/139885259
comment on: http://stackoverflow.com/a/79300385
score: 0
type: AnswerComment
has text: 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.
type: Comment

http://stackoverflow.com/comment/139874178
comment on: http://stackoverflow.com/a/79319171
score: 0
type: AnswerComment
type: Comment
has text: This works, thank you!

http://stackoverflow.com/q/79306019
type: UnansweredQuestion
tagged with: neovim
has body: I'm using a Tmux extension called Floax, and need to activate it from Neovim (only if Neovim is running inside Tmux, otherwise it should perform another action). So far I manage to create my lua script for the binkdkey, but I'm finding problem for the last part: how do I tell neovim to perform a key combination inside Tmux? In this case it should trigger Alt+p, I'm trying using tmux send-keys but it's not working: local function open_floating_window() if vim.fn.getenv('TMUX') ~= vim.NIL then open_nvim_floating_window() else vim.fn.system('tmux send-keys -t ! M-p') end end vim.keymap.set('n','&lt;leader&gt;ft', open_floating_window, { desc = 'Open floating terminal'}) Thank you very much for any insight you could give me.
score: 0
tagged with: tmux
has title: Perfom a Tmux key combination from Neovim
has comment: http://stackoverflow.com/comment/140245500
answer count: 0
tagged with: lua
type: Question

http://stackoverflow.com/comment/140030963
comment on: http://stackoverflow.com/q/79395710
type: QuestionComment
type: Comment
score: 0
has text: 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?

http://stackoverflow.com/q/79393939
upvote count: 0
downvote count: 3
has comment: http://stackoverflow.com/comment/140017454
tagged with: logitech-gaming-software
answer count: 1
type: UnansweredQuestion
has title: Merging 2 Scripts into 1 script
favorite count: 0
has comment: http://stackoverflow.com/comment/140012884
tagged with: logitech
has body: 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... I want to use them on Logitech scripting for a game and I wanna make them work together. function OnEvent(event, arg) if IsKeyLockOn ("scrolllock") then repeat if IsMouseButtonPressed(1) then repeat MoveMouseRelative(0,1) Sleep(13) MoveMouseRelative(0,1) Sleep(14) MoveMouseRelative(0,1) Sleep(15) MoveMouseRelative(0,1) Sleep(14) MoveMouseRelative(0,1) Sleep(15) MoveMouseRelative(0,2) Sleep(16) MoveMouseRelative(0,1) until not IsMouseButtonPressed(1) end until not IsKeyLockOn ("scrolllock") end end function OnEvent(event, arg) -- Quick Peek Movement Script (Activated when Num Lock is ON) if IsKeyLockOn("numlock") and event == "MOUSE_BUTTON_PRESSED" and arg == 5 then repeat PressKey("e") -- Right peak Sleep(50) PressKey("n") -- Aim before crouch Sleep(50) PressKey("c") -- Crouch Sleep(50) ReleaseKey("n") -- Release Aim ReleaseKey("c") PressKey("n") -- Press Aim again after crouch release Sleep(50) PressKey("q") -- Left peak Sleep(50) ReleaseKey("n") -- Release Aim after Left Peek ReleaseKey("q") ReleaseKey("e") Sleep(50) until not IsMouseButtonPressed(5) end i tried to merge these 2 scripts but one works the other doesn't. the merge script is this: function OnEvent(event, arg) -- Quick Peek with Mouse Button 5 if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then -- Hold Right Peak (E), Crouch (C), and Aim (N) PressKey("e") PressKey("c") PressKey("n") end if event == "MOUSE_BUTTON_RELEASED" and arg == 5 then -- Release Right Peak (E), Crouch (C), and Aim (N) ReleaseKey("e") ReleaseKey("n") -- Press C again to make the player stand up PressKey("c") Sleep(50) -- Briefly hold C to ensure it registers as standing up ReleaseKey("c") end -- No Recoil Script with Scroll Lock ON for Mouse Button 1 if IsKeyLockOn("scrolllock") then -- Start No Recoil when Mouse Button 1 is pressed if IsMouseButtonPressed(1) then repeat -- Apply recoil control (move mouse slightl…
type: Question
tagged with: lua
score: -3
has answer: http://stackoverflow.com/a/79393988

http://stackoverflow.com/comment/140062616
score: 3
type: QuestionComment
comment on: http://stackoverflow.com/q/79419434
type: Comment
has text: Lua does not use regexes, only simple patterns. Try `string.gmatch(s,'"(.-)"')`.

http://stackoverflow.com/q/79368261
tagged with: roblox
score: 2
has title: Physics broken for unanchored parts when i use :Destroy()
type: UnansweredQuestion
has body: Basically I have a shooting mechanic in my side scroller game and I made it work with parts, having them have health. I wanted these parts to be unanchored and I have tested them without shooting them, and they work fine as unanchored parts. 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 part:Destroy() to remove the parts, the part on the top floats midair and moves like its laggy?? see this video. I don't really know what to try to fix this problem, which is why I'm posting it on here. A few things to note: This is on a new pc which runs stuff like mortal kombat 1 and elden ring etc so i don't think its performance. My studio on this pc is quite buggy for some reason, especially with animations. I tried loading the ACTUAL game up in the roblox player to no avail. here is my code for shooting (it goes in starterplayer.startercharacterscripts): local player = game.Players.LocalPlayer local mouse = player:GetMouse() local gui = player.PlayerGui:WaitForChild("GameGui") local targetImage = gui:WaitForChild("Target") local bulletSpeed = 70 local damageAmount = 25 local shootCooldown = 1 local lastShootTime = 0 targetImage.Visible = false local function unanchorBreakableParts() local breakableFolder = workspace:WaitForChild("Breakable") for _, part in pairs(breakableFolder:GetChildren()) do if part:IsA("Part") then part.Anchored = false end end end local function fireBullet(startPosition, targetPosition) local bullet = Instance.new("Part") bullet.Size = Vector3.new(1, 0.5, 0.5) bullet.Material = Enum.Material.Neon bullet.BrickColor = BrickColor.new("Bright yellow") bullet.Position = startPosition bullet.Anchored = false bullet.CanCollide = false bullet.Parent = workspace local direction = (targetPosition - startPosition).unit bullet.CFrame = CFrame.lookAt(startPosition, startPosition + direction) local bodyVelocity = Instance.new("BodyVelocity") bodyVelocity.Velocity = direction * bulletSpeed bodyVel…
upvote count: 2
answer count: 1
favorite count: 0
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/79379807
tagged with: lua

http://stackoverflow.com/a/79387878
score: 1
downvote count: 0
has body: The Problem with thinking in terms of content flow is that a PDF cannot be written like one HTML page. 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. 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). 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 & 2 (ALL PDF writers internally start with Page 0 which a PDF Viewer will later display as Page 1). %PDF-1.4 1 0 obj <</Type/Catalog/Pages 2 0 R>> endobj 2 0 obj <</Type/Pages/Count 3/Kids[4 0 R 5 0 R 6 0 R ]>> endobj 3 0 obj <</Type/Font/Subtype/Type1/BaseFont/Helvetica>> endobj 4 0 obj <</Type/Page/Parent 2 0 R/MediaBox[0 0 595 842]/Resources<</Font<</F0 3 0 R>>>>/Contents 7 0 R>> endobj 5 0 obj <</Type/Page/Parent 2 0 R/MediaBox[0 0 595 842]/Resources<</Font<</F0 3 0 R>>>>/Contents 7 0 R>> endobj 6 0 obj <</Type/Page/Parent 2 0 R/MediaBox[0 0 595 842]/Resources<</Font<</F0 3 0 R>>>>/Contents 7 0 R>> endobj 7 0 obj <</Length 8 0 R>> stream q 0 g BT /F0 12 Tf 1 0 0 1 20 820 Tm (Programmeur : LumiArt-Studio) Tj ET 1 0 0 1 20 800 cm BT (Date : " .. os.date \("%d/%m/%Y %H:%M"\) .. ") Tj ET 1 0 0 1 0 -20 cm BT (Machine : Test Machine) Tj ET 1 0 0 1 30 -100 cm BT (ID :) Tj ET 1 0 0 1 100 0 cm BT (Type :) Tj ET 1 0 0 1 100 0 cm BT (Name :) Tj ET 1 0 0 1 100 0 cm BT (Fixture Type :) Tj ET 1 0 0 1 100 0 cm BT (U.Address :) Tj ET Q endstream endobj 8 0 obj 0548 endobj xref 0 9 0000000000 65536 f 0000000009 00000 n 0000000054 00000 n 0000000118 00000 n 0000000181 00000 n 0000000293 00000 n 0000000405 00000 n 0000000517 00000 n 0000000957 00000 n trailer <</Size 9/Root 1 0 R>> startxref 977 %%EOF If you need each page to show different…
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/79387197

http://stackoverflow.com/a/79360347
has comment: http://stackoverflow.com/comment/139958906
type: Answer
has body: I see at least three problems: X25519 and prime256v1 are totally different curves. You need to pick one or the other and use it consistently. 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: local openssl_bn = require "resty.openssl.bn" local a_bn = openssl_bn.new(a_decoded_key, 2) local a_key = openssl_pkey.new({ type = "EC", params = { private = a_bn, group = "prime256v1" } }) OpenSSL doesn't automatically calculate the public key from the private key, so you have to do that yourself, as How do I obtain the public key from an ECDSA private key in OpenSSL? explains. Unfortunately, lua-resty-openssl doesn't expose a lot of necessary functions for this, e.g., EC_POINT_mul, so you'd have to either switch libraries or write a lot of C FFI code yourself to do this.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/139950148
upvote count: 1
answers question: http://stackoverflow.com/q/79360326

http://stackoverflow.com/a/79276795
accepted answer of: http://stackoverflow.com/q/79268224
answers question: http://stackoverflow.com/q/79268224
has comment: http://stackoverflow.com/comment/139801729
has body: Since you are using Mason LSP Config and Kickstart you have to place your config in the servers table: local servers = { lua_ls = { settings = { Lua = { completion = { callSnippet = "Replace", }, hint = { enable = true, }, }, }, }, ts_ls = { root_dir = require("lspconfig").util.root_pattern({ "package.json", "tsconfig.json" }), single_file_support = false, settings = {}, }, denols = { root_dir = require("lspconfig").util.root_pattern({"deno.json", "deno.jsonc"}), single_file_support = false, settings = {}, }, } The suggested config from Deno website only works if you are not using Mason LSP Config. You don't need to pass on_attach since Kickstart already sets an autocommand on 'LspAttach'
has comment: http://stackoverflow.com/comment/139803804
downvote count: 0
has comment: http://stackoverflow.com/comment/139802149
score: 3
type: AcceptedAnswer
type: Answer
upvote count: 3

http://stackoverflow.com/a/79397540
has body: Per the documentation, pb.load accepts binary schema data, returning a boolean indicating success and, if applicable, the binary offset at which it failed parsing. A quick sanity check local res, off = pb.load([[ syntax = "proto3"; message Request { string user_id = 1; int32 action = 2; } ]]) print(res, off) shows the results here to be false, 6. Use the protoc module to compile your schema. A very cursory example: local pb = require "pb" local protoc = require "protoc" local p = protoc.new() p:load [[ syntax = "proto3"; message Request { string user_id = 1; int32 action = 2; } ]] print(pb.type "Request") $ lua message_pb.lua .Request Request message
accepted answer of: http://stackoverflow.com/q/79397267
answers question: http://stackoverflow.com/q/79397267
has comment: http://stackoverflow.com/comment/140020261
type: AcceptedAnswer
type: Answer
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/139936215
type: Comment
score: 1
has text: 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. 2. It's numbers 499818, 263101, 131607, 62389, 29966, 10827, 3826, 1128, 287, 48, 4, but they are too long for the column.
comment on: http://stackoverflow.com/q/79350389
type: QuestionComment

http://stackoverflow.com/q/79310374
type: UnansweredQuestion
answer count: 2
has answer: http://stackoverflow.com/a/79311707
score: 0
tagged with: iup
type: Question
tagged with: lua
has answer: http://stackoverflow.com/a/79311441
has body: I'm trying to change the color of a button, which doesn't seem to work, aswell as adding an Image. For the Image: I 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. Also tried iup.LoadImage but it didn't work for me either. I preferebly use the iamges with links, however if there's no other option I can use Image Files also require("iuplua") local screenWidth, screenHeight = 1920, 1080 local windowWidth = screenWidth * 0.4 local windowHeight = screenHeight * 0.3 local Data = { ["Industrialist"] = { Image = "https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg", ID = "9192423027" }, ["Engineer"] = { Image = "https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg", ID = "9192423027" }, ["Scientist"] = { Image = "https://letsenhance.io/static/8f5e523ee6b2479e26ecc91b9c25261e/1015f/MainAfter.jpg", ID = "9192423027" }, } local Instances = {} function createInstance(Title, Data) local label = iup.label{ title = Title, alignment = "ACENTER", valign = "TOP", halign = "CENTER", fgcolor = "255 255 255" } local button = iup.button{ title = "Open", bgcolor = "2 183 87",--"#02b757" alignment = "ACENTER", size = "100x30", action = function() local link = "roblox://placeId=" .. Data.ID os.execute('start "" "' .. link .. '"') end } local Image = iup.label{image = iup.LoadImage("Images/Industrialist.png")} --THIS DID NOT WORK -- Creating the container for the components local container = iup.vbox{ label, Image, button, alignment = "ACENTER", valign = "CENTER", halign = "CENTER", size = "150x200", expand = "YES" } return container end for i, v in pairs(Data) do table.insert(Instances, createInstance(i, v)) end local gridBox = iup.gridbox{ orientation = "HORIZONTAL", numdiv = 3, alignment = "ACENTER", expand = "YES", table.unpack(Instances) } local dlg = iup.dialog{ gridBox, title = "Alchemister", size = windowWidth..…
has title: IUPLua, can't change button color and can't add Image

http://stackoverflow.com/comment/139888626
type: Comment
score: 1
has text: 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
type: QuestionComment
comment on: http://stackoverflow.com/q/79328249

http://stackoverflow.com/comment/139977121
comment on: http://stackoverflow.com/q/79374805
score: 0
has text: Have you tried pcall?
type: QuestionComment
type: Comment

uid
tag name: uid
type: Tag
tags question: http://stackoverflow.com/q/79263801

http://stackoverflow.com/q/79370237
tagged with: nginx
type: AnsweredQuestion
answer count: 1
tagged with: dynamic
score: 0
accepted answer: http://stackoverflow.com/a/79370282
tagged with: evaluation
tagged with: lua
has answer: http://stackoverflow.com/a/79370282
has title: How to load module using a variable with Lua in Openresty?
type: Question
tagged with: openresty
has body: Trying to load modules based on a value in a variable. Is this possible? local moduletoload = "login" local mod_action = require moduletoload Thanks

http://stackoverflow.com/q/79259465
has title: os.remove works but Shell:Run with luacom doesn't
has body: I have a file at c:\test.mp3. Removing it with os.remove("c:\\test.mp3") works but I want to remove it with del command from luacom's Shell. Unfortunately, it doesn't work: local command = string.format('del "c:\\test.mp3"') local Shell = luacom.CreateObject("WScript.Shell") Shell:Run(command, 0, false) It returns COM exception:(luacom\src\library\tLuaCOM.cpp,386):The system cannot find the file specified. Running other operations on this file from WScript.Shell, i.e. using ffmpeg (with the exact same path) have no issues finding this file.
type: UnansweredQuestion
tagged with: luacom
score: 0
type: Question
answer count: 0
tagged with: lua

http://stackoverflow.com/q/79270435
type: Question
downvote count: 0
has title: How to precompile and dump Lua binary with C closures?
tagged with: lua
has body: Currently I have a Lua-driven system with C functions connected. When it is built from source, it is constructed as below: // bind C functions to make them callable inside Lua code lua_pushlightuserdata(lua, some_cxx_object); lua_pushcclosure(lua, global_function_foo, 1); lua_setglobal(lua, "foo"); lua_pushcclosure(lua, global_function_bar, 0); lua_setglobal(lua, "bar"); ...... many more bindings ...... // compile Lua source code auto re = luaL_loadbufferx( guts->lua, source, source_len, nullptr, nullptr ); if (re != LUA_OK) raise_exceptions(); // use the prepared Lua system ...... Now I want to use precompiled binaries to improve system init speed. My question is: how does lua_dump work with those C closure globals? Specifically: When I'm going to compile & dump, should I bind C functions before compile? When I'm going to use the precompiled binary, do I need to bind C functions again, before loading the binary?
upvote count: 2
has answer: http://stackoverflow.com/a/79270481
score: 2
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/79270481
type: AnsweredQuestion
tagged with: luac

http://stackoverflow.com/a/79304674
accepted answer of: http://stackoverflow.com/q/79303141
answers question: http://stackoverflow.com/q/79303141
downvote count: 0
has body: NonPair.super:new(1, 2) is syntactic sugar for NonPair.super.new(NonPair.super, 1, 2) (the same pattern applies for OnePair). This means the contextual self inside Combination:new will not refer to the new instance (one), but rather the parent class itself (Combination). With this, self.level = level is then equivalent to Combination.level = level, setting a key-value pair on the class itself. The call to OnePair.super:new(1, 3) overwrites the values that were set by NonPair.super:new(1, 2), so both one.level and second.level result in the same value (both invoking the __index metamethod to find the value on the parent class). The correct pattern to use with this library is NonPair = Combination:extend() function NonPair:new() NonPair.super.new(self, 1, 2) end OnePair = Combination:extend() function OnePair:new() OnePair.super.new(self, 1, 3) end as shown in the README.
type: AcceptedAnswer
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/139846590
upvote count: 2

http://stackoverflow.com/comment/140020261
type: AnswerComment
comment on: http://stackoverflow.com/a/79397540
has text: Awesome Thanks alot
type: Comment
score: 0

http://stackoverflow.com/a/79380639
accepted answer of: http://stackoverflow.com/q/79378695
answers question: http://stackoverflow.com/q/79378695
score: 0
has body: TL;DR You can use loadfile() inside the serverless functions 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. Example: "plugins": { "serverless-pre-function": { "phase": "access", "functions": [ "return function(conf, ctx); ... local code = loadfile(\"/path/to/file.lua\"); ... code(); ... end" ] } } Long Answer Possible Solutions There are at least 2 ways you can achieve that behaviour: load and call the function's code from within serverless.conf.functions parameter, without changing the serverless plugin source code; edit serverless plugin or write a separate custom-serverless plugin so that you can directly set the path in its parameters. NB: for the examples below I assume you have placed the file containing the functions at /usr/local/apisix/lua_scripts/extract_userinfo.lua, with the following content: 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 1. Load the File Content Inside Serverless Functions From serverless functions parameter, you can return a function that loads the file content using Lua loadfile("/path/to/file"), and execute it afterwards. With this solution you don't have to change the source code of serverless plugin. Example APISIX Traditional Mode curl http://127.0.0.1:9180/apisix/admin/routes/1 -H "X-API-KEY: $admin_key" -X PUT -d ' { "uri": "/custom-serverless/*", "plugins": { "serverless-pre-function": { "phase": "rewrite", "functions" : [ "return function(conf, ctx); l…
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/139763978
type: Comment
has text: Yup, I completely missed that on the list of metamethods, thank you!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79257991

http://stackoverflow.com/a/79248795
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/79248704
has body: The issue was that I hadn't added credits to anthropic. I thought that since I was paying for "Professional" account with Claude.ai that this would work. It doesn't. Solution: I added credits to Anthropic and then cancelled my Claude.ai subscription.
type: AcceptedAnswer
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/79248704

http://stackoverflow.com/a/79345720
upvote count: 1
has comment: http://stackoverflow.com/comment/139922113
has comment: http://stackoverflow.com/comment/139922265
has body: The manual states: Lua queries metamethods in metatables using a raw access (see rawget). Therefore, you cannot expect to use __index to inherit metamethods, you must define the metamethods explicitly. UI.Widget = { __tostring = function () return 'widget' end }
type: Answer
answers question: http://stackoverflow.com/q/79345546
downvote count: 0
score: 1

contact-center
type: Tag
tags question: http://stackoverflow.com/q/79246582
tag name: contact-center

http://stackoverflow.com/comment/140055820
type: AnswerComment
comment on: http://stackoverflow.com/a/79398500
has text: 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.
type: Comment
score: 1

http://stackoverflow.com/comment/140017454
comment on: http://stackoverflow.com/q/79393939
has text: 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.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/140068872
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/79420032
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139874376
has text: 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.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/79318877
type: AnswerComment

luac
tag name: luac
tags question: http://stackoverflow.com/q/79283384
tags question: http://stackoverflow.com/q/79270435
type: Tag

http://stackoverflow.com/q/79278778
answer count: 1
type: UnansweredQuestion
has body: 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). 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). 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. I don't see question in stack overflow of how to achieve that.
score: 0
tagged with: wireshark-dissector
type: Question
tagged with: lua
has title: Adding variable length int/float/string array fields to subtree in lua dissector
has answer: http://stackoverflow.com/a/79278985

http://stackoverflow.com/comment/139889537
comment on: http://stackoverflow.com/a/79328257
type: AnswerComment
has text: This seems to work! Thank you!
type: Comment
score: 0

http://stackoverflow.com/comment/140025577
type: Comment
has text: 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.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/79399780

http://stackoverflow.com/comment/139813086
type: Comment
comment on: http://stackoverflow.com/q/79284034
type: QuestionComment
score: 0
has text: Its to avoid cyclical dependencies of shared ptr. But I dont get the problem Lua has with it. I'm completely new to Lua.

http://stackoverflow.com/q/79346936
tagged with: lua
type: UnansweredQuestion
has body: (Luajit with Lua 5.1) When using debug.sethook(hookfunction, 'l') on code such as the following: 1: local x 2: local y 3: 4: local t = { 5: v1 = 1, v2 = 2, 6: v3 = 3, 7: v4 = x, 8: } 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. Additionally, it seems that code such as: local x = obj:f() is double counted when doing a simple line execution counting hook function such as: local hookfunction = function(event, line) executioncount[line] = executioncount[line] + 1 end 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. To save on time for those responding, I am aware that local x local y could be rewritten as local x, y and this would address one of the issues, but I don't want to place unnecessary restrictions on coding styles with my coverage library.
score: 0
type: Question
answer count: 0
has title: Lua Debug Hook line events not catching all lines

http://stackoverflow.com/q/79353612
tagged with: neovim
score: 1
has title: How to stop JDTLS quitting ("Exit code 13 and signal 0") every time I open a java file in neovim?
tagged with: nvim-lspconfig
has body: I am fairly new to using neovim and set things up with kickstart.nvim. 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 "Exit code 13 and signal 0". Here's were I've got to with my mason stuff (please see my full init.lua and config for context): local servers = { lua_ls = { settings = { Lua = { runtime = { version = 'LuaJIT' }, workspace = { checkThirdParty = false, library = { '${3rd}/luv/library', unpack(vim.api.nvim_get_runtime_file('', true)), }, }, completion = { callSnippet = 'Replace', }, }, }, }, jdtls = { root_dir = vim.fs.dirname(vim.fs.find({ 'gradlew', '.git', 'mvnw' }, { upward = true })[1]), }, angularls = {}, html = {}, ts_ls = {}, } vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } require('java').setup {} require('mason-lspconfig').setup { handlers = { function(server_name) local server = servers[server_name] or {} server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) require('lspconfig')[server_name].setup(server) end, }, ensure_installed = ensure_installed, automatic_installation = true, } end, }, Here is the output in the lsp log file: [START][2025-01-13 22:21:45] LSP logging initiated [ERROR][2025-01-13 22:21:45] .../vim/lsp/rpc.lua:770 "rpc" "/Users/hopecah/.local/share/nvim/mason/bin/java" "stderr" "WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign\n" [ERROR][2025-01-13 22:21:45] .../vim/lsp/rpc.lua:770 "rpc" "/Users/hopecah/.jenv/versions/21.0.3/bin/java" "stderr" "Disabling server log output. No more output will be sent after this.\n" [ERROR][2025-01-13 22:21:46] .../vim/lsp/rpc.lua:770 "rpc" "/Users/hopecah/.local/share/nvim/mason/bin/java" "stderr" "Jan 13, 2025 10:21:46 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.clas…
type: Question
has answer: http://stackoverflow.com/a/79464987
tagged with: eclipse-jdt
downvote count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139942713
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/140031081
answer count: 1
type: UnansweredQuestion
favorite count: 0

http://stackoverflow.com/comment/140063344
score: 0
type: QuestionComment
has text: @Ivo it's not the same since I'm not using unpack as a function argument, but as a table entry.
comment on: http://stackoverflow.com/q/79420032
type: Comment

http://stackoverflow.com/q/79350389
has comment: http://stackoverflow.com/comment/139936215
tagged with: love2d
has comment: http://stackoverflow.com/comment/139930574
has comment: http://stackoverflow.com/comment/139933398
has title: How can I correctly distribute cars across slots based on probabilistic assignment in Lua?
type: UnansweredQuestion
favorite count: 0
score: 0
tagged with: probability-distribution
tagged with: probability
answer count: 0
tagged with: random
has comment: http://stackoverflow.com/comment/139941150
tagged with: lua
has comment: http://stackoverflow.com/comment/139939697
has body: 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. Here’s the function I’ve implemented to calculate the probability for each slot index: local function generateSlotIndex(totalCars, totalSlots) local sum = 0 local r = math.random() -- generate a random number local result for k = 1, totalSlots do local prob = 1 -- calculate the probability for the current index for i = 1, k - 1 do prob = prob * (totalSlots - totalCars - i + 1) / (totalSlots - i + 1) end prob = prob * totalCars / (totalSlots - k + 1) -- adjust the probability for the k-th index sum = sum + prob -- accumulate the probability if r <= sum and not result then result = k -- set result to k if random number is less than or equal to the accumulated probability end if sum >= 1 then break end -- stop if accumulated probability reaches 1 end return result end The function generateSlotIndex generates a random index for a slot based on the number of remaining cars and remaining slots. I also have a function getSlots that runs the slot assignment process for all cars: local function getSlots(totalCars, totalSlots) local slotIndex = 0 -- initialize the slot index local restCars = totalCars -- remaining cars to assign local restSlots = totalSlots -- remaining slots to assign local slots = {} -- table to store the assigned slots for carIndex = 1, totalCars do local index = generateSlotIndex(restCars, restSlots) -- generate a random slot index slotIndex = slotIndex + index slots[slotIndex] = 1 -- assign the slot index to the list restCars = restCars - 1 -- decrease the number of remaining cars restSlots = restSlots - index -- decrease the number of remaining slots end return slots -- return the list of assigned slots end The problem I am facing is ensuring that cars are distributed across the slots with the correct probabilistic weighting. In some cases…
downvote count: 1
type: Question
upvote count: 1

http://stackoverflow.com/a/79356474
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79356193
answers question: http://stackoverflow.com/q/79356193
has body: A capture cannot be made to repeat within a single application of a pattern. Instead, capture everything between your phrases, then use string.gmatch to pull out each substring. local s = "do()mul(41,51)mul(1,1)don't()" local m = s:match("do%(%)(.*)don't%(%)") if m then for v in m:gmatch("mul%(%d+,%d+%)") do print(v) end end mul(41,51) mul(1,1)
upvote count: 2

http://stackoverflow.com/a/79393308
has body: According to auth/signer documentation: 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. 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. 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. This means that auth/signer 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. Your config is far from being correct, as it is specifying arguments that auth/signer does not understand at all Having said that, there are a couple approaches you may want to consider: Wrapping a token endpoint Just following the documentation examples, you can wrap your own login endpoint (if available) to sign the response into a JWT. 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: https://www.krakend.io/docs/enterprise/endpoints/sequential-proxy/#content Using a body generator (enterprise) If you don't have a legacy login endpoint to wrap around, you can use a Krakend Enterprise modifier to generate a body based on a template. This generator could be configured in an "internal" Krakend endpoint and then wrapped by the auth/signer. Once this is done, it would be a matter of following the same sequential proxy approach described above
score: 0
type: Answer
answers question: http://stackoverflow.com/q/79383994

http://stackoverflow.com/comment/139843410
comment on: http://stackoverflow.com/q/79303030
type: Comment
score: 0
has text: 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.
type: QuestionComment

http://stackoverflow.com/comment/139818813
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/79261586
has text: @dalija Prasnikar why the answer was deleted,?

http://stackoverflow.com/a/79296448
has body: https://github.com/Subtixx/vscode-mtalua will need to update their extension. They are overriding the default source.lua scopeName instead of supplying their own. Should change it to something like source.lua.mta. You can manually fix it by going into the extension files. Update "scopeName": "source.lua" in both extensions\subtixx.mtasa-lua-2.3.6\syntaxes\mtalua.tmLanguage.json and extensions\subtixx.mtasa-lua-2.3.6\package.json
answers question: http://stackoverflow.com/q/79293179
score: 0
type: Answer

http://stackoverflow.com/comment/139774554
comment on: http://stackoverflow.com/a/79263823
score: 0
has text: Also `env UID=$UID lua foo.lua` and `lua -eUID=$UID foo.lua`.
type: AnswerComment
type: Comment

metaprogramming
type: Tag
tag name: metaprogramming
tags question: http://stackoverflow.com/q/79255304

http://stackoverflow.com/q/79268224
tagged with: neovim
score: 3
type: AnsweredQuestion
has title: Setting up denols to work along with tsls in kickstart neovim
answer count: 1
favorite count: 0
tagged with: windows-subsystem-for-linux
has body: I want to set up language server for my JS/TS project with Deno. I am using modular_kickstart which is a fork of kickstart neovim. I have put my config for deno in my lspconfig.nvim plugin file like so: -- LSP Plugins return { { -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins -- used for completion, annotations and signatures of Neovim apis 'folke/lazydev.nvim', ft = 'lua', opts = { library = { -- Load luvit types when the `vim.uv` word is found { path = 'luvit-meta/library', words = { 'vim%.uv' } }, }, }, }, { 'Bilal2453/luvit-meta', lazy = true }, { -- Main LSP Configuration 'neovim/nvim-lspconfig', dependencies = { -- Automatically install LSPs and related tools to stdpath for Neovim { 'williamboman/mason.nvim', config = true }, -- NOTE: Must be loaded before dependants 'williamboman/mason-lspconfig.nvim', 'WhoIsSethDaniel/mason-tool-installer.nvim', -- Useful status updates for LSP. -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` { 'j-hui/fidget.nvim', opts = {} }, -- Allows extra capabilities provided by nvim-cmp 'hrsh7th/cmp-nvim-lsp', }, config = function() -- Brief aside: **What is LSP?** -- -- LSP is an initialism you've probably heard, but might not understand what it is. -- -- LSP stands for Language Server Protocol. It's a protocol that helps editors -- and language tooling communicate in a standardized fashion. -- -- In general, you have a "server" which is some tool built to understand a particular -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone -- processes that communicate with some "client" - in this case, Neovim! -- -- LSP provides Neovim with features like: -- - Go to definition -- - Find references -- - Autocompletion -- - Symbol Search -- - and more! -- -- Thus, Language Servers are external tools that must be installed separately from -- Neovim. This is where `mason` a…
upvote count: 3
tagged with: nvim-lspconfig
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/79276795
accepted answer: http://stackoverflow.com/a/79276795
tagged with: lua

http://stackoverflow.com/comment/139843875
type: QuestionComment
comment on: http://stackoverflow.com/q/79303141
score: 0
has text: Can't reproduce, https://onecompiler.com/lua/433wcz5hr, please provide a [mre].
type: Comment

http://stackoverflow.com/a/79369134
type: Answer
answers question: http://stackoverflow.com/q/79369109
has body: 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. 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.
score: 0

http://stackoverflow.com/a/79386188
score: 3
has body: 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. Currently your limited to about one lines worth of text. All those variables need to tally in the trailer. Thus I suggest you adapt slightly to use this basic structure. %PDF-1.4 1 0 obj &lt;&lt;/Type/Catalog/Pages 2 0 R&gt;&gt; endobj 2 0 obj &lt;&lt;/Type/Pages/Count 1/Kids [3 0 R]&gt;&gt; endobj 3 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 4 0 obj &lt;&lt;/Type/Font/Subtype/Type1/BaseFont/Helvetica&gt;&gt; endobj 5 0 obj &lt;&lt;/Length 6 0 R&gt;&gt; stream BT /F1 20 Tf 100 700 Td (Something or nothing line 1) Tj ET ...line 2... ...line 3... etc. ... etc. endstream endobj 6 0 obj ..$Length.. endobj xref 0 7 0000000000 65535 f 0000000009 00000 n 0000000054 00000 n 0000000106 00000 n 0000000219 00000 n 0000000282 00000 n 0.$length+ 00000 n trailer &lt;&lt;/Root 1 0 R/Size 7&gt;&gt; startxref .$Above+20. %%EOF So to add lines it is simpler, beware this is NOT correct syntax just proves the method works! The difference is we add the stream length after the data stream and only alter the fewest variable entries. 5 0 obj &lt;&lt;/Length 6 0 R&gt;&gt; stream q 0 g BT /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 BT 1 0 0 1 50 660 Tm (FID: 18, IDType: something, CID: controller, Name: Spot Moving Head, Mode: Advanced, Uaddrs: 2.101) Tj ET BT 1 0 0 1 50 620 Tm (FID: 19, IDType: example, CID: another, Name: Wash Light, Mode: Standard, Uaddrs: 3.401) Tj ET BT 1 0 0 1 50 580 Tm (FID: 20, IDType: , CID: , Name: , Mode: , Uaddrs: 0.000) Tj ET Q endstream endobj 6 0 obj 0469 endobj xref 0 7 0000000000 65536 f 0000000009 00000 n 0000000054 00000 n 0000000105 00000 n 0000000217 00000 n 0000000280 00000 n 0000000800 00000 n trailer &lt;&lt;/Size …
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79386149
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/79386149

http://stackoverflow.com/a/79428838
upvote count: 1
has body: If you are getting an infinite yield warning, it is Because carsFolder refers to the Workspace variable, which is game:GetService('Workspace'). Change it to ReplicatedStorage or ServerStorage depending on what you are using. After this, make sure you are changing the car parent to the workspace so that it spawns in correctly.
answers question: http://stackoverflow.com/q/79395710
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/79319171
accepted answer of: http://stackoverflow.com/q/79318816
answers question: http://stackoverflow.com/q/79318816
downvote count: 0
has comment: http://stackoverflow.com/comment/139874178
has body: Here is what I am getting out of this: 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: mouse.Move:Connect(function() print("moved") tower:MoveTo(mouse.Hit) print(towerHum.CFrame) print(mouse.Hit) end) 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!
type: AcceptedAnswer
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/139930574
has text: 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?
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/79350389
type: Comment

http://stackoverflow.com/comment/139803804
has text: @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.
score: 1
comment on: http://stackoverflow.com/a/79276795
type: Comment
type: AnswerComment

http://stackoverflow.com/q/79267713
has comment: http://stackoverflow.com/comment/139779487
favorite count: 0
downvote count: 0
answer count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/139780064
linked to: http://stackoverflow.com/q/6139684
type: Question
duplicate of: http://stackoverflow.com/q/6139684
has title: Index lua table with table
type: UnansweredQuestion
upvote count: 1
has body: if I have an x and y I want the following to print 6(without making a string or combining the numbers into one): a = {} a[{1, 2}] = 6 print(a[{1, 2}]) -- nil unfortunately lua uses the address of the table as keys instead of the value and since the two {1, 2} tables have different addresses it prints nil I've looked at the lua book, reddit and stack overflow without success. The following also doesn't work, because it only takes the first value of the unpacked table as the key: a = {} a[table.unpack({1, 2})] = 6 print(a[table.unpack({1, 2})]) -- 6 print(a[1]) -- 6 Is there a nice way to do this(again without making a string or combining the numbers)?
score: 1

istio-sidecar
tags question: http://stackoverflow.com/q/79358099
type: Tag
tag name: istio-sidecar

http://stackoverflow.com/a/79311441
answers question: http://stackoverflow.com/q/79310374
has comment: http://stackoverflow.com/comment/139857905
score: 0
type: Answer
has body: The code is mostly working, I just added: require("iupluaim") So I believe you don have all the dependancies. IUP is not enough, you need the IM library. You will need to link against: The library IM itself, at least libim.a and libz.a The Lua wrapper, for example libimlua54.a Obviously, on the C side, iupimlua_open need to be called somewhere.

http://stackoverflow.com/comment/139962915
type: QuestionComment
comment on: http://stackoverflow.com/q/79366750
score: 0
has text: isn't `a and a.b` equivalent to `a?.b` in C#?
type: Comment

http://stackoverflow.com/q/79310001
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79310029
answer count: 1
linked to: http://stackoverflow.com/q/78289418
score: 0
type: Question
accepted answer: http://stackoverflow.com/a/79310029
has body: local gridBox = iup.gridbox{ table.unpack(Instances), --Instances[1], --Instances[2], numcolumns = 3, alignment = "ACENTER", expand = "YES" } 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 "dynamically" Tried puting in the table directly with local gridBox = iup.gridbox{ Instances, numcolumns = 3, alignment = "ACENTER", expand = "YES" } and like already mentioned with Instances[1]
tagged with: iup
has title: IUPLUA Putting Elements into the .gridbox with table.unpack doesn't work
tagged with: lua

http://stackoverflow.com/comment/140062873
comment on: http://stackoverflow.com/q/79419434
type: Comment
has text: Maybe `"(.-)"%s+%-%s+(%C*)` is close enough to what you want.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139819465
type: AnswerComment
score: 1
has text: 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.
comment on: http://stackoverflow.com/a/79289781
type: Comment

http://stackoverflow.com/a/79408064
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/140042227
upvote count: 1
answers question: http://stackoverflow.com/q/79407984
has body: Your Lua configuration for Neovim key mappings looks correct. However, the issue with &lt;C-j&gt; and &lt;C-k&gt; not working in insert mode is likely due to terminal settings or conflicts with Neovim's built-in keybindings. Possible Issues &amp; Fixes: 1. Check Terminal Keybindings Some terminals (e.g., Alacritty, Kitty, or even default terminal emulators) might not send &lt;C-j&gt; and &lt;C-k&gt; correctly. You can check what keys are being sent using: :imap &lt;C-j&gt; :imap &lt;C-k&gt; If nothing appears, your terminal might be intercepting these keybindings. 2. Disable Default &lt;C-j&gt; and &lt;C-k&gt; Mappings Neovim has built-in behavior for &lt;C-j&gt; and &lt;C-k&gt; in insert mode (e.g., &lt;C-j&gt; might trigger a snippet expansion in some setups). Try adding this to ensure they work as expected: vim.api.nvim_del_keymap('i', '&lt;C-j&gt;') vim.api.nvim_del_keymap('i', '&lt;C-k&gt;') Then reapply your mappings: map('i', '&lt;C-h&gt;', '&lt;Left&gt;') map('i', '&lt;C-j&gt;', '&lt;Down&gt;') map('i', '&lt;C-k&gt;', '&lt;Up&gt;') map('i', '&lt;C-l&gt;', '&lt;Right&gt;') 3. Use vim.keymap.set Instead A more modern way to define key mappings in Neovim is using vim.keymap.set. Try replacing your mapping function with: vim.keymap.set('i', '&lt;C-h&gt;', '&lt;Left&gt;', { noremap = true, silent = true }) vim.keymap.set('i', '&lt;C-j&gt;', '&lt;Down&gt;', { noremap = true, silent = true }) vim.keymap.set('i', '&lt;C-k&gt;', '&lt;Up&gt;', { noremap = true, silent = true }) vim.keymap.set('i', '&lt;C-l&gt;', '&lt;Right&gt;', { noremap = true, silent = true }) 4. Debug Terminal Input To ensure your terminal sends the correct keys, run this inside Neovim: :map &lt;C-j&gt; :map &lt;C-k&gt; If nothing appears, your terminal might not be passing &lt;C-j&gt; and &lt;C-k&gt; to Neovim. 5. Alternative Keybindings If the issue persists, you can try different keybindings that are less likely to be intercepted: map('i', '&lt;C-n&gt;', '&lt;Down&gt;') -- Alternative for &lt;C…

http://stackoverflow.com/comment/139741452
type: QuestionComment
type: Comment
has text: Are you using a retina monitor? If you call `getMode` right after `setMode`, is the resolution also `1536x864`?
comment on: http://stackoverflow.com/q/79246572
score: 0

http://stackoverflow.com/q/79383994
has title: Krakend Community Edition - Generate a JWT token
has body: 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. The program that calls the endpoint must not be aware of the required JWT token. 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 This is my krakend.json endpoint { "@comment": "Test all the open zaken based on bsn", "endpoint": "/debug/{bsn}/zaken", "method": "GET", "backend": [ { "url_pattern": "/__debug/zaken/api/v1/zaken", "method": "GET", "host": ["http://localhost:8080"], "extra_config": { "auth/signer": { "alg": "HS256", "signature-key": "<the secret>", "disable_jwk_security": false, "header": { "typ": "JWT", "alg": "HS256" }, "payload": { "iss": "<the client_id>", "iat": "{{time.now}}", "client_id": "<the client_id>", "user_id": "<user id>", "user_representation": "<user representation>" } }, "modifier/martian": { "fifo.Group": { "scope": ["request"], "aggregateErrors": true, "modifiers": [ { "header.Append": { "scope": ["request"], "name": "Accept-Crs", "value": "EPSG:4326" }}, { "header.Append": { "scope": ["request"], "name": "Content-Crs", "value": "EPSG:4326" }} ] } } } } ] } The debug logging shows the following: ▶ DEBUG [ENDPOINT: /__debug/*] Method: GET ▶ DEBUG [ENDPOINT: /__debug/*] URL: /__debug/zaken/api/v1/zaken ▶ DEBUG [ENDPOINT: /__debug/*] Params: [{param /zaken/api/v1/zaken}] ▶ 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]] ▶ DEBUG [ENDPOINT: /__debug/*] Body: As you can see there is no Authorization header. I've also tried it with LUA scripts but because I can't 'require' the library luajwtjitsi I can not generate…
type: UnansweredQuestion
tagged with: krakend
answer count: 1
score: 0
type: Question
tagged with: jwt
has answer: http://stackoverflow.com/a/79393308
tagged with: lua

http://stackoverflow.com/q/79255304
accepted answer: http://stackoverflow.com/a/79257991
tagged with: metaprogramming
downvote count: 0
has body: In JavaScript, you can make an object that is callable like this: const prox = new Proxy(function() {}, { get(target, key) { return true } apply(target, that, argList) { console.log('This came from a proxy') } }) prox() // This came from a proxy console.log(prox.name) // true 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. local function describe() -- ... end function describe.skip() -- ... end This doesn't work because a function isn't a table. Ideally this would be possible: local describe = {} function describe.__apply() -- ... end function describe.skip() -- ... end describe() describe.skip()
tagged with: lua
has answer: http://stackoverflow.com/a/79257991
score: 1
type: AnsweredQuestion
answer count: 1
upvote count: 1
favorite count: 0
type: Question
has title: JavaScript's proxy.apply handler in Lua

http://stackoverflow.com/comment/140042250
has text: this also did not work. they did not raise any errors but silently failed or something
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79408046

colors
tag name: colors
type: Tag
tags question: http://stackoverflow.com/q/79307097

copas
tag name: copas
type: Tag
tags question: http://stackoverflow.com/q/79417967

http://stackoverflow.com/comment/139910389
type: Comment
comment on: http://stackoverflow.com/q/79338135
type: QuestionComment
score: 0
has text: please provide code section as a text not as an image

http://stackoverflow.com/a/79370282
answers question: http://stackoverflow.com/q/79370237
score: 2
has body: When the argument is a string or table, you can omit parentheses, which is specified by Lua, but in other cases parentheses must be used. local mod_action = require(moduletoload)
upvote count: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79370237
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/140077460
type: Comment
comment on: http://stackoverflow.com/q/79394748
has text: 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.
score: 0
type: QuestionComment

http://stackoverflow.com/a/79310029
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/79310001
answers question: http://stackoverflow.com/q/79310001
type: Answer
has body: Do this instead: local gridBox = iup.gridbox{ numcolumns = 3, alignment = "ACENTER", expand = "YES", table.unpack(Instances) } 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 my answer to this other question.

http://stackoverflow.com/a/79278985
has body: Assuming a protocol listener pattern, you can simply add to obtain a subtree and then add in a loop the values, for example: function DecoderListener:setParameter(widgetID, paramID, value) if (type(value) == "table") then local array_tree = self.subtree:add(paramID) if #value >= 1 then for i, value0 in ipairs(value) do self:setArrayParameter(array_tree, value0, i) end end end end function DecoderListener:setArrayParameter(array_tree, value, index) local real_value = value:getValue() -- this can handle int/float/string real values array_tree:add(real_value) end This will result in folding elements in Wireshark with all the values you have speficied.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/79278778

immutability
tags question: http://stackoverflow.com/q/79343722
tag name: immutability
type: Tag

http://stackoverflow.com/comment/139888624
comment on: http://stackoverflow.com/q/79328249
type: Comment
score: 1
has text: 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)
type: QuestionComment

http://stackoverflow.com/a/79399780
score: 3
has comment: http://stackoverflow.com/comment/140025577
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79398648
type: AcceptedAnswer
type: Answer
upvote count: 3
has body: This commit removed isPacked(quint32) and put a static isRowCol() in its place. I suggest you just stub it out: static bool isPacked(quint32) { return true; } or revert your LjTools repository to commit 350dfbb245e2e706670c7bba716a8eede8bd4938.
answers question: http://stackoverflow.com/q/79398648

http://stackoverflow.com/comment/139962427
type: Comment
has text: Lua doesn't even have `++` or `+=`, yet you ask for null conditional operator? This is too ahead of its time.
score: 1
comment on: http://stackoverflow.com/q/79366750
type: QuestionComment

http://stackoverflow.com/comment/139767618
score: 0
type: QuestionComment
has text: 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
comment on: http://stackoverflow.com/q/79261190
type: Comment

http://stackoverflow.com/a/79320920
type: AcceptedAnswer
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/79320906
downvote count: 0
answers question: http://stackoverflow.com/q/79320906
score: 1
has body: Standard input is FD 0, not FD 1, so do uv.new_poll(0) instead of uv.new_poll(1). 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.

http://stackoverflow.com/a/79408046
has comment: http://stackoverflow.com/comment/140052267
has comment: http://stackoverflow.com/comment/140043398
answers question: http://stackoverflow.com/q/79407984
type: Answer
has body: Try with: local opts = { noremap = true, silent = true } vim.keymap.set ("i", "<c-h>", "<left>", opts) vim.keymap.set ("i", "<c-j>", "<down>", opts) vim.keymap.set ("i", "<c-k>", "<up>", opts) vim.keymap.set ("i", "<c-l>", "<right>", opts) I'd recommend you to run nvim --clean and then set each keymap manually in command mode, because they might be conflicting with plugin keymaps, for example: :lua vim.keymap.set ("i", "<c-l>", "<right>", { noremap = true, silent = true }) or write all the keymaps in a lua file and source.
has comment: http://stackoverflow.com/comment/140042250
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/139942713
type: Comment
score: 0
comment on: http://stackoverflow.com/q/79353612
type: QuestionComment
has text: 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

http://stackoverflow.com/q/79307097
has answer: http://stackoverflow.com/a/79307172
has body: 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 "texture", 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) Firstdraw = true function param1() -- minimum, maximum, default value return "random" , 0 , 100 , 2 end function main(x, y, p) if Firstdraw then r, g, b = bs_fore() luminance = (r * 0.3) + (g * 0.59) + (b * 0.11) luminanceStart = luminance if luminance <= 28 then blue = math.random(0, luminance/0.11) elseif luminance >= 227 then blue = math.random((luminance-227)/0.11, 255) else blue = math.random(0, 255) end luminance = luminance - blue*0.11 if luminance <= 76 then red = math.random(0, luminance/0.3) elseif luminance >= 179 then red = math.random((luminanceStart-179)/0.3, 255) else red = math.random(0, 255) end luminance = luminance - red*0.3 green = luminance/0.59 if green > 255 then green = 255 end luminanceEnd = (red * 0.3) + (green * 0.59) + (blue * 0.11) local sx = tostring(luminanceStart) local sv = tostring(luminanceEnd) local sy = tostring(red) local sp = tostring( green) local sd = tostring( blue) bs_debug_log( "sx: " .. sx .. " sv: " .. sv .. " sy: " .. sy .. " sp: " .. sp.. " sd: " .. sd ) bs_debug_log("") end local width = bs_width() 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 local opacity = bs_opaque() * 255 bs_ellipse(x, y, width, width, 0, red, green, blue, opacity) Firstdraw = false return 1 end 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…
tagged with: lua
tagged with: drawable
type: UnansweredQuestion
score: 0
tagged with: brush
tagged with: drawing
answer count: 1
tagged with: colors
has title: How do I fix a bias when attempting to make a random colour in a Firealpaca brush script?
type: Question

http://stackoverflow.com/comment/139950148
type: Comment
has text: Still not solved. It is still producing inconsistent random strings. Check my updated Lua code.
comment on: http://stackoverflow.com/a/79360347
type: AnswerComment
score: 0

http://stackoverflow.com/a/79464987
answers question: http://stackoverflow.com/q/79353612
downvote count: 0
type: Answer
has body: I had the same issue. You have to update your Java to version &gt;=21.
score: 2
upvote count: 2

http://stackoverflow.com/a/79322777
type: Answer
downvote count: 0
has body: None of those patterns do what you think they do. Parentheses aren't special inside of classes, so Animal=[(Dog)(Cat)] is the same as Animal=[()CDagot]. So it was never matching your whole string, but rather just Animal=C and Animal=D, 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 find to match what the regex Animal=(Dog|Cat) would match. You need to either modify your code to not rely on a single find, or get and use a library like LPeg to do the matching instead.
score: 1
answers question: http://stackoverflow.com/q/79322739
upvote count: 1

http://stackoverflow.com/a/79379807
type: Answer
score: 0
answers question: http://stackoverflow.com/q/79368261
has body: Usually, weird physics bugs tend to be caused by network ownership issues. 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. So to fix this issue, you need to either : a) Create the objects you plan to destroy in LocalScripts, or b) Use RemoteEvents to destroy the objects on the server. I'll explain Option B. So you'll to... Create a RemoteEvent in ReplicatedStorage, and name it something like ShootEvent Create a Script in ServerScriptService Move all of your bullet logic into the Script Have your LocalScript fire the RemoteEvent instead Connect your Script to the RemoteEvent to spawn the bullet the client fires the event. So in your LocalScript... local player = game.Players.LocalPlayer local mouse = player:GetMouse() local gui = player.PlayerGui:WaitForChild("GameGui") local shootEvent = game.ReplicatedStorage.ShootEvent local targetImage = gui:WaitForChild("Target") local shootCooldown = 1 local lastShootTime = 0 targetImage.Visible = false -- listen for mouse clicks mouse.Button1Down:Connect(function() -- escape if we're on cooldown local currentTime = tick() if currentTime - lastShootTime < shootCooldown then return end -- update the ui targetImage.Visible = true task.delay(0.3, function() targetImage.Visible = false end) -- figure out what we're aiming at local mousePosition = Vector2.new(mouse.X, mouse.Y) targetImage.Position = UDim2.new(0, mousePosition.X - (targetImage.Size.X.Offset / 2), 0, mousePosition.Y - (targetImage.Size.Y.Offset / 2)) local ray = workspace.CurrentCamera:ScreenPointToRay(mouse.X, mouse.Y) local rayTarget = ray.Origin + ray.Direction * 500 local raycastParams = RaycastParams.new() raycastParams.F…

http://stackoverflow.com/comment/139885617
type: QuestionComment
has text: How is this question related to the Java programming language, as *suggested* by the [tag:java] tag added to the question ?
comment on: http://stackoverflow.com/q/79326633
score: 2
type: Comment

http://stackoverflow.com/comment/140063495
type: QuestionComment
comment on: http://stackoverflow.com/q/79420032
score: 2
has text: It is the same. See this: https://stackoverflow.com/questions/79179000/repacking-or-printing-unpacked-lua-tables/79179832#79179832.
type: Comment

http://stackoverflow.com/comment/139846590
score: 0
type: AnswerComment
has text: exactly. you need a dota instead a colon when calling the parent constructor
comment on: http://stackoverflow.com/a/79304674
type: Comment

http://stackoverflow.com/comment/140055802
type: AnswerComment
score: 1
has text: 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).
type: Comment
comment on: http://stackoverflow.com/a/79398500

drawable
type: Tag
tags question: http://stackoverflow.com/q/79307097
tag name: drawable

http://stackoverflow.com/a/79249530
upvote count: 3
has body: 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: t.window.fullscreentype = 'exclusive'
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/79246572
score: 3

luacom
tags question: http://stackoverflow.com/q/79259465
type: Tag
tag name: luacom

http://stackoverflow.com/comment/139922113
comment on: http://stackoverflow.com/a/79345720
type: Comment
has text: 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?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/139941150
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/79350389
has text: 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.

istio-prometheus
tags question: http://stackoverflow.com/q/79358099
tag name: istio-prometheus
type: Tag

http://stackoverflow.com/comment/139741439
comment on: http://stackoverflow.com/q/79246572
type: Comment
score: 0
type: QuestionComment
has text: 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?

http://stackoverflow.com/comment/139819597
type: AnswerComment
has text: 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)
comment on: http://stackoverflow.com/a/79289781
type: Comment
score: 0

getenv
tags question: http://stackoverflow.com/q/79263801
type: Tag
tag name: getenv

http://stackoverflow.com/comment/140043388
score: 1
comment on: http://stackoverflow.com/q/79409178
type: Comment
has text: 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?
type: QuestionComment

http://stackoverflow.com/comment/139832590
comment on: http://stackoverflow.com/q/79297042
type: Comment
has text: 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).*"
score: 0
type: QuestionComment

http://stackoverflow.com/comment/139819571
type: Comment
comment on: http://stackoverflow.com/a/79289781
score: 0
type: AnswerComment
has text: `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.

dialplan
tag name: dialplan
tags question: http://stackoverflow.com/q/79246582
type: Tag

http://stackoverflow.com/comment/139932002
has text: @Beso I added the code
type: Comment
score: 0
comment on: http://stackoverflow.com/q/79338135
type: QuestionComment

http://stackoverflow.com/q/79349925
type: UnansweredQuestion
has body: I'm writing a neovim plugin. I want json decoding to fail silently. This is what I have tried: partial_chunk = partial_chunk .. chunk pcall(function() -- vim.defer_fn(function() local data = vim.fn.json_decode(partial_chunk .. &quot;]&quot;) on_next_line(data[#data].candidates[1].content.parts[1].text) -- end, 0) end) do_some_stuff() This gives me the error that I can't call a vimscript function in a fast event context. I have tried wrapping the json_decode in vim.defer_fn but that doesn't work - i start seeing the errors. I'm looking for a way to basically ignore whenever json_decode fails.
tagged with: neovim-plugin
has title: How do I use pcall with vimscript functions?
tagged with: neovim
score: 0
type: Question
answer count: 0
tagged with: lua

http://stackoverflow.com/a/79253063
answers question: http://stackoverflow.com/q/79250441
score: 0
type: Answer
has body: 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. How to add an array of fields as a ProtoField in Lua Dissector

http://stackoverflow.com/a/79311707
score: 0
type: Answer
has body: The native button has some limitations regarding the background color. See the BGCOLOR attribute documentation: BGCOLOR: Background color. If text and image are not defined, the button is configured to simply show a color, in this case set the button size because the natural size will be very small. In Windows and in GTK 3, the BGCOLOR attribute is ignored if text or image is defined.
answers question: http://stackoverflow.com/q/79310374

http://stackoverflow.com/comment/139933398
score: 1
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/79350389
type: QuestionComment

http://stackoverflow.com/a/79316568
accepted answer of: http://stackoverflow.com/q/79316557
score: 0
answers question: http://stackoverflow.com/q/79316557
has body: From the snippet you have provided, it seems like your code does not even run properly since there are errors like: Typos in variable: secconds = 59 Lua does not have operator +=. Instead use: seconds = seconds + 1 There might be another problem. When you search for money. leaderstats:FindFirstChild("Effect It returns reference to object. When you want to change the object you have to access its property or method. I have never programmed anything in roblox, but i have found in documentation reference to text label. It contains property named "ContentText", what means you can change money by doing this: money.ContentText = "money value" Link to documentation
type: AcceptedAnswer
type: Answer

set
tags question: http://stackoverflow.com/q/79328249
tag name: set
type: Tag

brush
type: Tag
tags question: http://stackoverflow.com/q/79307097
tag name: brush

http://stackoverflow.com/a/79326731
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/79326633
type: Answer
has body: NO, it's impossible. v0 and v1 are always the same value. When running Lua script, the time freezes, which means a key expires the first time it's checked, otherwise it's never expired during the execution of the script.
downvote count: 0

http://stackoverflow.com/comment/139919585
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/79344006
has text: @ggg123 Can you clarify the question then?
type: Comment

protofield
tag name: protofield
type: Tag
tags question: http://stackoverflow.com/q/79250441

http://stackoverflow.com/a/79420312
score: 2
downvote count: 2
accepted answer of: http://stackoverflow.com/q/79419434
answers question: http://stackoverflow.com/q/79419434
upvote count: 4
has body: You are trying to use regular expression instead of a Lua pattern with gmatch, which is a problem. Just FYI: .*? - is a non-greedy pattern that looks like (almost) .- in Lua patterns (the difference is that . in Lua matches ALL characters including newline and carriage returns, while in regex, it needs specific option to enable matching line breaks) \s - a whitespace matching pattern looks like %s in Lus patterns {1,} - one or more repetition must be written as + in Lua patterns, as limiting quantifiers are not supported. You can use "(.-)"%s+-%s NOTE: I removed the last (.*) because you only need the part in between the double quotes, and the .* will simply capture all text after the first double quoted substring. Details " - a " char (.-) - Capturing group 1: any zero or more chars (including line break chars), as few as possible " - a " char %s+ - one or more whitespace chars - - a hyphen %s - a whitespace char. See the online Lua demo: local s = Available configure presets: "x64-debug" - x64 Debug "x64-release" - x64 Release "x86-debug" - x86 Debug "x86-release" - x86 Release for word in string.gmatch(s, "(.-)"%s+-%s) do print(word) end Output: x64-debug x64-release x86-debug x86-release Now, if you need the part after -, you can simply match any chars as few as possible till the newline after appending a newline to your input string: for word1,word2 in string.gmatch(s .. string.char(10), "(.-)"%s+-%s(.-) .. string.char(10)) do print(word1 .. " <> " .. word2) end See this Lua demo: local s = Available configure presets: "x64-debug" - x64 Debug "x64-release" - x64 Release "x86-debug" - x86 Debug "x86-release" - x86 Release for word1,word2 in string.gmatch(s .. string.char(10), "(.-)"%s+-%s(.-) .. string.char(10)) do print(word1 .. " <> " .. word2) end Output: x64-debug <> x64 Debug x64-release <> x64 Release x86-debug <> x86 Debug x86-release <> x86 Release
type: AcceptedAnswer
type: Answer

cursor-ide
tags question: http://stackoverflow.com/q/79248704
tag name: cursor-ide
type: Tag

http://stackoverflow.com/comment/139875077
score: 1
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/79318877
type: AnswerComment

http://stackoverflow.com/comment/139801729
type: Comment
score: 1
has text: Thanks a lot. It really solved my problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/79276795

http://stackoverflow.com/comment/140042238
type: Comment
has text: when i tried to delete the key map it caused error because they were not already mapped,
comment on: http://stackoverflow.com/a/79408069
score: 0
type: AnswerComment

probability-distribution
type: Tag
tag name: probability-distribution
tags question: http://stackoverflow.com/q/79350389

shared-ptr
tags question: http://stackoverflow.com/q/79284034
tag name: shared-ptr
type: Tag

http://stackoverflow.com/comment/140052267
type: Comment
has text: my current Neovim version is v0.10.4
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/79408046

http://stackoverflow.com/a/79445755
answers question: http://stackoverflow.com/q/79291948
has body: To trigger a client event from the server, you need to use the player server ID, not his identifier. 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. RegisterNetEvent('ch_nui:kok') AddEventHandler('ch_nui:kok',function () local _source = source print('2') local identifier = GetPlayerIdentifierByType(source,'license') TriggerClientEvent('ch_nui:bob',_source) end) Here is the shortest way of doing it: RegisterNetEvent('ch_nui:kok',function () TriggerClientEvent('ch_nui:bob', source) end)
score: 0
type: Answer

eclipse-jdt
tag name: eclipse-jdt
type: Tag
tags question: http://stackoverflow.com/q/79353612

manhattan
type: Tag
tag name: manhattan
tags question: http://stackoverflow.com/q/79346707

diagram
type: Tag
tag name: diagram
tags question: http://stackoverflow.com/q/79346707

qt-creator
tags question: http://stackoverflow.com/q/79398648
type: Tag
tag name: qt-creator

protocols
type: Tag
tags question: http://stackoverflow.com/q/79261586
tag name: protocols

aerospike-ce
tags question: http://stackoverflow.com/q/79318506
tag name: aerospike-ce
type: Tag

monogame
tags question: http://stackoverflow.com/q/79413710
tag name: monogame
type: Tag

http://stackoverflow.com/q/79460373
tagged with: lua
type: Question
has body: Source code used here: https://github.com/omrilevia/lua-iso I've been playing around mapping screen coordinates to isometric coordinates and vice versa, following this tutorial: https://pikuma.com/blog/isometric-projection-in-games I have some basic vec2 and mat2 classes which know how to do dot products, scaling, transforms, and inverses: Vec2 = Object:extend() function Vec2:new(x, y) self.x = x self.y = y end function Vec2:dot(vec) return self.x * vec.x + self.y * vec.y end function Vec2:scale(scalar) self.x = scalar * self.x self.y = scalar * self.y return self end And the Mat2 class: (sorry for the terminology, I come from Java world) Mat2 = Object:extend() function Mat2:new(vec1, vec2) self.vec1 = vec1 self.vec2 = vec2 end function Mat2:transform(vec) local xPrime = self.vec1:dot(vec) local yPrime = self.vec2:dot(vec) return Vec2(xPrime, yPrime) end function Mat2:scale(scalar) self.vec1 = self.vec1:scale(scalar) self.vec2 = self.vec2:scale(scalar) return self end function Mat2:inverse() --d -b ---c a return Mat2(Vec2(self.vec2.y, -self.vec1.y), Vec2(-self.vec2.x, self.vec1.x)) :scale(1 / ((self.vec1.x * self.vec2.y) - (self.vec1.y * self.vec2.x))) end Here is the "Iso" class I use to transform from a game coordinate to a screen coord: Iso = Mat2:extend() function Iso:new(tileWidth, tileHeight) Iso.super:new(Vec2(1/2, -1/2):scale(tileWidth), Vec2(1/2, 1/2):scale(tileHeight)) end function Iso:transform(vec) return Iso.super:transform(vec) end function Iso:scale(scalar) return Iso.super:scale(scalar) end function Iso:inverse() return Iso.super:inverse() end That's the math stuff. As far as drawing tiles on the screen, I have a "Grid" class which arranges tiles in a 2d table, and tells them their game coordinate like (1, 1) up to (10, 10). The tiles themselves know how to draw themselves on the screen: require "src.model.GameObject" require "src.math2d.iso" Tile = GameObject:extend() function Tile:new(texId, pos) --texId 7 is broken if texId == 6 then texId…
has answer: http://stackoverflow.com/a/79460555
accepted answer: http://stackoverflow.com/a/79460555
score: 2
downvote count: 0
upvote count: 2
type: AnsweredQuestion
has title: Lua Love: Mapping from isometric screen coordinates to game coordinates results in "off by one" x-coord
tagged with: love2d
answer count: 1
tagged with: 2d-games
tagged with: isometric
favorite count: 0

http://stackoverflow.com/a/79443629
score: 1
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79423689
answers question: http://stackoverflow.com/q/79423689
upvote count: 1
has body: The solution was to close the pipe handles after creating the process. So if (!CreateProcess( NULL, filename, //TODO: check unicode? NULL, NULL, TRUE, 0, NULL, NULL, &si, pi) ) { printf("Could not create process\n"); return NULL; } CloseHandle(g_hChildStd_OUT_Wr); CloseHandle(g_hChildStd_IN_Rd); I guess because then only the child holds a handle to the resources, not the parent.

http://stackoverflow.com/q/79502556
tagged with: cl
score: 0
has title: Luarocks install luafilesystem: lua.lib does not match Lua version
has comment: http://stackoverflow.com/comment/140208764
has comment: http://stackoverflow.com/comment/140208504
type: UnansweredQuestion
has body: 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) 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. I downloaded 5.4.2 source files (+ Windows x64 executables and DLL) from: https://luabinaries.sourceforge.net/download.html Here is the Lua64 directory where the files are located: cd in cmd at 23:13:22 C:\Lua64 tree /f in cmd at 23:01:02 Folder PATH listing Volume serial number is B245-895E C:. │ lua.exe │ lua54.dll │ luac54.exe │ wlua54.exe │ ├───include │ lauxlib.h │ lua.h │ lua.hpp │ luaconf.h │ lualib.h │ └───src config.mak lapi.c lapi.h lauxlib.c lauxlib.h lbaselib.c lcode.c lcode.h lcorolib.c lctype.c lctype.h ldblib.c ldebug.c ldebug.h ldo.c ldo.h ldump.c lfunc.c lfunc.h lgc.c lgc.h linit.c liolib.c ljumptab.h llex.c llex.h llimits.h lmathlib.c lmem.c lmem.h loadlib.c lobject.c lobject.h lopcodes.c lopcodes.h lopnames.h loslib.c lparser.c lparser.h lprefix.h lstate.c lstate.h lstring.c lstring.h lstrlib.c ltable.c ltable.h ltablib.c ltm.c ltm.h lua.c lua.h lua.hpp lua.ico lua.mak lua.rc lua54.def luac.c luac.mak luaconf.h lualib.h lua_conf.mak lua_dll.rc lua_simple.rc lundump.c lundump.h lutf8lib.c lvm.c lvm.h lzio.c lzio.h Makefile Makefile.tecmake make_uname make_uname.bat tecmake.mak tecmakewin.mak wlua.mak wlua.rc wlua_x64.manifest wlua_x86.manifest wmain.c Compiled the files with the following commands: 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 lib /OUT:lua.lib src\*.obj When trying to install luafilesystem using luarocks, I get the following error: luarocks install luafilesystem in cmd at 22:46:54 Installing https://luarocks.org/luafilesystem-1.8.0-1.src.rock luafilesystem 1.8.0-1 depends on lua >= 5.1 (5.4-1 provided by VM: success) Error: Build error: Lua library at C:\Lua…
answer count: 0
tagged with: lua
tagged with: windows64
type: Question
tagged with: luafilesystem
tagged with: luarocks
has comment: http://stackoverflow.com/comment/140207610

hardware
tag name: hardware
type: Tag
tags question: http://stackoverflow.com/q/79432387

http://stackoverflow.com/comment/140211406
type: Comment
comment on: http://stackoverflow.com/q/79504829
has text: lua script worked perfectly too.
score: 0
type: QuestionComment

http://stackoverflow.com/q/79530243
type: Question
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/140255258
tagged with: lua
tagged with: roblox
has body: I got a problem where in my output it shows this: ServerScriptService.Main.Mob:28: attempt to index number with 'Spawner' This is my code: local ServerStorage = game:GetService("ServerStorage") local mob = {} function mob.Move(mob, map) -- Get the zombie's Humanoid local zombieHumanoid = script.Parent.Humanoid -- Create a function to check if the zombie is dead local function isZombieDead() return zombieHumanoid.Health <= 0 end -- Connect the Humanoid's Died event to the function zombieHumanoid.Died:Connect() -- Destroy the zombie when it's dead script.Parent:Destroy() end function mob.Spawn(name, quantity, map) local mobExists = game.ServerStorage.Mobs:FindFirstChild(name) if mobExists then for i=1 , quantity do task.wait(0.5) local newMob = mobExists:Clone() newMob.HumanoidRootPart.CFrame = map.Spawner.CFrame newMob.Parent = map.Mob coroutine.wrap(mob.Move)(newMob, map) end else warn("Requested mob does not exist:", name) end end return mob Can someone help me?? I tried to look for the solution but I didn't find a number with Spawner
score: 0
has comment: http://stackoverflow.com/comment/140256859
has title: Attempt to index number with 'Spawner'

http://stackoverflow.com/q/79423689
accepted answer: http://stackoverflow.com/a/79443629
has answer: http://stackoverflow.com/a/79443629
has title: Windows pipe hangs when fread on it
has comment: http://stackoverflow.com/comment/140074214
answer count: 1
tagged with: http://stackoverflow.com/tag/c
tagged with: winapi
favorite count: 0
upvote count: 3
tagged with: lua
type: Question
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/140089748
has body: I am trying to improve the Lua io.popen function to use the Win32 CreateProcess api. By default, it uses the libc popen function, which unfortunately spawns a terminal window on Windows even when running in a Desktop application. My approach is currently to copy https://github.com/lua/lua/blob/master/liolib.c, 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. So, originally the Lua file does this: #define l_popen(L,c,m) (_popen(c,m)) #define l_pclose(L,file) (_pclose(file)) I have replaced this by this code: static FILE* l_popen(lua_State *L, const char* filename, const char *mode, PROCESS_INFORMATION* pi) { ZeroMemory(pi, sizeof(PROCESS_INFORMATION)); HANDLE g_hChildStd_IN_Rd = NULL; HANDLE g_hChildStd_IN_Wr = NULL; HANDLE g_hChildStd_OUT_Rd = NULL; HANDLE g_hChildStd_OUT_Wr = NULL; SECURITY_ATTRIBUTES saAttr; ZeroMemory(&saAttr, sizeof(SECURITY_ATTRIBUTES)); saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; // Pipe for child process' STDOUT if (!CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0)) { printf("Error creating pipe\n"); return NULL; } if ( ! SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0) ) { printf("SOmething weird\n"); return NULL; } // Pipe for child process' STDIN if (!CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0)) { printf("Error creating pipe\n"); return NULL; } if ( ! SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) ) { printf("SOmething weird\n"); return NULL; } STARTUPINFO si; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); si.hStdError = g_hChildStd_OUT_Wr; si.hStdOutput = g_hChildStd_OUT_Wr; si.hStdInput = g_hChildStd_IN_Rd; si.dwFlags |= STARTF_USESTDHANDLES; if (!CreateProcess( NULL, filename, //TODO: check unicode…
type: AnsweredQuestion

http://stackoverflow.com/comment/140089748
comment on: http://stackoverflow.com/q/79423689
has text: Thanks so much! Such a small thing which kept me busy for days...! Thanks a lot :)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/79488085
answer count: 0
has comment: http://stackoverflow.com/comment/140202789
has title: lua_ls not working when opening .lua file from startup
tagged with: neovim
type: Question
upvote count: 1
downvote count: 0
type: UnansweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/140187096
tagged with: lua
has comment: http://stackoverflow.com/comment/140187868
score: 1
has body: The lua-language-server not started while opening a .lua file from startup using nvim a.lua. :LspInfo showing 0 client(s) attached to this buffer. But it works when switching to another .lua file: :e b.lua. Only lua_ls with this problem. Other lsp servers (gopls, jsonls, bashls, pylsp) works well. I use lazy.nvim and mason. Here's my lsp config. I can't figure it out. Anyone have any idea? lua/plugins/lsp.lua: return { { 'neovim/nvim-lspconfig', dependencies = { "williamboman/mason.nvim", "williamboman/mason-lspconfig.nvim", 'hrsh7th/cmp-nvim-lsp', }, priority = 900, config = function() require("mason").setup() require("mason-lspconfig").setup({ ensure_installed = { "gopls", "lua_ls", "html", "jsonls", "yamlls", "pylsp", "bashls", "clangd", "ts_ls", "volar", } }) -- Set up lspconfig. -- Enable each lsp servers. local capabilities = require('cmp_nvim_lsp').default_capabilities() -- go require('lspconfig')['gopls'].setup({ capabilities = capabilities }) -- lua require('lspconfig')['lua_ls'].setup({ capabilities = capabilities }) -- html require('lspconfig')['html'].setup({ capabilities = capabilities }) -- json require('lspconfig')['jsonls'].setup({ capabilities = capabilities }) -- yaml require('lspconfig')['yamlls'].setup({ capabilities = capabilities }) -- python require('lspconfig')['pylsp'].setup({ capabilities = capabilities, settings = { pylsp = { plugins = { pycodestyle = { ignore = { 'E501' }, } } } } }) -- bash require('lspconfig')['bashls'].setup({ capabilities = capabilities }) -- clang require('lspconfig')['clangd'].setup({ capabilities = capabilities, filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, }) -- typescript require('lspconfig')['ts_ls'].setup({ capabilities = capabilities, init_options = { plugins = { { name = "@vue/typescript-plugin", location = "/opt/homebrew/lib/node_modules/@vue/typescript-plugin", languages = { "javascript", "typescript", "vue" }, }, }, }, filetypes = { "javascript", "typescript", "vue", }, }) -- volar (for vue) requir…

http://stackoverflow.com/q/79513489
type: Question
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9790688
duplicate of: http://stackoverflow.com/q/9790688
has body: old_saving_throw = "IF(not SavingThrow(Ability.Constitution, 12,AdvantageOnPoisoned(),DisadvantageOnPoisoned())):ApplyStatus(STUNNED,100, 2)" old_params = "Ability.Constitution, 12,AdvantageOnPoisoned(),DisadvantageOnPoisoned()" new_params = "Ability.Constitution, 12, AdvantageOnPoisoned() | AdvantageOnStunned(), DisadvantageOnPoisoned() | DisadvantageOnStunned()" local modified_saving_throw = string.gsub(old_saving_throw, old_params, new_params) print("Modified string: ", modified_saving_throw) 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: "IF(not SavingThrow(Ability.Constitution, 12, AdvantageOnPoisoned() | AdvantageOnStunned(), DisadvantageOnPoisoned() | DisadvantageOnStunned())):ApplyStatus(STUNNED,100, 2)" 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)
has comment: http://stackoverflow.com/comment/140227806
has comment: http://stackoverflow.com/comment/140227816
score: 0
answer count: 0
has title: Why is my string.gsub not working ? (Lua)
tagged with: lua

http://stackoverflow.com/q/79525645
score: 3
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/79525732
accepted answer: http://stackoverflow.com/a/79525732
has body: 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: sol::state _interpreter; _interpreter.open_libraries(sol::lib::base, sol::lib::math); _interpreter.new_usertype<PriceData> ( "PriceData", sol::constructors<PriceData(PriceData pd)>(), "best_bid", &PriceData::best_bid, "best_ask", &PriceData::best_ask ); std::string script = R"( function check_condition(price_update) print(price_update) return true end )"; auto load_result = _interpreter.load(script); if (!load_result.valid()) throw std::runtime_error(std::format("Failed to load condition inspector. Error: {}", sol::error{load_result}.what())); auto f = load_result.get<sol::function>(); PriceData pd(106.0, 107.0); f(pd) The struct delcared like this. struct PriceData { double best_bid = 0.0; double best_ask = 0.0; }; inline bool operator == (const PriceData& lhs, const PriceData& rhs) { return lhs.best_bid == rhs.best_bid && lhs.best_ask == rhs.best_ask; } 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. [sol2] An error occurred and panic has been invoked: stack index 2, expected userdata, received no value: value is not a valid userdata unknown file: Failure C++ exception with description "lua: error: stack index 2, expected userdata, received no value: value is not a valid userdata " thrown in the test body. What am i doing wrong?
favorite count: 0
has title: How can i pass data structure from C++ to Lua?
tagged with: lua
type: AnsweredQuestion
downvote count: 0
upvote count: 3
tagged with: c++

http://stackoverflow.com/comment/140281194
type: QuestionComment
score: 0
has text: HI. i had a part like that what you mean. It work perfectly. Didnt work only script which turn it on
type: Comment
comment on: http://stackoverflow.com/q/79538692

http://stackoverflow.com/comment/140279578
comment on: http://stackoverflow.com/q/79544735
has text: 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.
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/q/79432387
tagged with: hardware
score: 0
answer count: 0
has body: Foreword: I have never coded in LUA before so my code probably sucks and I'm probably doing something wrong. 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). 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: local gShiftPressed = false local dpiShiftPressed = false local autoclicking = false function OnEvent(event, arg) --OutputLogMessage("Event: "..event.." Arg: "..arg.."") Mouse Button 9 = GShift Mouse Button 6 = DPI Shift-- if (event == "MOUSE_BUTTON_PRESSED") then if (arg == 9) then gShiftPressed = true elseif (arg == 6) then dpiShiftPressed = true end elseif (event == "MOUSE_BUTTON_RELEASED") then if (arg == 9) then gShiftPressed = false elseif (arg == 6) then dpiShiftPressed = false end end if(gShiftPressed and dpiShiftPressed and not autoclicking) then autoclicking = true while(autoclicking == true) do PressAndReleaseMouseButton(1) if(not gShiftPressed and not dpiShiftPressed) then autoclicking = false end end end end I have 2 problems now: 1.) LG Ghub says I have a syntax error (I feel like I dont, but who knows) 2.) When my code was working, it would click continuously but never stop when i wanted it to I tried thinking of an async solution, but i dont think Ghub supports Async coding
tagged with: lua
type: Question
type: UnansweredQuestion
has title: Custom Auto Clicker in LG Ghub not working, unknown syntax error plus async coding?

http://stackoverflow.com/a/79478052
upvote count: 3
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/79478040
has body: Both .*(%d+) and .*(%d)+ result in the same output because .* matches any zero or more chars as many as possible, and then (%d+) captures just one last digit into Group 1, and (%d)+ captures the last digit, too (techincally, these are different patterns, but due to .* there is only one digit both (%d+) and (%d)+ can match). The string.match only returns the captured substring if there is a capturing group in the regex, and your regex contains that one capturing group. You need local p1 = "^.*%d" Here, ^ - start of string .* - any zero or more chars as many as possible %d - a digit character. See the Lua demo. Note the ^, start of string anchor, is not necessary here if you go on using string.match. It just explicitly says to start matching from the start of the string. In case you ever want to get consistent results with string.gmatch, you will find it helpful.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/79478040

http://stackoverflow.com/comment/140108730
has text: 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
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/79439624
type: Comment

http://stackoverflow.com/q/79498050
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/140199617
tagged with: lua
has comment: http://stackoverflow.com/comment/140199723
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/140199656
has comment: http://stackoverflow.com/comment/140199648
tagged with: oop
has title: lua: attempt to call field 'run' (a table value)
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/140199664
has body: engine.lua and car.lua are two modules. car accesses engine and provides access of it's state to engine using dependency injection. engine.lua on require statements uses different metatable than when later called with new(). engine.lua -- engine.lua: local Engine = {} Engine.__index = Engine Engine.__call = Engine.run Engine.new = function(car) -- for dependency injection Engine.car = car local self = setmetatable({}, Engine) return self end Engine.run = function(self, opts) print(self.car.name) end return setmetatable(Engine, { __call = Engine.new }) car.lua: -- car.lua local Car = {name = "ferrari"} local Engine = require('engine') -- since in metatable __call = Engine.new Car.run = Engine(Car) -- now Engine is metatable for new object -- so __call = Engine.run local opts = {} Car.run(opts) when I run car.lua, I get: attempt to call field 'run' (a table value). On printing metatable of Car.run I see there is no __call method in metatable. Shouldn't it be there, since it is a key of Engine? why am I not able to call it?
type: Question

http://stackoverflow.com/comment/140194691
comment on: http://stackoverflow.com/a/79494490
type: AnswerComment
type: Comment
score: 0
has text: 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.

http://stackoverflow.com/q/79533967
type: Question
has title: how could decode the "LOL!xxx" string like this. the lua code in vm env
type: UnansweredQuestion
favorite count: 0
upvote count: 0
tagged with: lua
answer count: 0
has body: 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 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),"..",function(u)if b(u,2)==81 then t=a(d(u,1,1))return""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)>=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 w256+v end;local function F()local v,w,G,H=b(q,s,s+3)s=s+4;return H16777216+G65536+w256+v end;local function I()local J=F()local K=F()local L=1;local M=x(K,1,20)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 O0 else N=1;L=0 end elseif N==2047 then return M==0 and O1/0 or ONaN 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""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("#",...)end;local function W()local X={}local Y={}local Z={}local ={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;[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(,a8,a9)local …
score: -5
downvote count: 5

audio
tags question: http://stackoverflow.com/q/79497648
type: Tag
tag name: audio

http://stackoverflow.com/q/79470375
answer count: 1
has body: 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 Script:31: attempt to index nil with 'Humanoid' This happens rarely and only does so when a zombie dies. Not only that but it seems some of the bullets created seem to make way more damage than they really should. head = script.Parent.PrimaryPart local function triggershoot(part) local beam = Instance.new("Part",script.Parent) beam.Anchored = true beam.CanCollide = false beam.Shape = "Block" beam.CFrame = head.CFrame beam.Size = Vector3.new(0.5,0.5,0.5) beam.Material = "Plastic" beam.BrickColor = BrickColor.new("Dark taupe") beam.CFrame = CFrame.lookAt(head.Position,part.Position) for i = 0, 50, 1 do wait() beam.CFrame = beam.CFrame + beam.CFrame.LookVector beam.Touched:Connect(function(plr) if plr.Parent:HasTag("enemy") then plr.Parent.Humanoid:TakeDamage(3) beam:Destroy() end end) end end while true do wait() local parts = workspace:GetPartsInPart(script.Parent.zone) for _, part in pairs(parts) do if part:HasTag("enemy") and part.Parent.Humanoid.Health > 0 then local update = CFrame.lookAt(head.Position,part.Position) head.CFrame = update coroutine.wrap(triggershoot)(part) wait(1) end end end
score: 0
accepted answer: http://stackoverflow.com/a/79470671
tagged with: roblox
type: Question
has title: Attempt to index nil with 'humanoid'
tagged with: lua
has answer: http://stackoverflow.com/a/79470671
type: AnsweredQuestion

http://stackoverflow.com/a/79505018
has body: Found the root cause. Redisson was adding extra characters while encoding https://redisson.pro/docs/data-and-services/data-serialization/?utm_source=chatgpt.com Plain text codec works config.setCodec(new StringCodec()); config.useSingleServer() .setAddress(redisURL) .setConnectionPoolSize(30); RedissonClient redisson = Redisson.create(config);
score: 0
answers question: http://stackoverflow.com/q/79504829
type: Answer

http://stackoverflow.com/comment/140176903
type: QuestionComment
type: Comment
score: 1
has text: 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#.
comment on: http://stackoverflow.com/q/79483284

http://stackoverflow.com/a/79547248
score: 0
type: Answer
has body: It sounds like you may not need to as long as you're executing loadstring server-side (if someone is overriding your loadstring at that point they already have the keys to the kingdom) Nearest thing you can get is namespacing your function to a table and overriding __newindex local l = {} local set = false l = setmetatable(l, { __newindex = function(t, key, value) if key == 'oadstring' then if set == false then set = true t[k] = value else print('stop!') end end end }) function l.oadstring() end # Set once function l.oadstring() print('overridden') end # stop! l.oadstring = function() print('overridden') end # stop! At which point someone would have to replace the l 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).
answers question: http://stackoverflow.com/q/79544120

http://stackoverflow.com/comment/140118655
has text: @gsck you are right, I can also do `a, b =\ntext\n:find( ...etc` . So pharenteses are not needed for code readability.
type: Comment
comment on: http://stackoverflow.com/q/79439624
score: 1
type: QuestionComment

http://stackoverflow.com/comment/140221720
has text: nope still not working
comment on: http://stackoverflow.com/a/79510702
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/q/79435348
tagged with: openstreetmap
favorite count: 0
has title: OSRM - profile.lua - explanation of sets used
tagged with: lua
has comment: http://stackoverflow.com/comment/140121382
downvote count: 1
score: 0
tagged with: osrm
has body: I'm working on extracting routes for OSRM routing. The goal is to use this data for matching GPS data to routes. 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. The goal would be to weight the routing by a tag like gtfs:id. Is this possible to weight the route by this tag? Any source for a detailed explanation of the profiles.lua settings would be highly welcome.
type: Question
upvote count: 1
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/q/79439624
tagged with: brackets
upvote count: 3
score: 2
answer count: 2
tagged with: lua
has comment: http://stackoverflow.com/comment/140112597
type: Question
type: UnansweredQuestion
tagged with: argument-unpacking
has answer: http://stackoverflow.com/a/79446293
has comment: http://stackoverflow.com/comment/140110513
favorite count: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/140118655
has answer: http://stackoverflow.com/a/79439772
tagged with: parentheses
has title: Why do parentheses affect multiple-argument unpacking?
has comment: http://stackoverflow.com/comment/140108730
has body: The string:find 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. &gt; text = 'ciao pollo mario' &gt; a, b = text:find('pollo') -- without parentheses &gt; a, b 6 10 But for some reason, putting parentheses around the find call messes up the unpacking: &gt; a, b = ( text:find('pollo') ) -- with parentheses &gt; a, b 6 nil This is very sad since I use parentheses for code readability, like this: &gt; a, b = ( text:find('pollo') ) Why is this happening? I would expect that parentheses don't have any effect on the result!

http://stackoverflow.com/comment/140208764
type: QuestionComment
type: Comment
score: 0
has text: Try to name the lib with `/OUT:lua54.lib`
comment on: http://stackoverflow.com/q/79502556

http://stackoverflow.com/comment/140194531
type: Comment
score: 0
type: QuestionComment
has text: You could just use a Tween on the Torque property.
comment on: http://stackoverflow.com/q/79473868

http://stackoverflow.com/q/79430494
has comment: http://stackoverflow.com/comment/140083215
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/79430801
linked to: http://stackoverflow.com/q/19085239
has title: 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?
favorite count: 0
accepted answer: http://stackoverflow.com/a/79430801
has comment: http://stackoverflow.com/comment/140083726
has body: There is a great explanation of how to do this with 48°12'30" N 16°22'28" E or Zurich: dms: 47°21'7" N 8°30'37" E At How to convert GPS coordinates to decimal in Lua? However, I cannot work out how to trap to include the decimal value, as in 52°52'16.9"N 0°46'43.5"W.
type: Question
upvote count: 1
downvote count: 0
score: 1
tagged with: lua
has comment: http://stackoverflow.com/comment/140083480

http://stackoverflow.com/a/79516855
accepted answer of: http://stackoverflow.com/q/79516773
has comment: http://stackoverflow.com/comment/140234541
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/140234449
answers question: http://stackoverflow.com/q/79516773
has body: The description of ngx.req.set_body_data in the reference says: 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 or the disk file will be cleaned up immediately, respectively. I think this is the reason why the body file is gone.

http://stackoverflow.com/q/79452139
tagged with: map-projections
tagged with: love2d
type: Question
upvote count: 1
has title: Why is my OSM map rendering squished in Love2D?
answer count: 1
type: UnansweredQuestion
tagged with: openstreetmap
score: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/79470023
linked to: http://stackoverflow.com/q/25614911
tagged with: lua
tagged with: mercator
has comment: http://stackoverflow.com/comment/140150476
has body: Why is my OSM map rendering squished in Love2D? 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. Here is how I process the .osm file: parse the XML to extract nodes and ways. convert latitude and longitude directly to (x, y) coordinates. compute a scale factor based on the bounding box of the map and the screen dimensions (same for X and Y axis) draw the map using love.graphics.line() as precalculated line. Problem: The map appears compressed vertically instead of maintaining the correct aspect ratio. The code: local filenames = { 'map-55.osm', -- https://osm.org/go/evapcHOU -- 54.92349, -2.96367 'map-0.osm', -- https://osm.org/go/lX8ggeT68 -- -0.697995, 10.243917 } -- osm local osm = {} function osm.parseOSM(xml) local nodes = {} local nodesHash = {} local nodeIndex = 0 local ways = {} for wayStr in xml:gmatch('<way.->.-</way>') do local nodeIndices = {} for id in wayStr:gmatch('<nd ref="(.-)"') do -- id or nd if nodesHash[id] then table.insert (nodeIndices, nodesHash[id]) else nodeIndex = nodeIndex + 1 nodesHash[id] = nodeIndex table.insert (nodeIndices, nodeIndex) end end -- print ('#nodeIndices', #nodeIndices) local way = {nodeIndices = nodeIndices, line = {}} table.insert (ways, way) end for nodeStr in xml:gmatch('<node.-/>') do local id = nodeStr:match('id="(.-)"') local x = tonumber(nodeStr:match('lon="(.-)"')) -- X local y = tonumber(nodeStr:match('lat="(.-)"')) -- Y if nodesHash[id] then nodes[nodesHash[id]] = {x=x, y=-y} else end end local minLat, minLon, maxLat, maxLon = xml:match('<bounds minlat="(.-)" minlon="(.-)" maxlat="(.-)" maxlon="(.-)"/>') local minX = tonumber(minLon) -- x local maxX = tonumber(maxLon) -- x local minY = tonumber(minLat) -- y local maxY = tonumber(maxLat) -- y local dx = maxX-minX local dy = maxY-minY local bounds = { minX=minX, maxX=maxX, dx=dx, midX=minX + dx/2, minY=minY, …

http://stackoverflow.com/q/79474052
upvote count: 1
score: 1
answer count: 1
has body: I'm very new to using the local sock = ngx.socket.tcp() call that is provided by the nginx lua packages provided on Ubuntu Noble (i.e. the libnginx-mod-http-lua package). I've been able to get some success in opening a socket and writing out some data. But, based on my tcpdump analysis and other cues, the sock:send() operation works but I don't get any data back. My current theory is that nginx somehow prevents the ACK from the sock:connect() from being received by the lua block. In order to simplify things, I decided to reproduce this simple example to make sure that I'm doing things correctly. When I make up my own version of this, it hangs on the receive() call. Here is my setup: Ubuntu Noble Relevant lua packages: libluajit2-5.1-2: 2.1-20230410-1build1 libluajit2-5.1-common: 2.1-20230410-1build1 libnginx-mod-http-lua: 1:0.10.26-2 libnginx-mod-http-ndk: 1:0.3.3-1build1 libnginx-mod-stream-js: 0.8.2-1ubuntu1 lua-resty-core: 0.1.28-2 lua-resty-lrucache: 0.13-10 nginx version: 1.24.0-2ubuntu7.1 nginx and nc are running on a VirtualBox VM, curl is being run on my main development computer outside the VM. Here's the code snippets I'm using and their output: nginx test location: location /foo { content_by_lua_block { local tcp=ngx.socket.tcp() ngx.say(ngx.now()) ngx.flush() tcp:connect("127.0.0.1", 8000) ngx.say("connect() did not block") ngx.flush() local data, err = tcp:receive(1) ngx.say("receive() did not block") ngx.say(err) ngx.flush() ngx.update_time() ngx.say(ngx.now()) ngx.flush() } } curl invocation (which I Ctrl+C b/c it hangs): rlott@1022rdnote04:~/testing$ curl -k https://192.168.56.220/foo 1740693455.69 connect() did not block ^C rlott@1022rdnote04:~/testing$ nc running on port 8000 (doing nothing): etservice@noble:~$ nc -l 8000 -k Errors I see in /var/log/nginx/error.log (eventually): 2025/02/27 16:58:35 [error] 608728#608728: *101 lua tcp socket read timed out, client: 192.168.56.1, server: , request: "GET /foo HTTP/1.1", host: "192.168.56.220" 2025/02/…
has comment: http://stackoverflow.com/comment/140164513
tagged with: nginx
favorite count: 0
has title: Is the ngx.socket.tcp() call limited in any way when called from an nginx location context?
tagged with: lua
type: Question
tagged with: sockets
downvote count: 0
accepted answer: http://stackoverflow.com/a/79481478
has answer: http://stackoverflow.com/a/79481478
tagged with: lua-ngx-module
has comment: http://stackoverflow.com/comment/140171677
tagged with: json-rpc
type: AnsweredQuestion

http://stackoverflow.com/q/79442202
has comment: http://stackoverflow.com/comment/140104787
answer count: 1
score: 4
has comment: http://stackoverflow.com/comment/140104696
favorite count: 0
tagged with: element
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/140104944
type: AnsweredQuestion
tagged with: named
linked to: http://stackoverflow.com/q/41585078
has body: I have a file, something of this sort (CSV, TSV: delimited text): "col1","col2","col3" "1","ab","6.5" "4","df","9.7" I would like to read it to the Lua's table with named fields (like Python's list of dictionaries). Something of this sort: { {'col1'='1', 'col2'='ab', 'col3'='6.5'}, {'col1'='4', 'col2'='df', 'col3'='9.7'} } In the end I should be able to access the data in the following way: t[1].col1 t[1].col2 or t[2].col3 I cannot get my head around Lua's syntax on this matter. Unfortunately 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. Here is my attempt, but it does not work. local function split(str, sep) local t={} for s in string.gmatch(str, "([^"..sep.."]+)") do table.insert(t,s) end return t end local t_line = {} local t_row = {} local t_header = {} local t_target = {} local i = 1 for line in io.lines('some_file.txt') do t_line = split(line, ',') for j=1, #t_line do if i == 1 then -- first line of the file -- read header into table table.insert(t_header, t_line[j]) else -- this suppose to tell that t_header[j] is the key -- and t_line[j] is its value table.insert(t_row, [t_header[j]] = t_line[j]) end end -- here I add table as a row into main table if i > 1 then table.insert(t_target, t_row) end i = i + 1 end This part does not work: table.insert(t_row, [t_header[j]] = t_line[j]) Execution of the script throws an error: lua: ./example_10.lua:28: unexpected symbol near '[' but I tried to remove square brackets and it starts complaining about equal sign. Here is the way that line works: table.insert(t_row, t_line[j]) but then I will not able to call element by key name only by index. How to add value to the table and name the key by column name?
has title: reading delimited text file into Lua table
has answer: http://stackoverflow.com/a/79442297
accepted answer: http://stackoverflow.com/a/79442297
upvote count: 5
tagged with: lua
downvote count: 1
type: Question

http://stackoverflow.com/comment/140276291
type: QuestionComment
score: 2
has text: 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.
comment on: http://stackoverflow.com/q/79542847
type: Comment

http://stackoverflow.com/comment/140176575
type: QuestionComment
has text: Too broad. What is the c# code you are having trouble converting?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/79483284

http://stackoverflow.com/a/79542931
upvote count: 1
answers question: http://stackoverflow.com/q/79542847
downvote count: 0
score: 1
type: Answer
has body: It's a consequence of the way Lua handles logical operators. In Lua, a and b is evaluated according to the following logic: If a is false or nil ("falsy"), then a If a is "truthy" (neither of the above), then b a or b is handled similarly - b if a is falsy, a if a is truthy. Since and has precedence over or, the "ternary" expression is equivalent to (condition and true_value) or false_value. From there, it's probably best to explain its behavior in terms of cases. If condition is true, the and-expression evaluates to true_value, and the or-expression does the same because true_value is truthy. If condition is false, the and-expression evaluates to false, and the or-expression evaluates to false_value. Here's a table for reference: condition condition and true_value (condition and true_value) or false_value true true_value true_value false false false_value An edge case to watch out for is a falsy (false or nil) true_value. In that case, even if condition is true, condition and true_value evaluates to something falsy, so the or-expression evaluates to false_value instead of true_value. Whether this is a problem depends on your use case. If it's impossible, you're fine. If true_value can be falsy but not false_value, just switch the two and invert the condition. If either can be falsy, you might just want to use an if statement instead.

http://stackoverflow.com/comment/140270496
score: 0
type: QuestionComment
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/79538692

http://stackoverflow.com/a/79430801
accepted answer of: http://stackoverflow.com/q/79430494
answers question: http://stackoverflow.com/q/79430494
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/140093038
type: Answer
has body: Use the \' to escape the sequence: local dms = '52°52\'16.9"N' print (dms) local degrees, minutes, seconds, direction = dms:match('(%d+)%D+(%d+)%D+(%d+%.?%d*)%D*([NSEW])') print (degrees, minutes, seconds, direction) local decimal = tonumber(degrees) + tonumber(minutes) / 60 + tonumber(seconds) / 60^2 if direction == 'S' or direction == 'W' then print (-decimal) else print (decimal) -- positive end 52°52'16.9"N 52 52 16.9 N 52.871361111111
has comment: http://stackoverflow.com/comment/140092999

http://stackoverflow.com/a/79503580
type: Answer
score: 2
answers question: http://stackoverflow.com/q/79503032
has body: When calling a command from cmd.exe / a batch file, metacharacters such as | only need escaping as ^| if they are outside of (what cmd.exe sees as) "..."-enclosed strings. Since you're passing the PowerShell code to execute via the -Command parameter to powershell.exe, the Windows PowerShell CLI, enclosed in "...", you must therefore not use ^-escaping (as the ^ chars. would then be passed through to PowerShell and break the command): -- ^ instances removed os.execute("powershell -Command \"Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq " .. pid .. " } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\"")
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79503032
type: AcceptedAnswer
upvote count: 2

http://stackoverflow.com/q/79484591
accepted answer: http://stackoverflow.com/a/79486947
type: AnsweredQuestion
downvote count: 1
tagged with: telescope.nvim
tagged with: color-scheme
tagged with: neovim
type: Question
has comment: http://stackoverflow.com/comment/140179524
has body: 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. Here's the adapted config: require('kanagawa').setup({ compile = false, -- enable compiling the colorscheme undercurl = true, -- enable undercurls commentStyle = { italic = true }, functionStyle = {}, keywordStyle = { italic = true}, statementStyle = { bold = true }, typeStyle = {}, transparent = true, -- do not set background color dimInactive = false, -- dim inactive window `:h hl-NormalNC` terminalColors = { 0,17 = true }, -- define vim.g.terminal_color_{0,17} colors = { -- add/modify theme and palette colors palette = {}, theme = { wave = {}, lotus = {}, dragon = {}, all = {} }, }, overrides = function(colors) -- add/modify highlights return {} theme = "wave", -- Load "wave" theme when 'background' option is not set background = {dark = "dragon"} end vim.cmd("colorscheme kanagawa") and here is what the creators made on github -- Default options: require('kanagawa').setup({ compile = false, -- enable compiling the colorscheme undercurl = true, -- enable undercurls commentStyle = { italic = true }, functionStyle = {}, keywordStyle = { italic = true}, statementStyle = { bold = true }, typeStyle = {}, transparent = false, -- do not set background color dimInactive = false, -- dim inactive window `:h hl-NormalNC` terminalColors = true, -- define vim.g.terminal_color_{0,17} colors = { -- add/modify theme and palette colors palette = {}, theme = { wave = {}, lotus = {}, dragon = {}, all = {} }, }, overrides = function(colors) -- add/modify highlights return {} end, theme = "wave", -- Load "wave" theme when 'background' option is not set background = { -- map the value of 'background' option to a theme dark = "wave", -- try "dragon" ! light = "lotus" }, }) -- setup must be called before load…
has answer: http://stackoverflow.com/a/79486947
favorite count: 0
score: -1
tagged with: lua
answer count: 1
tagged with: terminal
upvote count: 0
has title: E5107: Error loading lua [string ":source (no file)"]:24: '}' expected near '='

tabletop-simulator
type: Tag
tags question: http://stackoverflow.com/q/79528284
tag name: tabletop-simulator

http://stackoverflow.com/comment/140150476
comment on: http://stackoverflow.com/q/79452139
has text: You can add the solution as an answer to your own question.
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/q/79465076
tagged with: lua
linked to: http://stackoverflow.com/q/37447704
tagged with: lua-table
has body: I have this function that takes a string (s) and returns a table depending on what I entered. function String2Faction(s) if s == "Nomads" then return Faction_Nomads elseif s == "Bandits" then return Faction_Bandits elseif s == "Military" then return Faction_Military elseif s == "WEM" then return Faction_WEM elseif s == "ECK" then return Faction_ECK end end Now, that's certainly a solution! But I was wondering if there was a different solution that wasn't tedious and annoying? Edit, Solved: You can do everything above by simply writing local options = { ["A"] = table1, ["B"] = table2, ["C"] = table3 } return options[variable] very easy
has comment: http://stackoverflow.com/comment/140143705
duplicate of: http://stackoverflow.com/q/37447704
type: Question
upvote count: 1
downvote count: 0
tagged with: string
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/140147843
score: 1
has title: Is it possible to identify a table from a string variable?
favorite count: 0

http://stackoverflow.com/q/79478040
has title: Lua: match pattern till the last digit occurence
type: AnsweredQuestion
downvote count: 1
accepted answer: http://stackoverflow.com/a/79478052
has body: I need to match a string till the last digit occurence in Lua. I tried .*(%d+) and .*(%d)+ patterns but they don't work local s = "HJFverhs.1.iufbgej" local p1 = ".*(%d+)" local p2 = ".*(%d)+" local s1 = s:match(p1) -- 1 local s2 = s:match(p2) -- nil I want HJFverhs.1 to be returned
score: 4
answer count: 1
upvote count: 5
tagged with: lua
type: Question
tagged with: lua-patterns
favorite count: 0
has answer: http://stackoverflow.com/a/79478052

http://stackoverflow.com/a/79481478
has body: 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 lua script is this: location /foo { content_by_lua_block { local tcp=ngx.socket.tcp() ngx.say(ngx.now()) ngx.flush() tcp:connect("127.0.0.1", 12000) ngx.say("connect() did not block") ngx.flush() tcp:send('{"jsonrpc":"2.0","method":"get.identifier","id":1}\r\n') local data, err = tcp:receive() ngx.say("receive() did not block: data = ", data) if err then ngx.say("error = ", err) end ngx.flush() ngx.update_time() ngx.say(ngx.now()) ngx.flush() } where port 16000 is the port of my backend JSON-RPC process. I triggered the location with curl and got what I was hoping for: rlott@1022rdnote04:~/testing/MAG-9214/njs-exps$ curl -k https://192.168.56.220/foo 1741016175.722 connect() did not block receive() did not block: data = {"id":1,"jsonrpc":"2.0","result":"94e2741e-217f-45c3-902c-4883864fd834"} 1741016175.723 The main issue with the TCP FIN not and the hang was not lua related but JSON-RPC related. My server needed the correct ending delimiter (i.e. \r\n) and was waiting for it prior to sending the response back.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/79474052
upvote count: 1
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/79474052

http://stackoverflow.com/comment/140104787
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/79442202
has text: @WalterMitty, as there's no apparent reference to lua in that is it relevant ?

http://stackoverflow.com/comment/140283884
type: QuestionComment
score: 2
type: Comment
comment on: http://stackoverflow.com/q/79473868
has text: This question looks like an LLM wrote it.

http://stackoverflow.com/q/79535091
tagged with: c++
has title: Why is this post build command not working when trying to copy the SDL3.dll to the same folder as the exe (premake)
type: Question
accepted answer: http://stackoverflow.com/a/79536118
tagged with: premake
has comment: http://stackoverflow.com/comment/140264323
has comment: http://stackoverflow.com/comment/140264662
tagged with: lua
type: AnsweredQuestion
answer count: 1
tagged with: game-development
score: 0
has body: filter "system:windows" cppdialect "C++17" staticruntime "On" systemversion "latest" defines {} postbuildcommands { "{COPYFILE} vendor/SDL3/lib/SDL3.dll bin/Debug-windows-x86_64" } I'm trying to learn premake and having troubles copying over a dll file with a post build command. 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. What could be happening here and what im doing wrong?
has answer: http://stackoverflow.com/a/79536118

http://stackoverflow.com/comment/140264323
has text: As explain in [doc](https://premake.github.io/docs/Tokens/#path-in-commands), path in command should be enclosed by `%[..]`
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79535091
type: Comment

escaping
tag name: escaping
type: Tag
tags question: http://stackoverflow.com/q/79503032

http://stackoverflow.com/comment/140279335
type: Comment
comment on: http://stackoverflow.com/q/79544120
type: QuestionComment
has text: I need to block the function from being changed, or if it doesn't search for the original function without any modification
score: 0

http://stackoverflow.com/q/79461719
has body: 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 luarocks install luasql-sqlite3 to add it but it's throwing an error: 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 I've added SQLITE_DIR in Environment Variable to C:\sqlite, inside that folder contains sqlite3.h, sqlite3.def, sqlite3.dll, and other sqlite3 files, and if I write sqlite3 in the CMD it runs SQLite! CMD showing SQLITE running through CMD using sqlite3 Note that I tried using luarocks install luasql-sqlite3 SQLITE_VAR="C:/sqlite" Add the sqlite3 files to LUA/5.1/include I want to be able to use MySQL and SQLite in Lua within the C# project that I'm doing.
score: 0
tagged with: sqlite
has comment: http://stackoverflow.com/comment/140170298
tagged with: lua
type: Question
type: UnansweredQuestion
has title: Dotnet, C#, Scripting Integration to Lua, can't add sqlite to Lua
has comment: http://stackoverflow.com/comment/140137220
answer count: 0
tagged with: .net

http://stackoverflow.com/q/79544120
has comment: http://stackoverflow.com/comment/140283730
type: Question
has comment: http://stackoverflow.com/comment/140278407
answer count: 1
has answer: http://stackoverflow.com/a/79547248
favorite count: 0
score: -1
tagged with: lua
tagged with: lua-table
downvote count: 1
type: UnansweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/140279335
linked to: http://stackoverflow.com/q/1224708
has title: How to block functions from being overwritten?
has body: I program in LUA and I need some help: I have file1.lua and file2.lua In file1.lua: loadstring('print("Hello World!")') in file2.lua: _loadstring = loadstring function loadstring(code) iprint("The code is:", code) return _loadstring(code)() end 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? 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. EDIT: I'm still looking for alternatives and I thought of something: It's like my code starts like this: _loadstring = loadstring function loadstring(code) iprint("The code is:", code) return _loadstring(code)() end loadstring('print("Hello World!")') 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?

http://stackoverflow.com/comment/140278407
score: 0
has text: Overwritten? Do you mean *overridden?*
type: QuestionComment
comment on: http://stackoverflow.com/q/79544120
type: Comment

http://stackoverflow.com/q/79478693
score: 0
has title: Lua: Toggling the primary click in G Hub doesn't work
has body: My script in G Hub looks like the follows: function OnEvent(event, arg) if (event == "G_PRESSED" and arg == 7) then if not IsMouseButtonPressed(1) then PressMouseButton(1); OutputLCDMessage("Button 1 toggle on."); else ReleaseMouseButton(1); OutputLCDMessage("Button 1 toggle off."); end end end However, it doesn't seem like anything happens when I press G7. Did I do anything wrong?
type: Question
type: UnansweredQuestion
tagged with: lua
tagged with: logitech
answer count: 0

http://stackoverflow.com/q/79468949
score: 1
answer count: 2
tagged with: closures
type: Question
has title: Closure over numeric for-loop variable in Lua
upvote count: 1
accepted answer: http://stackoverflow.com/a/79469009
favorite count: 0
has body: I have a question about Lua, closures and local variables. From my understanding, the loop variable in a numerical for-loop is implicitly local so I was expecting the following code to behave identical. local a = 1 t1 = function() return a end a = 2 t2 = function() return a end print( t1() ) print( t2() ) table = {} for i=1,2 do table[i] = function() return i end end print( table[1]() ) print( table[2]() ) To my surprise, it did not. Why does the code print 2 2 1 2 and not 2 2 2 2 ?
type: AnsweredQuestion
tagged with: lua
has answer: http://stackoverflow.com/a/79468971
downvote count: 0
possible better answer: http://stackoverflow.com/a/79468971
has answer: http://stackoverflow.com/a/79469009

http://stackoverflow.com/q/79475503
tagged with: lua
tagged with: mod-rewrite
answer count: 0
score: 0
has body: 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. There's this auto tracker script for a new mod that's recently come out for Sm64 located here. https://github.com/WaffleSmacker/IronMarioTracker/releases/tag/v1.1.1 The problem is it only currently works with bizhawks Lua API. I did however find this, https://github.com/OoTMM/Project64-EM/releases/tag/v1.0.3 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) How would I go about figuring that out. 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..
has title: Converting from one script to another
type: Question
type: UnansweredQuestion

http://stackoverflow.com/comment/140234449
comment on: http://stackoverflow.com/a/79516855
score: 0
has text: 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
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/140223191
type: AnswerComment
type: Comment
has text: 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.
comment on: http://stackoverflow.com/a/79510702
score: 1

http://stackoverflow.com/comment/140197969
comment on: http://stackoverflow.com/a/79496450
has text: 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.
score: 1
type: Comment
type: AnswerComment

http://stackoverflow.com/q/79509437
upvote count: 1
has title: Platform-neutral line ending for io.stderr::write
downvote count: 0
favorite count: 0
tagged with: cross-platform
type: Question
type: UnansweredQuestion
score: 1
has body: I'm writing a Lua filter for Pandoc to deduce the HTML pagetitle from the first h1 heading of the input document. Other than the print() function, io.stderr.write does not append a newline. I found in the answer to NewLine(\n) alternative in Lua? that and can be used to create multi-line string literals, but surprisingly this does not work with strings that contain nothing but a line break. local pagetitle function Header(header) if not pagetitle and header.level == 1 then pagetitle = pandoc.utils.stringify(header) end end -- capture current line break: local EOL = [[ ]] function Meta(meta) if not meta.pagetitle then if pagetitle then meta.pagetitle = pagetitle else io.stderr:write( 'WARNING: h1 missing, defaulting HTML pagetitle to input filename.', EOL) meta.pagetitle = PANDOC_STATE.input_files[1] end return meta end end 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. What would you suggest instead?
tagged with: lua-5.4
tagged with: lua
linked to: http://stackoverflow.com/q/52400428
has answer: http://stackoverflow.com/a/79509438
tagged with: line-breaks
answer count: 1

http://stackoverflow.com/q/79449456
has title: In Neovim, is there a way of set a keybind that allows to hold <leader> and press another key multiple times?
type: Question
upvote count: 1
downvote count: 0
tagged with: key-bindings
type: UnansweredQuestion
answer count: 0
score: 1
favorite count: 0
has body: Considering the following example of key binding in nvim init file: vim.keymap.set( 'n', '&lt;leader&gt;x', function() print('megatron') end ) Let's assume my leader is space ' '. If I press x it works the first time. But I would like to continue to hold down (space), while I press again x, printing 'megatron' multiple times. Instead, starting from the second time, it begins to delete chars (as if I would have been pressed only x). I would like to know if there is a way to map a function to holding space and press a char multiple times.
tagged with: lua
tagged with: neovim

http://stackoverflow.com/a/79470023
has body: The solution, Mercator projection: local function mercatorY(lat) local radLat = math.rad(lat) return math.deg(math.log (math.tan(radLat) + 1/math.cos(radLat))) end And it will be called as local x = tonumber(nodeStr:match('lon=&quot;(.-)&quot;')) -- X local y = mercatorY(tonumber(nodeStr:match('lat=&quot;(.-)&quot;'))) -- new code and local minY = mercatorY(tonumber(minLat)) local maxY = mercatorY(tonumber(maxLat))
downvote count: 0
answers question: http://stackoverflow.com/q/79452139
score: 1
type: Answer
upvote count: 1

map-projections
tags question: http://stackoverflow.com/q/79452139
tag name: map-projections
type: Tag

http://stackoverflow.com/comment/140264662
has text: Ah ok I missed that, thank you very much. Ill try this.
type: Comment
comment on: http://stackoverflow.com/q/79535091
score: 0
type: QuestionComment

http://stackoverflow.com/q/79483284
has comment: http://stackoverflow.com/comment/140176903
tagged with: vb.net
tagged with: naudio
downvote count: 1
has title: NAudio/bass.net with VB.net: (or lua) how to read peaks (FFT)
score: -1
type: Question
type: UnansweredQuestion
has body: 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). 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) Thanks. (Alternatively if you know how to do it in Lua, I would be grateful for the solution, too.)
favorite count: 0
has comment: http://stackoverflow.com/comment/140176575
upvote count: 0
answer count: 0
tagged with: lua

http://stackoverflow.com/a/79496450
score: 4
upvote count: 4
downvote count: 0
has body: Your problem can be solved by partitioning algorithm, such as Generate all partition of a set. The solution is implemented by using recursion to generate all possible partitions of the given set C. Here is the LUA implementation: -- Function to generate all partitions of a set local function generatePartitions(input, index, currentPartition, result) if index == #input then -- Convert the current partition to the desired format local partition = {} for _, group in ipairs(currentPartition) do table.insert(partition, table.concat(group, "")) end table.insert(result, partition) else -- Add the current element to each existing group in the partition for i = 1, #currentPartition do table.insert(currentPartition[i], input[index + 1]) generatePartitions(input, index + 1, currentPartition, result) table.remove(currentPartition[i]) -- backtrack end -- Create a new group with the current element local newGroup = {input[index + 1]} table.insert(currentPartition, newGroup) generatePartitions(input, index + 1, currentPartition, result) table.remove(currentPartition) -- backtrack end end local input = {"a", "b", "c", "d", "e"} local results = {} generatePartitions(input, 0, {}, results) -- Print all results for _, result in ipairs(results) do print("{" .. table.concat(result, ", ") .. "}") end Here is the output for your specific set C: {abcde} {abcd, e} {abce, d} {abc, de} {abc, d, e} {abde, c} {abd, ce} {abd, c, e} {abe, cd} {ab, cde} {ab, cd, e} {abe, c, d} {ab, ce, d} {ab, c, de} {ab, c, d, e} {acde, b} {acd, be} {acd, b, e} {ace, bd} {ac, bde} {ac, bd, e} {ace, b, d} {ac, be, d} {ac, b, de} {ac, b, d, e} {ade, bc} {ad, bce} {ad, bc, e} {ae, bcd} {a, bcde} {a, bcd, e} {ae, bc, d} {a, bce, d} {a, bc, de} {a, bc, d, e} {ade, b, c} {ad, be, c} {ad, b, ce} {ad, b, c, e} {ae, bd, c} {a, bde, c} {a, bd, ce} {a, bd, c, e} {ae, b, cd} {a, be, cd} {a, b, cde} {a, b, cd, e} {ae, b, c, d} {a, be, c, d} {a, b, ce, d} {a, b, c, de} {a, b, c, d, e}
has comment: http://stackoverflow.com/comment/140197969
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/79495515
type: Answer
accepted answer of: http://stackoverflow.com/q/79495515

http://stackoverflow.com/comment/140083215
score: 0
comment on: http://stackoverflow.com/q/79430494
type: Comment
has text: use `[%d%.]+` instead of `%d+`
type: QuestionComment

http://stackoverflow.com/q/79516773
tagged with: lua
type: AnsweredQuestion
answer count: 1
has answer: http://stackoverflow.com/a/79516855
has title: body_file doesnt exist even tho get_body_file returns a filename
favorite count: 0
tagged with: openresty
type: Question
upvote count: 1
downvote count: 0
has body: 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: location ~ ^/upload $ { client_body_in_file_only on; content_by_lua_block { ngx.req.read_body() local body_file = ngx.req.get_body_file() ngx.req.set_header("X-File-Path", body_file) ngx.req.set_body_data("") return ngx.exec("@proxy_target") } } location @proxy_target { proxy_pass http://127.0.0.1:8000$request_uri; } The code is pretty straight forward and body_file is defined. However, the file itself doesnt exist. When I dont read the file via read_body 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 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. If someone knows a solution via nginx alone that obviously would be much preferred Any pointers are welcome! // EDIT: Opened a bug report since this seems inconsistent behavior: https://github.com/openresty/lua-nginx-module/issues/2405
accepted answer: http://stackoverflow.com/a/79516855
score: 1
tagged with: nginx

http://stackoverflow.com/comment/140147843
type: Comment
comment on: http://stackoverflow.com/q/79465076
type: QuestionComment
score: 0
has text: Are they in global and available in _G[tableName] ?

http://stackoverflow.com/comment/140232187
score: 0
type: QuestionComment
has text: thanks Kylaaa but I want part to start cloning again after it gets deleted
type: Comment
comment on: http://stackoverflow.com/q/79510694

http://stackoverflow.com/comment/140232770
comment on: http://stackoverflow.com/q/79510694
type: Comment
has text: Keep a copy of the spawning block in ReplicatedStorage and write a spawning script in ServerScriptService that clones the block into the Workspace
type: QuestionComment
score: 0

http://stackoverflow.com/comment/140191058
type: Comment
score: 0
comment on: http://stackoverflow.com/a/79460555
has text: @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().
type: AnswerComment

http://stackoverflow.com/a/79460555
has comment: http://stackoverflow.com/comment/140184448
has comment: http://stackoverflow.com/comment/140191058
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79460373
answers question: http://stackoverflow.com/q/79460373
has body: 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: function Screen:getGameCoordAt(pos) local constants = Constants() -- pos is isometric screen cord. -- perform inverse transform on pos, and reverse x and y offsets. local iso = Iso(constants.TILE_WIDTH, constants.TILE_HEIGHT) local transformed = iso:inverse():transform(Vec2(pos.x - constants.X_OFFSET, pos.y - constants.Y_OFFSET - constants.MAX_TILE_HEIGHT + constants.TILE_HEIGHT)) return Vec2(transformed.x, transformed.y) end 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. But since there are tiles of different heights, they are given a zIndex, or zOffset. The higher the zOffset, the "lower" they are on the screen, since +y goes down: function Tile:draw() local constants = Constants() -- transform the tile's position to isometric coords local zOffset = constants.MAX_TILE_HEIGHT - self.image:getHeight() local iso = Iso(constants.TILE_WIDTH, constants.TILE_HEIGHT) local vecIso = iso:transform(self.pos) assert(iso:inverse():transform(vecIso).x == self.pos.x) assert(iso:inverse():transform(vecIso).y == self.pos.y) -- scoot the image to the left by TILE_WIDTH/2, so that the center of the image lies on the origin. love.graphics.draw(self.image, constants.X_OFFSET + vecIso.x - constants.TILE_WIDTH/2, constants.Y_OFFSET + vecIso.y + zOffset) end 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. 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…
upvote count: 1
score: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/79491072
tagged with: logitech
has title: Logitech G HUB Lua toggle script
tagged with: lua
has body: 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: function OnEvent(event, arg, family) OutputLogMessage("clicked event = %s, arg = %s\n", event, arg); if ( event == "MOUSE_BUTTON_PRESSED" and arg == 5 ) then ToggleState = not ToggleState if ToggleState then PlayMacro("MACRO 1"); else AbortMacro() end end end this one are set to my mouse G5 run the MACRO 1 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!? 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
score: 0
tagged with: logitech-gaming-software
type: Question
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/comment/140186497
type: QuestionComment
score: 0
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/79489801

http://stackoverflow.com/comment/140266076
comment on: http://stackoverflow.com/q/79533393
score: 1
type: Comment
has text: 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.
type: QuestionComment

http://stackoverflow.com/comment/140195107
type: QuestionComment
comment on: http://stackoverflow.com/q/79487664
type: Comment
score: 0
has text: @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.

http://stackoverflow.com/comment/140208504
comment on: http://stackoverflow.com/q/79502556
type: Comment
has text: 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
type: QuestionComment
score: 0

http://stackoverflow.com/a/79525732
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/79525645
downvote count: 0
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/79525645
has body: sol::state::load 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. std::string script = "print('hello')"; sol::function f = _interpreter.load(script); f(); // prints hello 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. std::string script = R"( function check_condition(price_update) print(price_update) print("best bid = ", price_update.best_bid) return true end )"; auto load_result = _interpreter.load(script); if (!load_result.valid()) { /* throw something? */ } sol::function f = load_result.get<sol::function>(); f(); // executes the script which declares a function // get declared function sol::function check_condition = _interpreter["check_condition"]; PriceData pd(106.0, 107.0); bool call_return = check_condition(pd); // calls function assert(call_return); sol.PriceData*: 000001F00AC72F98 best bid = 106.0 your code for adding the usertype works. _interpreter.new_usertype<PriceData> ( "PriceData", "best_bid", &PriceData::best_bid, "best_ask", &PriceData::best_ask );

closures
tags question: http://stackoverflow.com/q/79468949
type: Tag
tag name: closures

http://stackoverflow.com/q/79542847
upvote count: 3
answer count: 2
tagged with: lua
type: Question
tagged with: conditional-operator
downvote count: 0
score: 3
type: UnansweredQuestion
has title: How does the `(…) and (…) or (…)` idiom mimic a ternary operator in Lua?
tagged with: boolean-logic
has comment: http://stackoverflow.com/comment/140276291
has answer: http://stackoverflow.com/a/79542959
has answer: http://stackoverflow.com/a/79542931
has body: This statement mimics a ternary operator in the Lua programing language: local result = condition and true_value or false_value But how does it work? Why does it give true_value if the condition is true?
favorite count: 0
tagged with: boolean-operations

cross-platform
type: Tag
tags question: http://stackoverflow.com/q/79509437
tag name: cross-platform

http://stackoverflow.com/comment/140281029
score: 0
type: Comment
has text: 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 !
comment on: http://stackoverflow.com/q/79538692
type: QuestionComment

http://stackoverflow.com/comment/140199664
type: Comment
score: 4
type: QuestionComment
comment on: http://stackoverflow.com/q/79498050
has text: `Engine.__call = Engine.run` is an assignment, not a binding, its value won't be automatically updated.

crank
tags question: http://stackoverflow.com/q/79530313
type: Tag
tag name: crank

http://stackoverflow.com/comment/140185139
type: Comment
has text: Try https://onecompiler.com/lua/43azfnehv
score: 0
comment on: http://stackoverflow.com/q/79487664
type: QuestionComment

http://stackoverflow.com/a/79468971
score: 0
has body: Each i is local to their iteration but so is each of the function declarations. They refer to their corresponding i. Even if the function didn't return i but a constant, like for example table = {} for i=1,2 do table[i] = function() return 5 end end print( table[1] ) print( table[2] ) print( table[1] == table[2] ) -- false you will see that the prints will be different. (I removed the () part in the print so you can see the memory address to the functions)
type: Answer
answers question: http://stackoverflow.com/q/79468949

http://stackoverflow.com/a/79446293
upvote count: 1
downvote count: 0
has body: Based on your use of the word "unpacking," it seems like you might be coming from Python? Python has tuples, and unpacking looks something like this: multiple_values = (1, 2) a, b = multiple_values Here, multiple_values is one variable that contains 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 tuple that contains multiple things, and you "unpack" the tuple by assigning each of its items to a different variable. def find(needle: str, haystack:str) -> tuple[int, int]: start = 1 end = 2 return start, end a, b = find("hi", "this") # a = "hi"; b = "this" Crucially, this means that all return values are preserved even if you don't unpack. a = find("hi", "this") # a = ("hi", "this") 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 "unpacking" at all because there's no tuple to unpack. text:find('pollo') --find returns no values a = text:find('pollo') --find only returns one value - the other gets discarded a, b = text:find('pollo') --find returns two values a, b, c = text:find('pollo') --find returns two values and a "padding" nil Importantly, this is entirely context-dependent. If you change the way your function is called, it returns a different number of arguments. The last thing to understand is what shingo explained: 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 "two values that are actually one value because they're a tuple." So let's look at two code samples: your code and the equivalent in Python. Lua Python a, b = (text:find('pollo')) a, b = (find('pollo', text)) In Python, this works fine. The find call returns a tuple containing two values. The parentheses can only contain one value, …
answers question: http://stackoverflow.com/q/79439624
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/140118295

equalizer
type: Tag
tag name: equalizer
tags question: http://stackoverflow.com/q/79497648

http://stackoverflow.com/q/79544735
has body: 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 i somehow can exceed loop limit vertexCount. The code runs on a single thread without coroutines, and all polygon 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. I could keep the check and break the loop forcefully but that just seems wrong. Here's the code and caught output: -- Checks if a line segment intersects with a polygon. -- Parameters: -- x, y: Starting point coordinates of the segment. -- x2, y2: Ending point coordinates of the segment. -- polygon: A table of coordinates defining the polygon as a series of points {x1, y1, x2, y2, ..., xn, yn}. -- The polygon is assumed to be closed, where the last point connects back to the first point. -- Returns: -- intersects: A boolean value; true if the segment intersects the polygon, false otherwise. -- ix, iy: Coordinates of the intersection point, if an intersection occurs. Geom.isIntersectionSegmentPolygon = function(x, y, x2, y2, polygon) -- TODO: sometimes p1x passed to segmentSegmentIntersection is nil for some reason, this should allow to debug this Geom._ix = x Geom._iy = y Geom._ix2 = x2 Geom._iy2 = y2 Geom._ipolygon = polygon local vertexCount = #polygon local p0x = polygon[vertexCount - 1] local p0y = polygon[vertexCount] for i = 1, vertexCount, 2 do local p1x = polygon[i] local p1y = polygon[i + 1] -- TODO remove this if p1x==nil or p1y==nil or i>vertexCount then fail("isIntersectionSegmentPolygon error, index", i, "; vertexCount", vertexCount) fail("p1x",p1x) fail("p1y",p1y) l…
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/140279596
tagged with: luajit
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/140280158
tagged with: love2d
has comment: http://stackoverflow.com/comment/140280072
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/140279517
favorite count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/140279578
has title: Loop exceeds its limit

http://stackoverflow.com/comment/140227684
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/79508464
score: 0
type: QuestionComment

http://stackoverflow.com/comment/140269942
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/79538692
has text: 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?

http://stackoverflow.com/q/79421275
has title: Envoy JWT Auth Filter Fails When Placed After Lua Filter
answer count: 0
score: 0
tagged with: envoyproxy
type: Question
type: UnansweredQuestion
has body: 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: "response": { "upstream-service-time": null, "flags": "-", "code": 401, "details": "jwt_authn_access_denied{Jwt_issuer_is_not_configured}", "duration": 7 } - name: envoy.filters.http.lua typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua inline_code: | function envoy_on_request(handle) -- Log Authorization Headers local auth_header = handle:headers():get("Authorization") if auth_header then handle:logInfo("Authorization Header: " .. auth_header) else handle:logInfo("Authorization Header: MISSING") end end - name: envoy.filters.http.jwt_authn typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication providers: aws-cognito-jwt: clear_route_cache: true
tagged with: lua

brackets
tags question: http://stackoverflow.com/q/79439624
type: Tag
tag name: brackets

http://stackoverflow.com/q/79503032
answer count: 1
tagged with: powershell
has comment: http://stackoverflow.com/comment/140208284
upvote count: 1
tagged with: vlc
favorite count: 0
tagged with: escaping
accepted answer: http://stackoverflow.com/a/79503580
tagged with: lua
type: Question
downvote count: 0
has body: Trying to kill some child processes (given parent pid) from within a lua script. Found solution using wmic but prefer using powershell. I can run each of these powershell commands in a standard windows cmd.exe and they all behave as expected. powershell -Command "Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq 311 } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }" cmd /c "powershell -Command Get-WmiObject Win32_Process ^| Where-Object { $_.ParentProcessId -eq 311 } ^| ForEach-Object { Stop-Process -Id $_.ProcessId -Force }" set PARENT_PID=311 && powershell -NoProfile -ExecutionPolicy Bypass -Command "$parentPID = [int]$env:PARENT_PID; Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq $parentPID } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }" 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: os.execute("powershell -Command \"Get-WmiObject Win32_Process | Where-Object { $_.ParentProcessId -eq " .. pid .. " } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\"") os.execute("powershell -Command \"Get-WmiObject Win32_Process ^| Where-Object { $_.ParentProcessId -eq " .. pid .. " } ^| ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\"") os.execute("set PARENT_PID=" .. pid .. " && powershell -NoProfile -ExecutionPolicy Bypass -Command \"$parentPID = [int]$env:PARENT_PID; Get-WmiObject Win32_Process ^| Where-Object { $_.ParentProcessId -eq $parentPID } ^| ForEach-Object { Stop-Process -Id $_.ProcessId -Force }\"") Any tips on escaping the commands or general troubleshooting methods? UPDATE: 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 l…
has comment: http://stackoverflow.com/comment/140208278
score: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/79503580
has title: Powershell escape in LUA script

http://stackoverflow.com/q/79538692
answer count: 1
type: UnansweredQuestion
tagged with: lua
score: 0
tagged with: roblox
has title: running roblox script only once
has body: part = script.Parent part.Touched:Connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) plr.PlayerGui.upd.Enabled = true end) that script run only once, but must run any time player touching part. Why?
has comment: http://stackoverflow.com/comment/140281029
has answer: http://stackoverflow.com/a/79546763
has comment: http://stackoverflow.com/comment/140281194
has comment: http://stackoverflow.com/comment/140269942
has comment: http://stackoverflow.com/comment/140270496
type: Question

racing
tag name: racing
tags question: http://stackoverflow.com/q/79473868
type: Tag

http://stackoverflow.com/comment/140267226
has text: If I run [lua5_1_5_linux_64_generic]$ ./lua, I get Segmentation fault.
type: Comment
comment on: http://stackoverflow.com/q/79532226
score: 0
type: QuestionComment

mercator
type: Tag
tags question: http://stackoverflow.com/q/79452139
tag name: mercator

http://stackoverflow.com/comment/140182922
type: QuestionComment
comment on: http://stackoverflow.com/q/79487664
score: 2
type: Comment
has text: The output is as expected: you're calling Slider1Callback every time, with a fixed 1.

http://stackoverflow.com/q/79455748
tagged with: comb
accepted answer: http://stackoverflow.com/a/79456636
has title: Polyline Curvature Combs in Lua, Love2D
answer count: 1
type: Question
tagged with: love2d
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/79456636
score: 1
favorite count: 0
tagged with: geometry
tagged with: lua
type: AnsweredQuestion
tagged with: curve
has body: I have a polyline (white) with coordinates {x1, y1, x2, y2, x3, y3 ...} polyline = {100,300,160,257,220,242,280,250,340,271,400,300,460,329,520,350,580,358,640,343,700,300} How can I get the curvature of it? The result must be same as the curvature of Bezier (red curve on the calculated heights): I can understand, that the ends of polyline must have the zero curvature. The result must be something like:

http://stackoverflow.com/q/79494448
tagged with: roblox
has answer: http://stackoverflow.com/a/79508638
has answer: http://stackoverflow.com/a/79494468
score: 0
type: Question
has title: How to find the position of a player in roblox
type: UnansweredQuestion
has body: 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) I tried to search online but i didnt find a solution to my problem local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(input, gameProcessed) if input.KeyCode == Enum.KeyCode.G then _G.MalevolentShire = true end end)
tagged with: lua
answer count: 2

http://stackoverflow.com/q/79466672
tagged with: lua
has comment: http://stackoverflow.com/comment/140145822
has title: A neovim lua function to select around an allman-style block
upvote count: 2
has body: I'm trying to create a neovim function which selects around {}, plus relevant context on the line above if allman-style. For what I've tried: In my mind, I have this series of steps Find the opening { by simulating F{ in normal mode Jump to the matching } by simulating % Begin a visual selection by simulating pressing v Jump back to the opening { by simulating % again If the topmost line is the first line of the file, return If the resulting selection spans only 1 line, return If the topmost line does not match the regex ^\s*{\s*$, return Check the content of the line above the topmost line IF the line above the topmost line contains a semicolon, select up to it by simulating T; ELSE, select the entire line by simulating k_ 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 vim.cmd("normal! F{") and then asking for vim.api.nvim_get_current_line() will not neccesarily give me the line on which "{" appears, but rather the line on which I started at the beginning of invoking the function. In case it matters, I'm invoking the function with the keybind <leader>{, declared like so: vim.keymap.set("n", "<leader>{", select_allman, { noremap = true, silent = true }) An early implementation of the code, stopping where I got stuck at querying line content: local function select_allman() vim.cmd("normal! F{%v%") local start_line = vim.fn.line("'<") local end_line = vim.fn.line("'>") if start_line == end_line then -- we always return here because start_line and end_line are the line where we started invoking the function return end local line_content = vim.fn.getline(start_line) if not string.match(line_content, "^%s*{%s*$") then -- we always return here since line_content is where we started, not the line above { return end -- here we'd select a…
score: 2
tagged with: neovim
type: Question
downvote count: 0
type: UnansweredQuestion
answer count: 0
has comment: http://stackoverflow.com/comment/140178089
favorite count: 0

http://stackoverflow.com/q/79544001
has title: Layers display and movement in Love2D (Lua)
tagged with: love2d
type: Question
type: UnansweredQuestion
tagged with: lua
tagged with: game-development
answer count: 0
has body: 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 .lua file. However, I'm facing two issues with this background: Problem number one: 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: -- variables for moving background local layerOffsets = {} local layerSpeeds = { sky = 100, ground = 150, clouds = 50, } function love.load() -- loading libraries sti = require 'libraries/sti' -- loading the background map = sti('maps/robot_run_ext.lua') -- Initialize offsets for each layer for layer, _ in pairs(layerSpeeds) do layerOffsets[layer] = 0 end end function love.update(dt) -- Get the with of the map in pixels local mapWidth = map.width * map.tilewidth -- Update each layer separately for layer, speed in pairs(layerSpeeds) do layerOffsets[layer] = layerOffsets[layer] - speed * dt -- Wrap around when the layer moves off-screen if layerOffsets[layer] &lt;= -mapWidth then layerOffsets[layer] = 0 end end end function love.draw() local mapWidth = map.width * map.tilewidth love.graphics.clear() -- Clear the screen for layer, offset in pairs(layerOffsets) do if map.layers[layer] then map.layers[layer]:draw(offset, 0) map.layers[layer]:draw(offset + mapWidth, 0) end end end When I launch the game, nothing 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. Problem number two: 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 some…
score: 0

naudio
type: Tag
tag name: naudio
tags question: http://stackoverflow.com/q/79483284

http://stackoverflow.com/comment/140196814
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/79495515
has text: 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.

http://stackoverflow.com/a/79536281
downvote count: 1
answers question: http://stackoverflow.com/q/79473868
has body: 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. Next question, Interpolation**:** Use a method like Lerp (linear interpolation) to gradually change the speed. This will help make the boost feel smoother. 3rd question, here is my drafted script for the problem, local UserInputService = game:GetService("UserInputService") local boostActive = false UserInputService.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then boostActive = true end end) UserInputService.InputEnded:Connect(function(input) if input.KeyCode == Enum.KeyCode.LeftShift then boostActive = false end end)
upvote count: 0
type: Answer
score: -1

http://stackoverflow.com/q/79508464
has body: I'm using Pandoc to convert a Latex project to Markdown (to display it via Dokusaurus). I 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 I'm thinking of something like this: % This config is only relevant for dokusuarus and must not be present in the Pdf \begin{markdown-only} --- title: Foobar42 --- \end{markdown-only} \section{Section 1} Lorem Ipsum dolor sit amet. Resulting Latex PDF: Section 1 Lorem Ipsum dolor sit amet. Resulting markdown after conversion with pandoc: --- title: Foobar42 --- # Section 1 Lorem Ipsum dolor sit amet. How can I achieve this? I'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.
type: Question
has comment: http://stackoverflow.com/comment/140227684
type: UnansweredQuestion
tagged with: latex
tagged with: markdown
tagged with: lua
score: 0
tagged with: pandoc
answer count: 0
has title: How to have an invisible Latex section that is kept when converted to markdown? (Pandoc)

http://stackoverflow.com/q/79510694
has title: How to delete clones - Roblox Studio?
possible better answer: http://stackoverflow.com/a/79510702
upvote count: 2
answer count: 2
score: 2
tagged with: roblox
has body: 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. This code is for cloning the part (this is a normal script in a part): while true do wait() local clonepart = script.Parent:Clone() clonepart.Parent = game.Workspace clonepart.Anchored = false end This is the code for deleting (a local script in a Text button GUI): local part = game.Workspace.cloner script.Parent.MouseButton1Up:Connect(function() part:Destroy() end) It is removing the part which is making the clones.
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/79514668
tagged with: lua-5.1
accepted answer: http://stackoverflow.com/a/79514668
favorite count: 0
tagged with: lua
has comment: http://stackoverflow.com/comment/140232187
type: AnsweredQuestion
tagged with: luau
has comment: http://stackoverflow.com/comment/140232770
has answer: http://stackoverflow.com/a/79510702

http://stackoverflow.com/q/79495515
upvote count: 4
has comment: http://stackoverflow.com/comment/140196814
has comment: http://stackoverflow.com/comment/140198970
tagged with: algorithm
score: 4
has comment: http://stackoverflow.com/comment/140197956
has body: 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. Let's say that we got an array C = { "a", "b", "c", "d", "e"}. I want to get this result: output = { { "a", "b", "c", "d", "e"}; { "ab", "c", "d", "e}; { "ac", "b", "d", "e" }; { "abc", "d", "e"}; { "aeb", "d", "c"}; { "a", "bde", "c"}; { "ab", "cd", "e"}; { "a", "bcd", "e" }; { "acd", "b", "e}; { "ac", "bd", "e"}; { "abc", "de"}; { "abcd", "e"}; { "acd", "be"} { "ac" "bde"}; ...and so on until {"abcde"}; } 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 "superpermutation" because any combo must be "first unique"[so to speak] - so "ab" or "abc", but no "ba", "aba", "bab", "bac" etc. . To be perfectly honest i cannot get a grip on this problem. Maybe someone have an idea how to solve this? What i tried so far was to get basic permutations for C array by below function: local function getPermuations(array) local wrap, yield, board = coroutine.wrap, coroutine.yield, {}; local function append (t, new) local clone = {} for _, item in ipairs (t) do clone [#clone + 1] = item end clone [#clone + 1] = new return clone end local function permutate (tbl, sub, min) sub = sub or {} min = min or 1 return wrap (function () if #sub > lim then yield (sub); end if #sub < #tbl then for i = min, #tbl do for combo in permutate (tbl, append (sub, tbl [i]), i + 1) do yield (combo) end end end end) end for combo in permutate(array) do --table.sort( combo, self.sortAlphabetical ) table.insert(board, combo); end return board; end 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 so…
has title: getting every combination of every combination of strings in array
accepted answer: http://stackoverflow.com/a/79496450
has answer: http://stackoverflow.com/a/79496450
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/140195572
tagged with: partition
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/140197763
tagged with: lua
has comment: http://stackoverflow.com/comment/140196358
type: AnsweredQuestion
tagged with: combinatorics

http://stackoverflow.com/comment/140267178
score: 0
type: Comment
has text: 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'. If 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'. The 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?
comment on: http://stackoverflow.com/q/79532226
type: QuestionComment

cl
tag name: cl
type: Tag
tags question: http://stackoverflow.com/q/79502556

http://stackoverflow.com/a/79509438
answers question: http://stackoverflow.com/q/79509437
has body: Use the string.format() function to add the newline as \n, also make print warnings a function to be future-safe: local pagetitle local function print_warning(msg) io.stderr:write(string.format('WARNING: %s\n', msg)) end function Header(header) if not pagetitle and header.level == 1 then pagetitle = pandoc.utils.stringify(header) end end function Meta(meta) if not meta.pagetitle then if pagetitle then meta.pagetitle = pagetitle else print_warning('h1 missing, defaulting HTML pagetitle to input filename.') meta.pagetitle = PANDOC_STATE.input_files[1] end return meta end end While writing the question, I figured out an answer myself after finding a matching programming idom.
score: 1
type: Answer
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/79510702
type: Answer
answers question: http://stackoverflow.com/q/79510694
downvote count: 1
has comment: http://stackoverflow.com/comment/140222025
has comment: http://stackoverflow.com/comment/140221720
has comment: http://stackoverflow.com/comment/140224747
has body: Better context? Only suggestion I have is to simply change MouseButton1Up to MouseButton1Down.
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/140223191

http://stackoverflow.com/a/79536118
upvote count: 3
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/79535091
type: AcceptedAnswer
type: Answer
has body: Path in postbuildcommands should be made relative to project; to inform premake that such string contains paths, you have to enclosed them by %[..], i.e postbuildcommands { "{COPYFILE} %[vendor/SDL3/lib/SDL3.dll] %[bin/Debug-windows-x86_64]" } For this kind of postbuildcommands, a good alternative is files "vendor/SDL3/lib/SDL3.dll" filters "files:**.dll" buildaction "Copy" filters {} Which would copy the file only when missing or outdated
accepted answer of: http://stackoverflow.com/q/79535091

http://stackoverflow.com/comment/140178089
has text: 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?
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79466672

http://stackoverflow.com/a/79442297
has body: table.insert needs a value to insert into the table, but [t_header[j]] = t_line[j] 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 looks like an assignment statement, which might confuse someone who comes from C which has assignment expressions which evaluate to the value of the assignment. The OP code could most simply be fixed by changing: table.insert(t_row, [t_header[j]] = t_line[j]) to: t_row[t_header[j]] = t_line[j] This sets the fields of t_row to the right values before inserting the rows into the t_target table. There is no need for table.insert here. To complete the fix, the line local t_row = {} would also need to be moved inside the outer loop so that a new row table is created for each line. 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 split function. The parse_csv function parses an input file into a table. Here the iterator returned by io.lines is saved in lines 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. I have added a simple csv_dump function to print the contents of the parsed csv table. function parse_csv(f) local parsed_csv = {} local lines = io.lines(f) local labels = split(lines(), ",") for line in lines do local t_line = split(line, ",") local t_row = {} for k, v in ipairs(t_line) do t_row[labels[k]] = v end table.insert(parsed_csv, t_row) end return parsed_csv end function csv_dump(t) for i, row in ipairs(t) do io.write(i) io.write(" { ") for k, v in pairs(row) do io.write(k, "=", v, " ") end print("}") end end Sample usage: > parsed = parse_csv('csv_test.txt') > csv_dump(parsed) 1 { "col3"="6.5" "col2"="ab" "col1"="1" } 2 { "col3"="9.7" "col2"="df" "col1"="4" }
accepted answer of: http://stackoverflow.com/q/79442202
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/79442202

http://stackoverflow.com/comment/140208278
type: QuestionComment
score: 1
type: Comment
has text: Why did you add `^` before `|`?
comment on: http://stackoverflow.com/q/79503032

http://stackoverflow.com/q/79529085
score: 0
type: Question
type: UnansweredQuestion
tagged with: roblox
answer count: 0
tagged with: lua
has title: Account for damping while modeling projectile motion
has body: 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: local assemblyLinearVelocity = ball.AssemblyLinearVelocity ball.AssemblyLinearVelocity = assemblyLinearVelocity - assemblyLinearVelocity.Unit * assemblyLinearVelocity.Magnitude ^ 0.755 * heartbeatDeltaTime Since the trajectory module operates with a fixed TimeStep of 0.1, I need to properly account for the heartbeatDeltaTime when applying this damping. How can I effectively integrate this into the trajectory calculations? local TERRAIN = game.Workspace.Terrain local BEAM = Instance.new("Beam") BEAM.Color = ColorSequence.new(Color3.new(1, 0, 0)) BEAM.Transparency = NumberSequence.new(0) BEAM.FaceCamera = true BEAM.Segments = 20 BEAM.Width0 = 0.1 BEAM.Width1 = 0.1 -- Class local Trajectory = {} Trajectory.__index = Trajectory -- Private Functions local function reflect(v, n) return -2*v:Dot(n)*n + v end local function drawBeamProjectile(g, v0, x0, t) local c = 0.5*0.5*0.5 local p3 = 0.5*g*t*t + v0*t + x0 local p2 = p3 - (g*t*t + v0*t)/3 local p1 = (c*g*t*t + 0.5*v0*t + x0 - c*(x0+p3))/(3*c) - p2 local curve0 = (p1 - x0).Magnitude local curve1 = (p2 - p3).Magnitude local b = (x0 - p3).unit local r1 = (p1 - x0).unit local u1 = r1:Cross(b).unit local r2 = (p2 - p3).unit local u2 = r2:Cross(b).unit b = u1:Cross(r1).unit local cfA = CFrame.fromMatrix(x0, r1, u1, b) local cfB = CFrame.fromMatrix(p3, r2, u2, b) local A0 = Instance.new("Attachment") local A1 = Instance.new("Attachment") local Beam = BEAM:Clone() A0.CFrame = cfA A0.Parent = TERRAIN A1.CFrame = cfB A1.Parent = TERRAIN Beam.Attachment0 = A0 Beam.Attachment1 = A1 Beam.CurveSize0 = curve0 Beam.CurveSize1 = -curve1 Beam.Parent = TERRAIN end -- Public Constructors function Trajectory.new(gravity) local self = setmetatable({}, Trajectory) self.Gravity = gravity self.TimeStep = 0.1 self.MaxTime =…

lambda
tag name: lambda
tags question: http://stackoverflow.com/q/79487664
type: Tag

http://stackoverflow.com/comment/140121382
score: 0
comment on: http://stackoverflow.com/q/79435348
type: QuestionComment
has text: This is all I could find on documentation for the profile usage: https://github.com/Project-OSRM/osrm-backend/blob/master/docs/profiles.md
type: Comment

curve
tags question: http://stackoverflow.com/q/79455748
type: Tag
tag name: curve

http://stackoverflow.com/q/79530313
score: 0
type: UnansweredQuestion
tagged with: storyboard
answer count: 0
has body: 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. Here's the code I am using: Copy Edit function hide_info_layer(screen) if screen then gre.set_layer_attrs_global(screen, { hidden = 1 }) else print("Error: screen is nil in hide_info_layer") end end function screen_transition(target_screen) if target_screen then print("Transitioning to:", target_screen) gre.set_value("target_sc", target_screen) gre.send_event("gre.load_screen", target_screen) -- Directly load the screen else print("Error: target_screen is nil in screen_transition") end end function cb_presstart_button(mapargs) local current_screen = mapargs.context_screen local control = mapargs.context_control -- Fetch correct screen name local target_screen = gre.get_value(string.format("%s.screen_name1", control)) print("Current Screen:", current_screen) print("Target Screen:", target_screen) if current_screen == target_screen then print("Already on target screen, no transition needed") return end hide_info_layer(current_screen) if current_screen == "start" then gre.set_value("target_sc", target_screen) print("Triggering animation: punch_NewAnimation") gre.animation_trigger("punch_NewAnimation") else print("Calling screen_transition") screen_transition(target_screen) end end Observed Behavior: The animation punch_NewAnimation does not play when transitioning between screens. The screen changes immediately after calling gre.animation_trigger(), skipping the animation effect. The console prints the expected logs but does not execute the animation before the screen transition. Attempts to Resolve: Delaying Screen Change Until Animation Ends 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. Using Animation Callb…
tagged with: crank
tagged with: lua
type: Question
has title: Issue with Screen Transition Animation Not Playing Before Screen Change in Crank Storyboard

http://stackoverflow.com/comment/140198970
type: QuestionComment
comment on: http://stackoverflow.com/q/79495515
type: Comment
score: 0
has text: 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)

http://stackoverflow.com/comment/140234541
score: 0
comment on: http://stackoverflow.com/a/79516855
has text: nevermind. it seems you were correct. Thank you!
type: AnswerComment
type: Comment

http://stackoverflow.com/q/79522535
has comment: http://stackoverflow.com/comment/140269047
answer count: 0
upvote count: 0
tagged with: lazyvim
has title: html tag auto suggest not working on my nvim lazy config
downvote count: 1
tagged with: neovim
type: Question
type: UnansweredQuestion
has body: look at my nvim config!! https://github.com/souravsspace/config/tree/main/nvim i have copied this(https://github.com/nikolovlazar/dotfiles/tree/main/.config/nvim) and update some... let me know which dir or code i have duplicated and there is an issue: 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!
favorite count: 0
score: -1
tagged with: lua

http://stackoverflow.com/q/79473868
score: -2
has comment: http://stackoverflow.com/comment/140283884
has answer: http://stackoverflow.com/a/79536281
type: Question
tagged with: racing
answer count: 1
type: UnansweredQuestion
downvote count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/140194531
tagged with: lua
has title: How to apply speed boosts dynamically in a Roblox racing game using Lua?
has body: I’m developing a futuristic racing game in Roblox Studio and need help implementing a dynamic speed boost system for vehicles. What I Want to Achieve: Players should be able to activate speed boosts (like nitro or magnetic acceleration) using a key press. The boost should increase the vehicle’s speed temporarily and then gradually return to normal. Boost effects should be smooth and not cause sudden jumps in movement. What I’ve Tried So Far: 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: local vehicle = script.Parent local seat = vehicle:FindFirstChild("VehicleSeat") local boostForce = 5000 -- Example force value local boostDuration = 3 -- Boost lasts for 3 seconds local function activateBoost() if seat and seat.Occupant then seat.Torque = seat.Torque + boostForce wait(boostDuration) seat.Torque = seat.Torque - boostForce end end seat.ChildAdded:Connect(function(child) if child:IsA("Humanoid") then activateBoost() end end) Issues I’m Facing: The boost doesn’t feel smooth—it applies and removes speed too suddenly. I’m unsure if modifying Torque is the best approach. Should I use VectorForce, BodyVelocity, or another method? 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? What Would Help Me: A more gradual speed boost that smoothly increases and decreases. A proper way to bind the boost activation to a key press while the player is driving. Advice on whether Torque, BodyVelocity, or another method is best suited for this. Thanks in advance for any guidance!
tagged with: game-development
tagged with: roblox
upvote count: 0

http://stackoverflow.com/comment/140171677
comment on: http://stackoverflow.com/q/79474052
score: 0
type: QuestionComment
has text: 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.
type: Comment

http://stackoverflow.com/q/79481658
favorite count: 0
score: 0
tagged with: nixos
has body: 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. nix-shell -p lua fails with this error: _addToLuaPath called for dir /nix/store/wnl9qpnhayry14lhcbdafhadsjwsdr6p-patchelf-0.15.0 [ble: exit 127] (The second line is just because I'm using blesh, so I don't think it has anything to do with nix) Incidentally nix-shell works fine with anything other than lua, but other lua versions fail with the same error. (I tried lua5_4_compat) nix-shell --pure -p lua 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. Putting it back into configuration.nix also works as expected, and I can run lua. 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. I'm out of ideas, and any insights would be much appreciated! $lua -v Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio $nix --version nix (Nix) 2.24.12```
has title: What is the meaning/solution for this error installing lua with nix-shell
type: UnansweredQuestion
tagged with: nix
answer count: 0
tagged with: http://stackoverflow.com/tag/c
tagged with: lua
downvote count: 1
type: Question
upvote count: 1

http://stackoverflow.com/comment/140153487
type: AnswerComment
has text: 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
type: Comment
comment on: http://stackoverflow.com/a/79470671
score: 0

http://stackoverflow.com/comment/140083726
has text: 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
type: Comment
score: 0
comment on: http://stackoverflow.com/q/79430494
type: QuestionComment

http://stackoverflow.com/comment/140192424
score: 0
has text: @Jax, there's no _"all of the callbacks"_, you ONLY invoked one callback "Slider1Callback".
type: QuestionComment
comment on: http://stackoverflow.com/q/79487664
type: Comment

http://stackoverflow.com/q/79528284
has body: 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 "vehicle" in its description) is on the objective: local hits = Physics.cast({ origin = center, direction = Vector(0,1,0), type = 3, -- Box cast size = Vector(objectiveRadius * 2, verticalLimit, objectiveRadius * 2), orientation = Vector(0,0,0), max_distance= 0, debug = false }) for _, hit in ipairs(hits) do local obj = hit.hit_object if obj ~= self then local desc = (obj.getDescription() or ""):lower() if desc:find("vehicle") then local ocVal = parseOC(obj) local owner = obj.getGMNotes() or "" -- assign ocVal to Red/Blue, etc. end end end 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. Is 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?
type: Question
type: UnansweredQuestion
score: 0
tagged with: tabletop-simulator
answer count: 0
has title: How to detect is a model is on top of another object in Tabletop simulator
tagged with: lua

http://stackoverflow.com/q/79533393
downvote count: 1
answer count: 1
has body: In Lua, are these two snippets exactly equivalent? repeat ... until &lt;condition&gt; while true do ... if &lt;condition&gt; then break end end At first glance they seem to be equivalent - and I believe they are even in corner cases, for example: Lua evaluates until &lt;condition&gt; in the scope of the loop body. (Unlike in C, where a similar pair of do/while and while loops would not be equivalent because C evaluates the condition in the outer scope.) Lua doesn't have continue, which would jump to until &lt;condition&gt; in the first loop and while true in the second. However, are there any other corner cases where they behave differently? Or are they exactly equivalent?
tagged with: do-while
has answer: http://stackoverflow.com/a/79537491
favorite count: 0
has comment: http://stackoverflow.com/comment/140262543
score: 0
has title: In Lua, is `repeat ... until condition` equivalent to `while true ... if condition break`?
has comment: http://stackoverflow.com/comment/140266076
type: Question
upvote count: 1
type: UnansweredQuestion
tagged with: while-loop
has comment: http://stackoverflow.com/comment/140262530
tagged with: lua

http://stackoverflow.com/a/79432341
answers question: http://stackoverflow.com/q/79432340
downvote count: 0
has body: Currently, it seems no way to arbitrarily replace any Unicode character using listchars (issues:22017) You can consider using nvim_create_autocmd to target specific events {BufRead, ...} to change the color of specific content to make it more noticeable vim.api.nvim_create_autocmd( { "BufRead", "BufNewFile" }, { group = vim.api.nvim_create_augroup("HighlightFullWidthSpace", {}), pattern = "*", callback = function() local groupNameCJKSpace = "CJKFullWidthSpace" vim.fn.matchadd(groupNameCJKSpace, ' ') -- Create group mapping: Match the special symbol U+3000 -- vim.fn.matchadd(groupNameCJKSpace, 'A') -- If you want to apply this color to other content, you can add multiple matchadd -- Set highlighting for this group vim.api.nvim_set_hl(0, groupNameCJKSpace, { bg = "#a6a6a6", -- Background color fg = 'white', -- Foreground color -- You can also add other attributes, such as: -- bold = true, -- italic = true, -- underline = true }) -- (Another example below) local groupNameTODO = "myTODO" vim.fn.matchadd(groupNameTODO, 'TODO .*') vim.api.nvim_set_hl(0, groupNameTODO, { fg = "#8bb33d", italic = true }) end } ) #a6a6a6 #8bb33d italic
score: 1
type: Answer
upvote count: 1

comb
tags question: http://stackoverflow.com/q/79455748
type: Tag
tag name: comb

http://stackoverflow.com/comment/140083480
score: 0
has text: 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%]"')
type: QuestionComment
comment on: http://stackoverflow.com/q/79430494
type: Comment

http://stackoverflow.com/comment/140269047
has text: 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
comment on: http://stackoverflow.com/q/79522535
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/140266661
type: Comment
has text: 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).
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/79537123

http://stackoverflow.com/comment/140074214
has text: 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.
score: 1
type: Comment
comment on: http://stackoverflow.com/q/79423689
type: QuestionComment

http://stackoverflow.com/a/79486947
type: AcceptedAnswer
upvote count: 2
answers question: http://stackoverflow.com/q/79484591
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79484591
has body: The end keyword needs to be on the line above theme and then you're missing a closing brace + parenthesis }) below background. Tables need to be closed {} as do function calls (), so maybe make it a habit to go through and count the open vs closing characters to make sure they are equal. 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.

http://stackoverflow.com/q/79537123
favorite count: 0
score: -1
tagged with: lua
has title: calling for an external scripts from lua program on Windows
upvote count: 0
tagged with: windows
has answer: http://stackoverflow.com/a/79537215
has body: 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. Here is the way I managed to run the script and it is working perfectly: local command = ""csv2xls.cmd" -fs D:\proj\qlua100\app\data\source\orders_cancelled.csv -fd D:\proj\qlua100\app\data\source\orders_cancelled.xlsx --zoom 90" os.execute(command) but I do not understand this way of merger between Lua and Windows CMD features in a way of running this code. What double square brackets mean at the beginning and at the end of the code? What is the meaning of quotes? I would like to replace those long file names with variables. But the sequence after the equal sign is not the string. How this line works from Lua stand point? Could someone explain it please or point me to the article(s) which does.
downvote count: 1
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/140266661
type: UnansweredQuestion

http://stackoverflow.com/comment/140199617
has text: Because `Engine.run` is nil when you set it to `Engine.__call`.
type: Comment
score: 6
type: QuestionComment
comment on: http://stackoverflow.com/q/79498050

http://stackoverflow.com/a/79469009
accepted answer of: http://stackoverflow.com/q/79468949
score: 1
has body: Early Lua manual has an equivalent code for the for statement: for v = e1, e2, e3 do block end -- is equivalent to the code: do local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3) if not (var and limit and step) then error() end while (step &gt; 0 and var &lt;= limit) or (step &lt;= 0 and var &gt;= limit) do local v = var block var = var + step end end It can be seen that the loop variable v is declared at the beginning of each iteration, in other words, the loop variable for each iteration is independent.
answers question: http://stackoverflow.com/q/79468949
type: AcceptedAnswer
type: Answer
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/140193118
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/79489801
score: 0
type: QuestionComment

http://stackoverflow.com/comment/140118295
type: AnswerComment
comment on: http://stackoverflow.com/a/79446293
type: Comment
has text: Thank you for the clarification. I just found 2 workarounds: 1) use an Identity function `function ID(...) return ... end` and then `a, b = ID(\ntext\n:find('pollo')\n)` works. 2) `a, b = text:\nfind('pollo')` since `:` allows to continue to next line.
score: 1

http://stackoverflow.com/a/79537215
score: 0
answers question: http://stackoverflow.com/q/79537123
has body: After David's explanation. Here is the better version of the code: local fs = 'D:\\proj\\qlua100\\app\\data\\source\\orders_daily.csv' local fd = 'D:\\proj\\qlua100\\app\\data\\source\\orders_daily.xlsx' local command = '""csv2xls.cmd" -fs '..fs..' -fd '..fd..' --zoom 90"' os.execute(command) I replaced double square brackets with single quotes and added escapes for slashes. Now it is possible to use variables. Double 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. This version is much better to my eyes. Thank you David for your help.
type: Answer

http://stackoverflow.com/a/79514668
has body: The easiest way to remove everything with one line would be to put all of the clones into a Folder 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. So try something like this : Have your spawner block create a Folder for all of its clones in the Workspace called LagFolder Create a RemoteEvent in ReplicatedStorage called DestroyLagFolder Have the LocalScript that listens to your your mouse button events fire the RemoteEvent. local DestroyLagFolderEvent : RemoteEvent = game.ReplicatedStorage.DestroyLagFolder script.Parent.MouseButton1Up:Connect(function() -- tell the server to destroy all the spawned clones DestroyLagFolderEvent:FireServer() end) Have the part spawner Script listen for when the RemoteEvent event gets fired. local PART_SPAWN_TIME = 1 --second -- create a place for all of the clones to go local LagFolder = Instance.new("Folder") LagFolder.Parent = game.Workspace -- listen for when the event fires to clean up all of the clones and the spawner local DestroyLagFolderEvent : RemoteEvent = game.ReplicatedStorage.DestroyLagFolder DestroyLagFolderEvent.OnServerEvent:Connect(function(player) LagFolder:Destroy() script.Parent:Destroy() end) -- start creating clones while wait(PART_SPAWN_TIME) do local clonepart = script.Parent:Clone() clonepart.Parent = LagFolder clonepart.Anchored = false end
accepted answer of: http://stackoverflow.com/q/79510694
answers question: http://stackoverflow.com/q/79510694
score: 3
type: AcceptedAnswer
type: Answer
upvote count: 3
downvote count: 0

http://stackoverflow.com/comment/140262543
score: 1
type: Comment
has text: @RichardChambers - I think any `goto`s and labels inside the `...` would behave the same in both cases
type: QuestionComment
comment on: http://stackoverflow.com/q/79533393

http://stackoverflow.com/comment/140197956
type: Comment
has text: 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.
comment on: http://stackoverflow.com/q/79495515
score: 0
type: QuestionComment

http://stackoverflow.com/comment/140224747
comment on: http://stackoverflow.com/a/79510702
type: AnswerComment
score: 1
type: Comment
has text: 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).

http://stackoverflow.com/q/79516964
favorite count: 0
has title: Invalid size error message from Afree function in LuaJIT
has body: We use LuaJIT 2.1 to run a Lua service on Linux. We see in the system logs in /var/log/messages that the service crashes from time to time with the following error message: bash[&lt;pid&gt;]: Afree(): invalid size afree is mentioned in https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/lj_asm.c Any idea why this error happens? Thanks
type: Question
upvote count: 1
downvote count: 0
type: UnansweredQuestion
answer count: 0
score: 1
tagged with: luajit
tagged with: lua

http://stackoverflow.com/q/79546827
type: Question
has body: I want to modify the Transparency value of each instance of a collision group, named Obstaculos1, but I don't know how. I've tried doing it by registering the group with something like this: for key, value in pairs(PhysicsService:GetRegisteredCollisionGroup("Obstaculos1"):GetChildren()) do value.Transparency = 0 end But that didn't work. I also tried to do it indexing the group in a weird way that I thought of: for key, value in pairs(PhysicsService.Obstaculos1:GetChildren()) do value.Transparency = 0 end But that didn't work either. I'm completely dry right now. Any help is welcomed.
answer count: 1
type: UnansweredQuestion
has title: How do I modify the value of each instance of a collision group?
tagged with: lua
tagged with: collision
tagged with: roblox
score: 0

http://stackoverflow.com/q/79432701
tagged with: lua
has body: _Version returns Lua 5.4 I have installed /actboy168 extensions and would like to debug in 5.2 How do I force visual studio code to use 5.2? as can be seen below lua52 exists on my pc actboy168 .vscode\extensions\actboy168.lua-debug-2.0.11-win32-x64\runtime\win32-ia32\lua52 I'm wondering where the system knows to look for the 5.4 exe so I can change the default. my launch.json file is shown below. { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "arg": [], "name": "launch", //"program": "${workspaceFolder}/main.lua", "program": "${workspaceFolder}/main Dm.lua", "request": "launch", "stopOnEntry": true, "type": "lua" }, { "name": "Debug Lua Interpreter", "type": "lua-local", "request": "launch", "program": { "lua": "lua", "file": "${file}" } }, { "name": "Debug Custom Lua Environment", "type": "lua-local", "request": "launch", "program": { "command": "command" }, "args": [] } ] }
type: Question
type: UnansweredQuestion
score: 0
has title: use Lua 5.2 not 5.4 with visual studio code so I am sure code will work on 5.2 systems
answer count: 0

http://stackoverflow.com/comment/140112597
comment on: http://stackoverflow.com/q/79439624
type: QuestionComment
score: 1
type: Comment
has text: @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.

combinatorics
tag name: combinatorics
tags question: http://stackoverflow.com/q/79495515
type: Tag

http://stackoverflow.com/comment/140184448
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/79460555
has text: 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.

http://stackoverflow.com/comment/140262530
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/79533393
type: Comment
has text: If you are concerned about `continue` then should you be concerned about `goto` (http://lua-users.org/wiki/GotoStatement ) as well?

http://stackoverflow.com/a/79546763
type: Answer
answers question: http://stackoverflow.com/q/79538692
score: -1
downvote count: 1
upvote count: 0
has body: I found the solution. I created a remote event that sent a request switch GUI to the client

http://stackoverflow.com/comment/140260062
type: Comment
comment on: http://stackoverflow.com/q/79532226
type: QuestionComment
has text: Try setting `$wgScribuntoEngineConf['luastandalone']['luaPath']` to `(whatever)/lua5_1_5_linux_64_generic/lua`.
score: 0

storyboard
tags question: http://stackoverflow.com/q/79530313
type: Tag
tag name: storyboard

http://stackoverflow.com/a/79456636
upvote count: 1
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/79455748
has body: Here was the solution: Determining curvature of polylines -- function to calculate the curvature of a polyline segment using three points local function calculatePolylineCurvature(p1x, p1y, p2x, p2y, p3x, p3y) -- https://gis.stackexchange.com/questions/195370/determining-curvature-of-polylines -- compute the determinant (signed area of the triangle) local numerator = 2 * ((p2x - p1x) * (p3y - p2y) - (p2y - p1y) * (p3x - p2x)) -- compute the product of the three segment lengths local len1 = (p2x - p1x)^2 + (p2y - p1y)^2 local len2 = (p3x - p2x)^2 + (p3y - p2y)^2 local len3 = (p1x - p3x)^2 + (p1y - p3y)^2 local denominator = math.sqrt(len1 * len2 * len3) -- prevent division by zero if denominator == 0 then return nil end return -8.1*numerator / denominator -- just to set the same scale as Bezier curvature end -- function to calculate the normal vector to the polyline segment local function calculatePolylineNormal(p1x, p1y, p2x, p2y, p3x, p3y) return p1y - p3y, p3x - p1x end The main function: polyline = {100,300,160,257,220,242,280,250,340,271,400,300,460,329,520,350,580,358,640,343,700,300} local length = 20 polylineCurvatureLines = {} polylineCurvatureHeightLine = {} table.insert (polylineCurvatureHeightLine, polyline[1]) table.insert (polylineCurvatureHeightLine, polyline[2]) for i = 3, #polyline - 3, 2 do local p1x, p1y = polyline[i-2], polyline[i-1] local p2x, p2y = polyline[i], polyline[i+1] local p3x, p3y = polyline[i+2], polyline[i+3] local k = calculatePolylineCurvature(p1x, p1y, p2x, p2y, p3x, p3y) local nx, ny = calculatePolylineNormal (p1x, p1y, p2x, p2y, p3x, p3y) nx = nx * k * length ny = ny * k * length table.insert (polylineCurvatureLines, {p2x, p2y, p2x + nx, p2y + ny}) table.insert (polylineCurvatureHeightLine, p2x + nx) table.insert (polylineCurvatureHeightLine, p2y + ny) end table.insert (polylineCurvatureHeightLine, polyline[#polyline-1]) table.insert (polylineCurvatureHeightLine, polyline[#polyline]) The result: Update: It has a mistake! The curv…
answers question: http://stackoverflow.com/q/79455748
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/79508638
score: 1
type: Answer
upvote count: 1
downvote count: 0
has body: Since this is a LocalScript, you can use game.Players.LocalPlayer.Character.HumanoidRootPart.Position to get the Vector3 of the player's character. If you want to get the CFrame of the player's character, use game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame. Example: print(game.Players.LocalPlayer.Character.HumanoidRootPart.Position) --&gt; 0, 5, 0 (example value) -- To get rotation: print(game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame.Rotation) --&gt; 0, 0, 0 (example value)
answers question: http://stackoverflow.com/q/79494448

http://stackoverflow.com/a/79542959
downvote count: 0
score: 1
has body: how does it work? Why does it give true_value if the condition is true? Lua has a few concepts that are necessary to understand to give a complete answer here. Logical operators It's first important to understand how and and or work - which may seem obvious but for completeness, from the official docs: The operator and returns its first argument if it is false; otherwise, it returns its second argument And also: The operator or returns its first argument if it is not false; otherwise, it returns its second argument Operator precedence Also from the docs, operator precedence: and has a higher precedence than or That means that this code from the question: local result = condition and true_value or false_value Can be read as: local result = (condition and true_value) or false_value These two code examples are functionally identical. Booleans and truthiness If you're new to lua, booleans can be surprising. false and nil as false and anything else as true Why do I point this out? because the concept of truthiness is quite different in lua, all of these evaluate to true: 0 "" {} Scenarios Let's look at a few scenarios to drill things home. condition is True > condition=true > true_value="true value" > false_value="false value" > result = (condition and true_value) or false_value > result true value In this case: The first argument to and is not false or nil The second argument to and is evaluated it is not false or nil, so it is returned The first argument to or is not false or nil so false_value is not evaluated The first argument is returned condition is False > condition=false > true_value="true value" > false_value="false value" > result = (condition and true_value) or false_value > result false value In this case: The first argument to and is false The second argument to and is not evaluated The first argument to or is false so false_value is evaluated and returned Gotcha scenarios There are many scenarios that can trip folks up unfamiliar with lua. condition is tru…
answers question: http://stackoverflow.com/q/79542847
upvote count: 1
type: Answer

http://stackoverflow.com/comment/140279517
type: QuestionComment
score: 0
has text: This is missing necessary code to reproduce the error.
type: Comment
comment on: http://stackoverflow.com/q/79544735

boolean-logic
type: Tag
tag name: boolean-logic
tags question: http://stackoverflow.com/q/79542847

http://stackoverflow.com/comment/140164513
type: QuestionComment
score: 0
type: Comment
has text: 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`.
comment on: http://stackoverflow.com/q/79474052

http://stackoverflow.com/comment/140199656
type: QuestionComment
comment on: http://stackoverflow.com/q/79498050
type: Comment
has text: It should be able to access `Engine.run`, but `Engine.__call` IS STILL NIL.
score: 4

http://stackoverflow.com/comment/140187096
type: QuestionComment
comment on: http://stackoverflow.com/q/79488085
type: Comment
score: 0
has text: 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).

http://stackoverflow.com/q/79432340
has answer: http://stackoverflow.com/a/79432341
tagged with: neovim
upvote count: 1
downvote count: 0
has body: I'm using Neovim and want to use listchars to replace certain Unicode code points, such as U+3000 (Ideographic Space) with U+2B1C (White Large Square). vim.opt.listchars = { tab = '→ ', -- space = '•', trail = '·', -- extends = '&gt;', -- precedes = '&lt;', -- eol = '⏎', nbsp = ' ', -- ['U+3000'] = '⬜' -- Ineffective } Is there a way to achieve this or make it easier to recognize?
score: 1
has title: Customizing and Color-Highlighting Specific Unicode Characters in Neovim
tagged with: lua
type: Question
answer count: 1
type: UnansweredQuestion
favorite count: 0

http://stackoverflow.com/comment/140179524
comment on: http://stackoverflow.com/q/79484591
has text: `terminalColors = { 0,17 = true },` ? `17=true` ? and your syntax for the `overrides` function is bad
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/140202789
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79488085
type: Comment
has text: 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 = {} }`

http://stackoverflow.com/comment/140145822
type: Comment
comment on: http://stackoverflow.com/q/79466672
score: 0
type: QuestionComment
has text: You forgot to include the function in your question.

http://stackoverflow.com/comment/140222025
comment on: http://stackoverflow.com/a/79510702
score: 0
has text: 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?
type: AnswerComment
type: Comment

qsys
type: Tag
tag name: qsys
tags question: http://stackoverflow.com/q/79497648

http://stackoverflow.com/a/79439772
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/79439624
type: Answer
upvote count: 5
has body: Because Lua's syntax defines that expressions in parentheses can only be a single expression: exp ::= nil | false | true | Numeral | LiteralString | ‘...’ | functiondef | prefixexp | tableconstructor | exp binop exp | unop exp prefixexp ::= var | functioncall | ‘(’ exp ‘)’ This is also mentioned in the manual: Lua 5.1-5.3 Any expression enclosed in parentheses always results in only one value. Lua 5.4 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.

http://stackoverflow.com/comment/140092999
has text: 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.
comment on: http://stackoverflow.com/a/79430801
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/140186783
type: Comment
has text: 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.
score: 0
comment on: http://stackoverflow.com/q/79489801
type: QuestionComment

windows64
tag name: windows64
type: Tag
tags question: http://stackoverflow.com/q/79502556

element
type: Tag
tags question: http://stackoverflow.com/q/79442202
tag name: element

http://stackoverflow.com/comment/140197763
comment on: http://stackoverflow.com/q/79495515
type: QuestionComment
score: 1
type: Comment
has text: @Aer, you have `{ "aeb", "d", "c"};` in your example, but it is supposed to be incorrect, is it?

http://stackoverflow.com/comment/140283730
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/79544120
has text: 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()`?

semantic-mediawiki
tags question: http://stackoverflow.com/q/79532226
tag name: semantic-mediawiki
type: Tag

http://stackoverflow.com/tag/csv
tag name: csv
type: Tag
tags question: http://stackoverflow.com/q/79442202

isometric
tags question: http://stackoverflow.com/q/79460373
type: Tag
tag name: isometric

http://stackoverflow.com/comment/140199723
has text: You are right. Thank you
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/79498050

http://stackoverflow.com/comment/140110513
score: 0
has text: @gsck What? This doesn't seem to work with `a, b = unpack({text:find("e")})`
comment on: http://stackoverflow.com/q/79439624
type: QuestionComment
type: Comment

http://stackoverflow.com/q/79487664
has comment: http://stackoverflow.com/comment/140195107
has comment: http://stackoverflow.com/comment/140184901
has comment: http://stackoverflow.com/comment/140182922
score: 0
has comment: http://stackoverflow.com/comment/140185139
type: Question
tagged with: lambda
type: UnansweredQuestion
has body: 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. Here's some sample code to re-create the problem: gameInstance = {} gameInstance.State = {} gameInstance.State.GetPlayerCountry = function() local country = {} country.GetInterestGroups = function() local iglist = {} iglist[1] = "ig1"; iglist[2] = "ig2"; iglist[3] = "ig3"; return iglist; end; return country; end; gameState = gameInstance.State; playerCountry = gameState.GetPlayerCountry(); interestGroups = playerCountry.GetInterestGroups(); for i in ipairs(interestGroups) do local elementID = 'Slider' .. i; local onClickCallbackID = elementID .. 'Callback'; print(onClickCallbackID); --layout.CreateElementFromTemplate('slider_template', parentElementID); --layout.SetOnClickCallback(elementID, onClickCallbackID); _G[onClickCallbackID] = function() --local layout = layoutController.xmlLayoutProxy; print('Testing a dynamic callback ' .. elementID); end; Slider1Callback(); end; This produces the following output (quite unexpectedly): 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. Why is this happening? Is there any way to fix this.
answer count: 0
has comment: http://stackoverflow.com/comment/140193469
tagged with: functional-programming
tagged with: code-generation
has comment: http://stackoverflow.com/comment/140192424
has title: How can I pass variables to a procedurally generated global function in Lua?
tagged with: lua

http://stackoverflow.com/q/79489801
has comment: http://stackoverflow.com/comment/140193118
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/140186783
has title: Is it possible to create the algorithm in the table with code?
downvote count: 0
has answer: http://stackoverflow.com/a/79494490
accepted answer: http://stackoverflow.com/a/79494490
favorite count: 0
has comment: http://stackoverflow.com/comment/140186497
tagged with: lua
upvote count: 2
has body: Below is a table of RGB color codes. When I use this table in a form with lua code, I create a 13*9 color tone panel. Is 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)? 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} The color palette that the table creates. 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. The final output is clear in the picture. How can we solve this? I 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. EDIT: I think the closest I could get to the result by taking 2 rows (26 color tones) from the table is as follows: local base_colors = {0x000033, …
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/140184901
type: QuestionComment
comment on: http://stackoverflow.com/q/79487664
type: Comment
score: 0
has text: @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".

http://stackoverflow.com/comment/140227816
type: Comment
score: 1
comment on: http://stackoverflow.com/q/79513489
type: QuestionComment
has text: 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.

http://stackoverflow.com/a/79537491
has body: The bytecode is almost identical in both cases (using Lua 5.4.7): % cat 1 local a,b repeat a() until b() % luac -l 1 main &lt;1:0,0&gt; (9 instructions at 0x7f842d406230) 0+ params, 3 slots, 1 upvalue, 2 locals, 0 constants, 0 functions 1 [1] VARARGPREP 0 2 [1] LOADNIL 0 1 ; 2 out 3 [3] MOVE 2 0 4 [3] CALL 2 1 1 ; 0 in 0 out 5 [4] MOVE 2 1 6 [4] CALL 2 1 2 ; 0 in 1 out 7 [4] TEST 2 0 8 [4] JMP -6 ; to 3 9 [4] RETURN 2 1 1 ; 0 out % cat 2 local a,b while true do a() if b() then break end end % luac -l 2 main &lt;2:0,0&gt; (10 instructions at 0x7fa46dc06230) 0+ params, 3 slots, 1 upvalue, 2 locals, 0 constants, 0 functions 1 [1] VARARGPREP 0 2 [1] LOADNIL 0 1 ; 2 out 3 [3] MOVE 2 0 4 [3] CALL 2 1 1 ; 0 in 0 out 5 [4] MOVE 2 1 6 [4] CALL 2 1 2 ; 0 in 1 out 7 [4] TEST 2 1 8 [4] JMP 1 ; to 10 9 [4] JMP -7 ; to 3 10 [5] RETURN 2 1 1 ; 0 out
score: 0
answers question: http://stackoverflow.com/q/79533393
type: Answer

http://stackoverflow.com/q/79504829
has title: Redisson with Redis function is adding a special character while sending the input
answer count: 1
has comment: http://stackoverflow.com/comment/140211406
tagged with: redis-cluster
score: 0
has body: Redis func is registered having the body redis.register_function('eval_resources', function(keys, args) return type(args[1]) .. " " .. args[1] end) Caller's code Object[] argsList = {"123", "abc"}; String res2 = function.call( FunctionMode.WRITE, "eval_resources", FunctionResult.STRING, Collections.emptyList(), argsList); Response I am getting string 12� Due to this encoding issue, I am not able to parse integer as an input inside Lua script. I tried removing the end character, still the input cannot be parsed to integer. redis.register_function('eval_resources', function(keys, args) local actual_val = tostring(string.sub(args[1], 1, 2)) local numericalVal = tonumber(actual_val) return type(actual_val) .. " " .. actual_val .. " type of num ->" .. type(numericalVal) end) This is working perfectly with redis-cli.
tagged with: redis
tagged with: redisson
tagged with: lua
type: Question
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/79505018

http://stackoverflow.com/comment/140170298
score: 0
type: QuestionComment
has text: 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.
type: Comment
comment on: http://stackoverflow.com/q/79461719

http://stackoverflow.com/q/79532226
has title: Lua error: Internal error: The interpreter has terminated with signal "11"
type: Question
has comment: http://stackoverflow.com/comment/140267178
type: UnansweredQuestion
tagged with: mediawiki
tagged with: semantic-mediawiki
score: 0
answer count: 0
has comment: http://stackoverflow.com/comment/140260062
has comment: http://stackoverflow.com/comment/140270944
has comment: http://stackoverflow.com/comment/140267226
tagged with: lua
has body: I am getting this error while trying to use Semantic MediaWiki. MediaWiki 1.41.4 PHP 8.2.27 (litespeed) ICU 76.1 MySQL 8.0.33-cll-lve Lua 5.1.5 Semantic MediaWiki 4.2.0 Semantic Scribunto 2.3.2 I have followed the [instructions here]1 that say 'Scribunto should work for you out of the box if'. And I have: Linux x86-64 PHP's proc_open function is not restricted. proc_terminate and shell_exec are not disabled in PHP. lua5_1_5_linux_64_generic/lua is set to 755 SELinux is not running on my server. LocalSettings.php includes $wgScribuntoDefaultEngine = 'luastandalone'; $wgScribuntoEngineConf['luastandalone']['errorFile'] = "$IP/images/temp/lua-error.log"; I attempted to verify that lua is running. [home@az1-ss108 lua5_1_5_linux_64_generic]$ file lua lua: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, stripped So it seems to be running. It is not working out of the box. lua-error.log contains: (edited. original post contained contents of wrong error file) /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 /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 I tried using $wgScribuntoEngineConf['luastandalone']['luaPath'] = '/usr/bin/lua, but the version running on my server is 5.2, so this is not a workaround.
has comment: http://stackoverflow.com/comment/140270145
has comment: http://stackoverflow.com/comment/140272214

http://stackoverflow.com/comment/140208284
type: Comment
has text: @shingo Saw others doing it, thought I would need it, and it does work in some of the cmd.exe calls…
score: 0
comment on: http://stackoverflow.com/q/79503032
type: QuestionComment

http://stackoverflow.com/comment/140193469
score: 1
type: Comment
comment on: http://stackoverflow.com/q/79487664
has text: What happens if you replace `Slider1Callback()` with `_G[onClickCallbackID]()`? Also, in Lua, semicolons are usually not used.
type: QuestionComment

http://stackoverflow.com/comment/140143705
comment on: http://stackoverflow.com/q/79465076
type: QuestionComment
score: 0
has text: that'll do! took me a second to figure it out, but that will do what i'm looking for!
type: Comment

http://stackoverflow.com/comment/140104944
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/79442202
type: Comment
has text: @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.

http://stackoverflow.com/comment/140199648
comment on: http://stackoverflow.com/q/79498050
type: QuestionComment
has text: 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`.
score: 0
type: Comment

http://stackoverflow.com/comment/140187868
type: Comment
score: 0
comment on: http://stackoverflow.com/q/79488085
type: QuestionComment
has text: @KyleF.Hartzenberg OK and posted.

http://stackoverflow.com/comment/140256859
type: Comment
score: 1
comment on: http://stackoverflow.com/q/79530243
has text: 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`?
type: QuestionComment

http://stackoverflow.com/comment/140227806
comment on: http://stackoverflow.com/q/79513489
type: QuestionComment
score: 0
has text: 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")
type: Comment

http://stackoverflow.com/comment/140207610
score: 0
comment on: http://stackoverflow.com/q/79502556
type: QuestionComment
type: Comment
has text: Add `/MACHINE:X64`

http://stackoverflow.com/comment/140280158
has text: Please provide the code that, when copied into an editor and executed, causes the error or problematic behavior.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/79544735

http://stackoverflow.com/comment/140196358
has text: 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.].
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/79495515

parentheses
tags question: http://stackoverflow.com/q/79439624
tag name: parentheses
type: Tag

do-while
type: Tag
tag name: do-while
tags question: http://stackoverflow.com/q/79533393

json-rpc
tag name: json-rpc
tags question: http://stackoverflow.com/q/79474052
type: Tag

mod-rewrite
tag name: mod-rewrite
type: Tag
tags question: http://stackoverflow.com/q/79475503

http://stackoverflow.com/q/79497648
tagged with: qsys
score: 0
tagged with: equalizer
tagged with: lua
has body: 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. Here’s the core of my implementation: local Props = Properties["Channel Count"].Value CurrentChannel = 1 SelectedBandPoint = 1 local Channels = {} for i = 1, Props do local channel = { Name = "Channel " .. i, Display = "", High_PassFilter = 20, Low_PassFilter = 20000, LinkGroup = nil, Bandpoints = {}, Filters = {} } table.insert(channel.Bandpoints, {freq = 23.3, gain = 0, BW = 1.0,fill="#996633", offcolor="#472E16"}) table.insert(channel.Bandpoints, {freq = 54.1, gain = 0, BW = 1.0,fill="#FF0000", offcolor="#7C0000"}) table.insert(channel.Bandpoints, {freq = 126, gain = 0, BW = 1.0,fill="#FF9900", offcolor="#7C4700"}) table.insert(channel.Bandpoints, {freq = 293, gain = 0, BW = 1.0,fill="#FFFF00", offcolor="#7C7C00"}) table.insert(channel.Bandpoints, {freq = 682, gain = 0, BW = 1.0,fill="#00FF00", offcolor="#007C00"}) table.insert(channel.Bandpoints, {freq = 1590, gain = 0, BW = 1.0,fill="#0000FF", offcolor="#00007C"}) table.insert(channel.Bandpoints, {freq = 3690, gain = 0, BW = 1.0,fill="#FF00FF", offcolor="#7C007C"}) table.insert(channel.Bandpoints, {freq = 8600, gain = 0, BW = 1.0,fill="#CCCCCC", offcolor="#626262"}) --[High-Pass Filter]-- table.insert(channel.Filters, {freq = 20, gain = -6, fill="#000000"}) --[Low-Pass Filter]-- table.insert(channel.Filters, {freq = 20000, gain = -6, fill="#000000"}) table.insert(Channels, channel) end function draw() local doc = EzSVG.Document(1045, 598) -- SVG canvas size local grid_left = 64.686971 -- Leftmost grid line local grid_right = 1044.5671 -- Rightmost grid line local grid_top = 26.333343 -- Topmost grid line local grid_bottom = 586.12834 -- …
type: Question
tagged with: http://stackoverflow.com/tag/svg
type: UnansweredQuestion
has title: How do I draw a EQ Curve based on 8 bandpoints?
answer count: 0
tagged with: audio

http://stackoverflow.com/comment/140137220
has text: 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`
comment on: http://stackoverflow.com/q/79461719
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/140093038
comment on: http://stackoverflow.com/a/79430801
score: 1
has text: 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.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/79470671
has body: Try moving the touch event function outside the for loop. head = script.Parent.PrimaryPart local function triggershoot(part) local beam = Instance.new("Part",script.Parent) beam.Anchored = true beam.CanCollide = false beam.Shape = "Block" beam.CFrame = head.CFrame beam.Size = Vector3.new(0.5,0.5,0.5) beam.Material = "Plastic" beam.BrickColor = BrickColor.new("Dark taupe") beam.CFrame = CFrame.lookAt(head.Position,part.Position) beam.Touched:Connect(function(plr) local char=plr.Parent local hum=char and char:FindFirstChildOfClass"Humanoid" if char:HasTag("enemy") then hum:TakeDamage(3) beam:Destroy() end end) for i = 0, 50, 1 do wait() beam.CFrame = beam.CFrame + beam.CFrame.LookVector end beam:Destroy() end while true do wait() local parts = workspace:GetPartsInPart(script.Parent.zone) for _, part in ipairs(parts) do local h=part.Parent;h=h and h:FindFirstChildOfClass"Humanoid" if part:HasTag"enemy"and h and h.Health > 0 then local update = CFrame.lookAt(head.Position,part.Position) head.CFrame = update coroutine.wrap(triggershoot)(part) wait(1) break end end end
score: 0
has comment: http://stackoverflow.com/comment/140153487
accepted answer of: http://stackoverflow.com/q/79470375
answers question: http://stackoverflow.com/q/79470375
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/140104696
comment on: http://stackoverflow.com/q/79442202
has text: Here is a canonical question: https://stackoverflow.com/questions/41585078/how-do-i-read-and-write-csv-files
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/140255258
comment on: http://stackoverflow.com/q/79530243
has text: The error tries to tell you that `map` is a number.
type: QuestionComment
score: 3
type: Comment

http://stackoverflow.com/tag/svg
tags question: http://stackoverflow.com/q/79497648
tag name: svg
type: Tag

http://stackoverflow.com/comment/140195572
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/79495515
type: Comment
has text: 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?

http://stackoverflow.com/a/79494490
has body: The following code generates a palette as a two-dimentional Lua table: local abs, floor = math.abs, math.floor -- https://www.rapidtables.com/convert/color/hsv-to-rgb.html local function hsv2rgb (h, s, v) local c = s * v local x = c * (1 - abs ((h / 60) % 2 - 1)) local m = v - c local cases = { { c, x, 0 }, -- h ∈ [0°; 60°) { x, c, 0 }, -- h ∈ [60°; 120°) { 0, c, x }, -- h ∈ [120°; 180°) { 0, x, c }, -- h ∈ [180°; 240°) { x, 0, c }, -- h ∈ [240°; 300°) { c, 0, x } -- h ∈ [300°; 360°) } local rgb = {} for _, colour in ipairs (cases [floor (h / 60) + 1]) do rgb [#rgb + 1] = (colour + m) * 255 end return rgb end local function palette (v_start, v_end, v_step, h_start, h_step) local h_steps = floor (360 / abs (h_step)) local plt = {} for v = v_start, v_end, v_step do local gray = (v - v_start) / (v_end - v_start) local s = 1 -- Excessive brightness reduces saturation: if v &gt; 1 then s = s - (v - 1) v = 1 end local row = {} for h = h_start, h_start + h_step * (h_steps - 1), h_step do row [#row + 1] = hsv2rgb (h % 360, s, v) end -- Grays: row [#row + 1] = hsv2rgb (0, 0, gray) plt [#plt + 1] = row end return plt end local as_linked = palette (0.2, 1.8, 0.2, 0, 30) local as_in_clrtbl = palette (0.2, 1.8, 0.2, 240, -30) 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 hsv2rgb(). The gray column is produced by a special rule, with increasing brightness. palette() gets parametres: v_start — brightness of the top row; in [0; 1], v_end — brightness of the bottom row; in [0; 1], v_step — brightness increment; in (0, 1], h_start — hue of the first column; in [0, 360), 0 meaning red, 180, cyan, h_step — hue increment; in (-360, 360), positive meaning red to violet, negative, violet to red. palette (0.2, 1.8, 0.2, 0, 30) will produce approximately the table that you linked. palette (0.2, 1.8, 0.2, 240, -30) will produc…
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/79489801
answers question: http://stackoverflow.com/q/79489801
has comment: http://stackoverflow.com/comment/140194691

http://stackoverflow.com/comment/140280072
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79544735
has text: What do you propose I do to reproduce it?
type: Comment

partition
tags question: http://stackoverflow.com/q/79495515
tag name: partition
type: Tag

collision
type: Tag
tags question: http://stackoverflow.com/q/79546827
tag name: collision

vb.net
tags question: http://stackoverflow.com/q/79483284
type: Tag
tag name: vb.net

nixos
tags question: http://stackoverflow.com/q/79481658
tag name: nixos
type: Tag

boolean-operations
tags question: http://stackoverflow.com/q/79542847
tag name: boolean-operations
type: Tag

2d-games
tags question: http://stackoverflow.com/q/79460373
type: Tag
tag name: 2d-games

color-scheme
type: Tag
tags question: http://stackoverflow.com/q/79484591
tag name: color-scheme

http://stackoverflow.com/comment/140272214
type: QuestionComment
has text: Definitely only with 5.1. But the versions 5.1, 5.2, 5.3 and 5.4 can easily peacefully coexist. But insead, try setting `$wgScribuntoEngineConf['luastandalone']['luaPath'] = '/mediawiki-1.41.4/extensions/Scribunto/includes/Engines/LuaStandalone/binaries/lua';`. An entirely different solution is to get php-luasandbox mod, enable it in `php.ini` and set `$wgScribuntoDefaultEngine = 'luasandbox';`.
type: Comment
comment on: http://stackoverflow.com/q/79532226
score: 0

named
type: Tag
tag name: named
tags question: http://stackoverflow.com/q/79442202

http://stackoverflow.com/comment/140270145
score: 0
comment on: http://stackoverflow.com/q/79532226
type: QuestionComment
has text: You could try to reinstall Lua 5.1.
type: Comment

code-generation
type: Tag
tags question: http://stackoverflow.com/q/79487664
tag name: code-generation

dependency-injection
tags question: http://stackoverflow.com/q/79498050
type: Tag
tag name: dependency-injection

line-breaks
tags question: http://stackoverflow.com/q/79509437
type: Tag
tag name: line-breaks

http://stackoverflow.com/comment/140270944
score: 0
comment on: http://stackoverflow.com/q/79532226
type: QuestionComment
type: Comment
has text: 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.

luafilesystem
type: Tag
tags question: http://stackoverflow.com/q/79502556
tag name: luafilesystem

http://stackoverflow.com/a/79494468
type: Answer
answers question: http://stackoverflow.com/q/79494448
upvote count: 1
downvote count: 0
score: 1
has body: 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 Game.Players.LocalPlayer.Character.HumanoidRootPart then just get the position like on a normal part.

winapi
tags question: http://stackoverflow.com/q/79423689
type: Tag
tag name: winapi

conditional-operator
tags question: http://stackoverflow.com/q/79542847
type: Tag
tag name: conditional-operator

http://stackoverflow.com/comment/140279596
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/79544735
has text: 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")
type: Comment

redisson
type: Tag
tags question: http://stackoverflow.com/q/79504829
tag name: redisson

osrm
tag name: osrm
type: Tag
tags question: http://stackoverflow.com/q/79435348