Convert C header file to more machine-readable format?
Is anybody aware of a standard for specifying the API of an object file (lib.so) besides a C header file (.h file)?
I'm designing my own assembly language and want to consume and link headers to link with dynamic libraries produced by C. It would be nice to not need to implement my own C compiler to do so.
https://redd.it/1p8it8l
@r_lua
Is anybody aware of a standard for specifying the API of an object file (lib.so) besides a C header file (.h file)?
I'm designing my own assembly language and want to consume and link headers to link with dynamic libraries produced by C. It would be nice to not need to implement my own C compiler to do so.
https://redd.it/1p8it8l
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Can someone tell me why this code doesn't work
Simply trying to iterate through a table, and nothing is printed out, why?
local myTable = {}
local myStruct = {}
myStruct.myValue = 5
myStruct.myOtherValue = "Bears"
myTable"Joe" = myStruct
myTable"Suzy" = myStruct
for name, struct in pairs(myTable) do
print("myValue= " .. struct.myValue.. ", myOtherValue = " .. struct.myOtherValue .. "\n")
end
https://redd.it/1p8n16f
@r_lua
Simply trying to iterate through a table, and nothing is printed out, why?
local myTable = {}
local myStruct = {}
myStruct.myValue = 5
myStruct.myOtherValue = "Bears"
myTable"Joe" = myStruct
myTable"Suzy" = myStruct
for name, struct in pairs(myTable) do
print("myValue= " .. struct.myValue.. ", myOtherValue = " .. struct.myOtherValue .. "\n")
end
https://redd.it/1p8n16f
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
It is possible to make a desktop app with lua?
I'm trying to work on a project of desktop app fully on lua but I struggle to find something out of love2D (I'm not sure it's the most adapted for the project but that is currently my backup option) to make the graphical interface.
Do you have any recommendations?
https://redd.it/1p8qi58
@r_lua
I'm trying to work on a project of desktop app fully on lua but I struggle to find something out of love2D (I'm not sure it's the most adapted for the project but that is currently my backup option) to make the graphical interface.
Do you have any recommendations?
https://redd.it/1p8qi58
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Need help with a discontinued balatro mod
Firstly I can pay you up to $25... In robux, I have no digital bank account so I'm limited to that if you want money for that.
If your interested "money"wise or not, I want whoever is interested to do a couple things. 1. The balatro mod has a library, a compact to work with another dependent mod. and the mod itself, I would like all of them combined. 2. I would also like it updated to the latest Smod + Lovely. If your still interested in that, feel free to tell.
https://redd.it/1p9d0kc
@r_lua
Firstly I can pay you up to $25... In robux, I have no digital bank account so I'm limited to that if you want money for that.
If your interested "money"wise or not, I want whoever is interested to do a couple things. 1. The balatro mod has a library, a compact to work with another dependent mod. and the mod itself, I would like all of them combined. 2. I would also like it updated to the latest Smod + Lovely. If your still interested in that, feel free to tell.
https://redd.it/1p9d0kc
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Looking for feedback on simple Love2D program - how to cleanly write this code?
I'm learning the LÖVE framework and having a good time covering the basics. I've currently made a little program that shows a series of text, one word at a time, while bouncing around the screen like a screensaver from the 90's. So far, it works, but I'm looking for ways to make the code nicer and avoid developing bad habits.
The code uses the [tick](https://github.com/rxi/tick) library to do changes every second. This also uses a separate "words" file that holds the full text in a table, word by word (in this case, the Gettysburg address, but any list of words will do). Here's the full main file:
function love.load()
--load the library
tick = require "tick"
--import the speech
require "words"
--start the count
word_count = 1
-- cycling function
function cycle_word()
if word_count == #speech then
word_count = 1
else
word_count = word_count + 1
end
end
font = love.graphics.getFont()
--define y edges
y_stopper = love.graphics.getHeight() - font:getHeight()
--x edge is conditional
--define position
x_coord = 0
y_coord = 0
-- start random generator
math.randomseed( os.time() )
--testing a dummy variable to make it truly random
_dummy = math.random()
--define angle
angle = math.random(10,80) * math.pi / 180
x_speed = 100 * math.sin(angle)
y_speed = 100 * math.cos(angle)
x_switch = 1
y_switch = 1
-- cycle the function
tick.recur(cycle_word , 1)
end
function love.update(dt)
tick.update(dt)
-- define x edge
x_stopper = love.graphics.getWidth() - font:getWidth(speech[word_count])
if x_switch == 1 and x_coord + x_switch*x_speed*dt > x_stopper then
x_switch = -1
end
if x_switch == -1 and x_coord + x_switch*x_speed*dt < 0 then
x_switch = 1
end
if y_switch == 1 and y_coord + y_switch*y_speed*dt > y_stopper then
y_switch = -1
end
if y_switch == -1 and y_coord + y_switch*y_speed*dt < 0 then
y_switch = 1
end
x_coord = x_coord + x_switch*x_speed*dt
y_coord = y_coord + y_switch*y_speed*dt
end
function love.draw()
love.graphics.print(speech[word_count], x_coord, y_coord)
end
function love.load()
--load the library
tick = require "tick"
--import the speech
require "words"
--start the count
word_count = 1
-- cycling function
function cycle_word()
if word_count == #speech then
word_count = 1
else
word_count = word_count + 1
end
end
font = love.graphics.getFont()
--define y edges
y_stopper = love.graphics.getHeight() - font:getHeight()
--x edge is conditional
--define position
x_coord = 0
y_coord = 0
-- start random generator
math.randomseed( os.time() )
--testing a dummy variable to make it truly random
_dummy = math.random()
--define angle
angle = math.random(10,80) * math.pi / 180
x_speed = 100 * math.sin(angle)
y_speed = 100 * math.cos(angle)
x_switch = 1
y_switch = 1
-- cycle the function
tick.recur(cycle_word , 1)
end
function love.update(dt)
tick.update(dt)
-- define x edge
x_stopper = love.graphics.getWidth()
I'm learning the LÖVE framework and having a good time covering the basics. I've currently made a little program that shows a series of text, one word at a time, while bouncing around the screen like a screensaver from the 90's. So far, it works, but I'm looking for ways to make the code nicer and avoid developing bad habits.
The code uses the [tick](https://github.com/rxi/tick) library to do changes every second. This also uses a separate "words" file that holds the full text in a table, word by word (in this case, the Gettysburg address, but any list of words will do). Here's the full main file:
function love.load()
--load the library
tick = require "tick"
--import the speech
require "words"
--start the count
word_count = 1
-- cycling function
function cycle_word()
if word_count == #speech then
word_count = 1
else
word_count = word_count + 1
end
end
font = love.graphics.getFont()
--define y edges
y_stopper = love.graphics.getHeight() - font:getHeight()
--x edge is conditional
--define position
x_coord = 0
y_coord = 0
-- start random generator
math.randomseed( os.time() )
--testing a dummy variable to make it truly random
_dummy = math.random()
--define angle
angle = math.random(10,80) * math.pi / 180
x_speed = 100 * math.sin(angle)
y_speed = 100 * math.cos(angle)
x_switch = 1
y_switch = 1
-- cycle the function
tick.recur(cycle_word , 1)
end
function love.update(dt)
tick.update(dt)
-- define x edge
x_stopper = love.graphics.getWidth() - font:getWidth(speech[word_count])
if x_switch == 1 and x_coord + x_switch*x_speed*dt > x_stopper then
x_switch = -1
end
if x_switch == -1 and x_coord + x_switch*x_speed*dt < 0 then
x_switch = 1
end
if y_switch == 1 and y_coord + y_switch*y_speed*dt > y_stopper then
y_switch = -1
end
if y_switch == -1 and y_coord + y_switch*y_speed*dt < 0 then
y_switch = 1
end
x_coord = x_coord + x_switch*x_speed*dt
y_coord = y_coord + y_switch*y_speed*dt
end
function love.draw()
love.graphics.print(speech[word_count], x_coord, y_coord)
end
function love.load()
--load the library
tick = require "tick"
--import the speech
require "words"
--start the count
word_count = 1
-- cycling function
function cycle_word()
if word_count == #speech then
word_count = 1
else
word_count = word_count + 1
end
end
font = love.graphics.getFont()
--define y edges
y_stopper = love.graphics.getHeight() - font:getHeight()
--x edge is conditional
--define position
x_coord = 0
y_coord = 0
-- start random generator
math.randomseed( os.time() )
--testing a dummy variable to make it truly random
_dummy = math.random()
--define angle
angle = math.random(10,80) * math.pi / 180
x_speed = 100 * math.sin(angle)
y_speed = 100 * math.cos(angle)
x_switch = 1
y_switch = 1
-- cycle the function
tick.recur(cycle_word , 1)
end
function love.update(dt)
tick.update(dt)
-- define x edge
x_stopper = love.graphics.getWidth()
GitHub
GitHub - rxi/tick: Lua module for delaying function calls
Lua module for delaying function calls. Contribute to rxi/tick development by creating an account on GitHub.
- font:getWidth(speech[word_count])
if x_switch == 1 and x_coord + x_switch*x_speed*dt > x_stopper then
x_switch = -1
end
if x_switch == -1 and x_coord + x_switch*x_speed*dt < 0 then
x_switch = 1
end
if y_switch == 1 and y_coord + y_switch*y_speed*dt > y_stopper then
y_switch = -1
end
if y_switch == -1 and y_coord + y_switch*y_speed*dt < 0 then
y_switch = 1
end
x_coord = x_coord + x_switch*x_speed*dt
y_coord = y_coord + y_switch*y_speed*dt
end
function love.draw()
love.graphics.print(speech[word_count], x_coord, y_coord)
end
You will notice that it has some apparently repetitive stuff with the random seed for the angle. For some reason, when I tried to do just `math.random` for the angle, it came out as the same angle every time. So, I tried creating a disposable variable for the first random value and then using the second random variable to define the angle of the moving word. This works, but I'd like to know if there's a way to avoid taking this silly step.
So, what do you think? What could be improved?
https://redd.it/1p9tvsr
@r_lua
if x_switch == 1 and x_coord + x_switch*x_speed*dt > x_stopper then
x_switch = -1
end
if x_switch == -1 and x_coord + x_switch*x_speed*dt < 0 then
x_switch = 1
end
if y_switch == 1 and y_coord + y_switch*y_speed*dt > y_stopper then
y_switch = -1
end
if y_switch == -1 and y_coord + y_switch*y_speed*dt < 0 then
y_switch = 1
end
x_coord = x_coord + x_switch*x_speed*dt
y_coord = y_coord + y_switch*y_speed*dt
end
function love.draw()
love.graphics.print(speech[word_count], x_coord, y_coord)
end
You will notice that it has some apparently repetitive stuff with the random seed for the angle. For some reason, when I tried to do just `math.random` for the angle, it came out as the same angle every time. So, I tried creating a disposable variable for the first random value and then using the second random variable to define the angle of the moving word. This works, but I'd like to know if there's a way to avoid taking this silly step.
So, what do you think? What could be improved?
https://redd.it/1p9tvsr
@r_lua
Reddit
From the lua community on Reddit: Looking for feedback on simple Love2D program - how to cleanly write this code?
Explore this post and more from the lua community
Leadwerks 5 Launch Party - Live developer chat
https://youtu.be/-DACZW5cyB0?si=z2JqsEs7drU01WY6
https://redd.it/1pa3u4x
@r_lua
https://youtu.be/-DACZW5cyB0?si=z2JqsEs7drU01WY6
https://redd.it/1pa3u4x
@r_lua
YouTube
Leadwerks 5 Launch Party
Get Leadwerks 5: https://store.steampowered.com/app/251810?utm_source=leadwerks_yt&utm_medium=social
In this live developer chat, we'll discuss the launch of Leadwerks 5 this week, the tremendous response on Steam and on the web, walk through some of the…
In this live developer chat, we'll discuss the launch of Leadwerks 5 this week, the tremendous response on Steam and on the web, walk through some of the…
(Japanese Article, Advent Calendar, Overview) - [luarrow] Using pipe operators and Haskell-like function composition operators in Lua [Lua]
https://redd.it/1paz4e4
@r_lua
https://redd.it/1paz4e4
@r_lua
Si quereis aprender luau entrar en:
https://luau-learn-8e7def24.base44.app/home
https://redd.it/1pbc6ph
@r_lua
https://luau-learn-8e7def24.base44.app/home
https://redd.it/1pbc6ph
@r_lua
Help with a logitech ghub noscript
I want to make a noscript that have mouse movement when I click mouse button 4 then has extra movement when I click it while holding rmb. I don't really know how to code so I came here for help. The mouse button 4 works just fine but the right mouse button click doesn't change the movement at all. I was wondering if anyone who knew how to code for logitech ghub could help fix this code.
MoveAmount = -628
ExtraMoveAmount = -12000
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
ReleaseMouseButton(4)
end
if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then
local amount = MoveAmount
if IsMouseButtonPressed(2) then
amount = ExtraMoveAmount
end
for i = 1, 10 do
MoveMouseRelative(amount, 0)
Sleep(5)
end
end
end
https://redd.it/1pbrh3u
@r_lua
I want to make a noscript that have mouse movement when I click mouse button 4 then has extra movement when I click it while holding rmb. I don't really know how to code so I came here for help. The mouse button 4 works just fine but the right mouse button click doesn't change the movement at all. I was wondering if anyone who knew how to code for logitech ghub could help fix this code.
MoveAmount = -628
ExtraMoveAmount = -12000
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
ReleaseMouseButton(4)
end
if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then
local amount = MoveAmount
if IsMouseButtonPressed(2) then
amount = ExtraMoveAmount
end
for i = 1, 10 do
MoveMouseRelative(amount, 0)
Sleep(5)
end
end
end
https://redd.it/1pbrh3u
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
LuajitOS - A Nearly Full Lua Operating System
Hi, I have made an operating system called LuajitOS, most of it is written in lua so I thought it might be of interest to this subreddit.
It has its own desktop environment and can be completely customized, for example the task bar and the backgrounds are just normal programs that can be replaced. The whole app ecosystem will be in lua, this allows you to remix apps written by other people. Each application runs in it's own sandbox and can request permissions to call OS functions through either an embedded manifest as a comment at the top of the file or as a manifest.lua in the packaged application.
It comes with:
- text editor
- paint program
- shell
- browser (only local html files ATM)
- a calculator
- cryptography tool
- application manager
I'm aware someone else has made something similar before but i this is totally separate.
It's available as an ISO or as source code at luajitos.com and there is also a demo video for those who don't want to download
It's currently has no license because I'm still deciding which one.
https://redd.it/1pc191y
@r_lua
Hi, I have made an operating system called LuajitOS, most of it is written in lua so I thought it might be of interest to this subreddit.
It has its own desktop environment and can be completely customized, for example the task bar and the backgrounds are just normal programs that can be replaced. The whole app ecosystem will be in lua, this allows you to remix apps written by other people. Each application runs in it's own sandbox and can request permissions to call OS functions through either an embedded manifest as a comment at the top of the file or as a manifest.lua in the packaged application.
It comes with:
- text editor
- paint program
- shell
- browser (only local html files ATM)
- a calculator
- cryptography tool
- application manager
I'm aware someone else has made something similar before but i this is totally separate.
It's available as an ISO or as source code at luajitos.com and there is also a demo video for those who don't want to download
It's currently has no license because I'm still deciding which one.
https://redd.it/1pc191y
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
LuaJIT Array optmization
GitHub Copilot told me that defining an array as:
will signal Lua / LuaJIT to understand it as a hash table only, due to use of square brackets, even if lua array integrity were respected. It said that to allow array optimization, one must define array implicitly
But Copilot also admitted that defining an empty table first and looping values into it like: ...
However, i then asked the same question Gemini, and it said the Copilot was wrong. In the first example of explicit creation Lua / LuaJIT will correctly identify it as an array and optimize for it. It only cares whether lua array integrity is respected.
Who is right?
https://redd.it/1pc62yx
@r_lua
GitHub Copilot told me that defining an array as:
t = { [1] = val1, [2] = val2, ... }will signal Lua / LuaJIT to understand it as a hash table only, due to use of square brackets, even if lua array integrity were respected. It said that to allow array optimization, one must define array implicitly
t = {val1, val2, ...}But Copilot also admitted that defining an empty table first and looping values into it like: ...
do t1[i] = t2[i] end OR: do t1[#t1 + 1] = v end would make it realize and optimize as a real array under the hood, even though it also uses square bracket assignments (but on an already created table, which is the only difference to above example, where values are added into a not yet created table).However, i then asked the same question Gemini, and it said the Copilot was wrong. In the first example of explicit creation Lua / LuaJIT will correctly identify it as an array and optimize for it. It only cares whether lua array integrity is respected.
Who is right?
https://redd.it/1pc62yx
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
IDE Engine
Hey everyone, I’m trying to solve a problem I’ve run into on both Android and the web, and I’m wondering if others have noticed it too.
There are a few Lua IDEs out there for Android and browser use (JDoodle, etc.), but none of the ones I’ve tried actually support things like io.read() input or, more importantly, building any kind of UI. It makes it tough if you want to learn Lua on mobile or bounce between your PC and phone while working on an app or game.
So I’m building an app to fix some of that.
It basically mixes a regular embedded Lua environment with the LÖVE (Love2D) engine, so you can actually build and run games or apps inside the app itself on mobile. Anyone who’s used Love2D knows how flexible it is, and having that power on Android has been missing for way too long.
I’m still early in development, but I’d really love feedback or feature ideas from the community—things you’d want in a tool like this, pain points you’ve run into, etc.
Once it’s ready, I’m planning to release it as open-source so people can contribute and trust what’s under the hood.
Thanks for reading! Happy to answer any questions.
https://redd.it/1pcgqlm
@r_lua
Hey everyone, I’m trying to solve a problem I’ve run into on both Android and the web, and I’m wondering if others have noticed it too.
There are a few Lua IDEs out there for Android and browser use (JDoodle, etc.), but none of the ones I’ve tried actually support things like io.read() input or, more importantly, building any kind of UI. It makes it tough if you want to learn Lua on mobile or bounce between your PC and phone while working on an app or game.
So I’m building an app to fix some of that.
It basically mixes a regular embedded Lua environment with the LÖVE (Love2D) engine, so you can actually build and run games or apps inside the app itself on mobile. Anyone who’s used Love2D knows how flexible it is, and having that power on Android has been missing for way too long.
I’m still early in development, but I’d really love feedback or feature ideas from the community—things you’d want in a tool like this, pain points you’ve run into, etc.
Once it’s ready, I’m planning to release it as open-source so people can contribute and trust what’s under the hood.
Thanks for reading! Happy to answer any questions.
https://redd.it/1pcgqlm
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Is this program a good place to start?
Now i know everyone says yes it is but is this simplicity something people tend to rely on? or could i learn another language (say another fairly simple one like python) it wont be so much a bother. i know this may be a dumb question but i want to learn more than one type of code so i can be versatile and helpful.
https://redd.it/1pdm6qe
@r_lua
Now i know everyone says yes it is but is this simplicity something people tend to rely on? or could i learn another language (say another fairly simple one like python) it wont be so much a bother. i know this may be a dumb question but i want to learn more than one type of code so i can be versatile and helpful.
https://redd.it/1pdm6qe
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Robotgo v1.0.0 and Pro, easy build automation, auto test, computer use
https://github.com/go-vgo/robotgo/releases/tag/v1.0.0
https://redd.it/1pekf81
@r_lua
https://github.com/go-vgo/robotgo/releases/tag/v1.0.0
https://redd.it/1pekf81
@r_lua
GitHub
Release v1.0.0 · go-vgo/robotgo
What's Changed
Add
Add: add Robotgo Pro for JS, Lua, Python and other languages
Add: add OpenCV find images support
Add: add multi display and scale support
Add: add pid event support
Update
...
Add
Add: add Robotgo Pro for JS, Lua, Python and other languages
Add: add OpenCV find images support
Add: add multi display and scale support
Add: add pid event support
Update
...