Lua - Reddit – Telegram
Lua - Reddit
31 subscribers
281 photos
31 videos
4.28K links
News and discussion for the Lua programming language.

Subreddit: https://www.reddit.com/r/lua

Powered by : @r_channels & @reddit2telegram
Download Telegram
Why is this code not valid?

Why is this code not valid?

    if uRope == nil then
        uRope = {}
        for t=1, 10 do
            uRopet = {}
        end
    end

    local c = #uRope
    c = c + 1

uRopec.name = "Base"

print (uRopec.name)

https://redd.it/1c2yypz
@r_lua
Lua Server

I want to start programming in Lua, but I'm not sure whether to use Lua over Python's Flask. Is Lua better in terms of servers? Or should I just stick to Python. (I looked over Lua because it seems easier to embed into C/C++ programs.)

https://redd.it/1c334lv
@r_lua
How much do i need to learn about lua before i can make games and apps?

Hello. i barely know how to do strings? i think that's what they're called. subroutines, callback? and all that other coding stuff. i only watched an hour long video going over lua... and i probably didn't retain much, let alone learn anything. so if you guys can like test me. or ask me how much i know about lua, i can probably fast track to learning more about lua. thank you.

https://redd.it/1c32bgx
@r_lua
How do I install the vim module in Lua.

Lua comes with the vim module, but it's still not able to use it. Like vim.api. methods or others.

​

https://preview.redd.it/z9skimaunauc1.png?width=662&format=png&auto=webp&s=749f437b84e20afdd8edf420f9dcbce321218504

https://redd.it/1c39a4m
@r_lua
how to learn noscripting from 0

how to learn lua from 0 to high lvl. how much time i need to spend for it?
whicih sites better to use? maybe youtube?

​

https://redd.it/1c3dw59
@r_lua
This media is not supported in your browser
VIEW IN TELEGRAM
Does anyone know the code where once you trigger the jump key, the player will jump and then go down, I'm a newbie with lua so it would be greatly appreciated to anyone who could solve this problem
https://redd.it/1c3h049
@r_lua
is there anyone who deobfuscates luraph?

like a discord server that offers luraph deobfuscation (paid)

https://redd.it/1c3wl9w
@r_lua
Adding a functions for a metatable(Class) defined in another module?

I'm basically trying to add a function in treesitter nvim for a node similar to `my_node:named_child_count()` returns the amount of named child node `my_node` has but I want to define it in my plugin e.g.:

useage:
`my_node:nodePrint()`

declaration
```lua
function self:nodePrint()
local child_count = self:named_child_count()

print("Node chilndren count: " .. child_count)
return child_count
end
```

now the structure of my_node is inherited with a treesitter function defined in another module:
```lua
local r, c = unpack(vim.api.nvim_win_get_cursor(0))
vim.treesitter.get_parser(0):parse({ r - 1, c, r - 1, c })
return vim.treesitter.get_node()
```

that seem like this should be simple but couldn't get this to work so far, any tips?

https://redd.it/1c4gmbi
@r_lua
Programming Beginner Here

I'm trying to get into the world of programming, and I've heard a lot about lua and lua seems to be used in general things I want to eventually try and do myself, so does anyone here have any recommendations on how to get started, I ordered a few books but I feel as though talking to people would be the best way for me to learn, so I'm open to any suggestions!

https://redd.it/1c4uqxx
@r_lua
Help with Coordinates

Hello, i’ve recently found the cause of a really big bug in a game, and im trying to fix it. The bug is having a black screen and shortly crashing afterwards. The reason this happens, is because the game is setting the player’s coordinates very very high. My question, is how do you check if the number of the coordinates is higher than another number. For example:

if PlayerGetPosXYZ(0, 0, 0) > 1000000 — Im not sure how you would do this, this is why i just put the one number.

Sorry if this is really confusing. For more context, here is my code:

​

function coord()

while true do

Wait(0)

if not AreaIsLoading() then

x, y, z = PlayerGetPosXYZ()

end

if x, y, z > 10000, 10000, 10000 - - if the number of player coords is higher than 10000 for x, y, z then do such and such.

https://redd.it/1c5h5nj
@r_lua
PowerShell/Windows Terminal unicode inconsistency

I have this Lua noscript:

--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:\>chcp 65001
Active code page: 65001

C:\>lua test.lua
abæ
97
a
98
b
230
æ

C:\>

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:\>chcp 65001
Active code page: 65001

C:\>lua test.lua
abæ
97
a
98
b
0


C:\>

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?

https://redd.it/1c63qgb
@r_lua
Metatable type to ensure types passed store proper values

I've been trying to get my Bezier table to inherit the style requirements of type Curve<Bezier> so that I can define multiple different types of curves (bezier, arc, line segment array) that utilize similar methods. I'm trying to ensure that the "blueprint" table passed into the metatable's second argument stores the functions required to make it a curve, and also that the first argument (the table that will become a metatable) has the fields required to make it of the type Bezier, or whatever else I choose to define. Below is the code I currently have, in which you should be able to glean my general idea.

type CurveImpl<T> = {
index: CurveImpl<T>,
new: (...any) -> Curve<T>,
GetPoint: (self: Curve<T>, t: number) -> Vector3,
GetTangent: (self: Curve<T>, t: number) -> Vector3,
GetAcceleration: (self: Curve<T>, t: number) -> Vector3,
SetContinuous: (self: Curve<T>, position: Vector3?, tangent: Vector3?) -> (),
string: ((...any) -> any)
}

type Curve<T> = typeof(setmetatable({}::{
-- The parameters detailed in the T type should go here. (In this case, the Bezier type.)
}, {}::CurveImpl<T>))

local Bezier: CurveImpl<Bezier> = {} :: CurveImpl<Bezier>
Bezier.index = Bezier

type Bezier = {
Controls: {Vector3}
}

function Bezier.new(...: Vector3): Curve<Bezier>
return setmetatable({Controls = {...}}, Bezier)
end

Of course, there are more methods that satisfy the requirements for a `Curve`, but they have been omitted for brevity.

https://redd.it/1c6mfc5
@r_lua
According to the SWIG website, Lua is not a noscripting language
https://redd.it/1c6qrmg
@r_lua
Is it possible to convert hex to lua?

Hello!
So, I have this mousepad with lights around it, I took out the main chip with the button that turns on and off the lights, I used CH341A Programmer to "read" it and got something which i think is HEX and I want to edit that but of course i cannot understand random numbers so I would like to know if it's possible to convert it to some other programming language like lua or something to edit the chip

Sorry if you didn't quite understand what I'm trying to do

thanks

https://redd.it/1c716kf
@r_lua
lua is too hard to install

Installing Lua:

Search a bunch of web pages trying to find windows binaries

extract the zip

manually add it to PATH

Installing Python:
Download installer from official website

Run installer


genuinely the easiest way to install lua is the ComputerCraft mod for minecraft


https://redd.it/1c76p3y
@r_lua
Is there any good latest reference for lua learning and development?

I am looking for some lua turtoial for lua study/There is a lot of out-of-date documents online but I would like find the lastest version to learn. Please give some suggestions.

https://redd.it/1c7dffy
@r_lua
Anyone know any good roblox lua tutorials for someone with good knowledge of python



https://redd.it/1c7hmsn
@r_lua