C API: "bad argument #1 to '?' (FileServerConfig expected, got FileServerConfig)"
I'm having trouble using metatables. Either I comment out the line marked with `[1]` and I get userdata-type-issues (all `__index`\-operations call my FileServerConfig-index-handler) or I get the error-message in the noscript.
My project (Lua-configured webserver uing the Linux uring-interface) is in early development and you can have my gitlab-address via PM. I hope, an advanced Lua C API-coder can help me with that.
EDIT: The Lua-Line is `fs_conf = createFileServerConfig()`, where the mentioned function runs `create_config_lua(...)`.
Following code gives me the error-report mentioned in the noscript:
static int create_config_lua(lua_State *L)
{
luaL_getmetatable(L, COMPONENT_LUA_METANAME);
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
luaL_setmetatable(L, COMPONENT_LUA_METANAME); // [1]
luaL_setfuncs(L, lua_file_m, 0);
luaL_setmetatable(L, COMPONENT_LUA_METANAME);
lua_pushlightuserdata(L,(void *) create_config());
luaL_setmetatable(L, COMPONENT_LUA_METANAME);
return 1;
}
https://redd.it/1kvsofp
@r_lua
I'm having trouble using metatables. Either I comment out the line marked with `[1]` and I get userdata-type-issues (all `__index`\-operations call my FileServerConfig-index-handler) or I get the error-message in the noscript.
My project (Lua-configured webserver uing the Linux uring-interface) is in early development and you can have my gitlab-address via PM. I hope, an advanced Lua C API-coder can help me with that.
EDIT: The Lua-Line is `fs_conf = createFileServerConfig()`, where the mentioned function runs `create_config_lua(...)`.
Following code gives me the error-report mentioned in the noscript:
static int create_config_lua(lua_State *L)
{
luaL_getmetatable(L, COMPONENT_LUA_METANAME);
lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
luaL_setmetatable(L, COMPONENT_LUA_METANAME); // [1]
luaL_setfuncs(L, lua_file_m, 0);
luaL_setmetatable(L, COMPONENT_LUA_METANAME);
lua_pushlightuserdata(L,(void *) create_config());
luaL_setmetatable(L, COMPONENT_LUA_METANAME);
return 1;
}
https://redd.it/1kvsofp
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
interactive ways to learn lua?
ive tried reading the lua website but i feel as though im not learning. does anyone know interactive ways to learn it?
https://redd.it/1kvw6fd
@r_lua
ive tried reading the lua website but i feel as though im not learning. does anyone know interactive ways to learn it?
https://redd.it/1kvw6fd
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Big Updates to my Game Editor made on my iPad
https://www.youtube.com/watch?v=pb1mz01nk70
https://redd.it/1kw0c0q
@r_lua
https://www.youtube.com/watch?v=pb1mz01nk70
https://redd.it/1kw0c0q
@r_lua
YouTube
Made BIG Updates to my Game Editor on the iPads (Codea)
Made Updates for my game editor on my iPad. Going to use it to make games on Codea. In probably 2 month the first version of the editor will be release in the Codea Repo for you to use.
0:00 Introduction
0:27 Duplicate and Delete
1:10 Image Slice Editor…
0:00 Introduction
0:27 Duplicate and Delete
1:10 Image Slice Editor…
Ultra Engine 0.9.9 Released
Hi, I just wanted to let you know the new version of my Lua-compatible game engine has been released: https://www.leadwerks.com/community/blogs/entry/2872-ultra-engine-099-adds-a-built-in-code-editor-mesh-reduction-tools-and-thousands-of-free-game-assets/
https://preview.redd.it/02adopcqz53f1.jpg?width=1280&format=pjpg&auto=webp&s=3ce16cd9b6cd01351510a0da158ee756c67b5f77
Based on community feedback and usability testing, the interface has undergone some revision and the built-in code editor from Leadwerks has been brought back, with a dark theme. Although Visual Studio Code is an awesome IDE, we found that it includes a lot of features people don't really need, which creates a lot of visual clutter, and a streamlined interface is easier to take in.
https://preview.redd.it/iabye3tvz53f1.jpg?width=1960&format=pjpg&auto=webp&s=6631d4fc6ca17e138e1777819c3846fd6ab98454
A built-in downloads manager provides easy access to download thousands of free game assets from our website. Manually downloading and extracting a single zip file is easy, but when you want to quickly try out dozens of items it adds a lot of overhead to the workflow, so I found that the importance of this feature cannot be overstated.
https://preview.redd.it/16r8sm80063f1.png?width=1462&format=png&auto=webp&s=2ad738b688962f6401dcea5feb1eac4d45906d30
A mesh reduction tool provides a way to quickly create LODs or just turn a high-poly mesh into something usable. This is something I really discovered was needed while developing my own game, and it saves a huge amount of time not having to go between different modeling programs.
https://i.redd.it/zfv4v472063f1.gif
Let me know if you have any questions and I will try to answer them all. Thanks!
https://redd.it/1kw15ha
@r_lua
Hi, I just wanted to let you know the new version of my Lua-compatible game engine has been released: https://www.leadwerks.com/community/blogs/entry/2872-ultra-engine-099-adds-a-built-in-code-editor-mesh-reduction-tools-and-thousands-of-free-game-assets/
https://preview.redd.it/02adopcqz53f1.jpg?width=1280&format=pjpg&auto=webp&s=3ce16cd9b6cd01351510a0da158ee756c67b5f77
Based on community feedback and usability testing, the interface has undergone some revision and the built-in code editor from Leadwerks has been brought back, with a dark theme. Although Visual Studio Code is an awesome IDE, we found that it includes a lot of features people don't really need, which creates a lot of visual clutter, and a streamlined interface is easier to take in.
https://preview.redd.it/iabye3tvz53f1.jpg?width=1960&format=pjpg&auto=webp&s=6631d4fc6ca17e138e1777819c3846fd6ab98454
A built-in downloads manager provides easy access to download thousands of free game assets from our website. Manually downloading and extracting a single zip file is easy, but when you want to quickly try out dozens of items it adds a lot of overhead to the workflow, so I found that the importance of this feature cannot be overstated.
https://preview.redd.it/16r8sm80063f1.png?width=1462&format=png&auto=webp&s=2ad738b688962f6401dcea5feb1eac4d45906d30
A mesh reduction tool provides a way to quickly create LODs or just turn a high-poly mesh into something usable. This is something I really discovered was needed while developing my own game, and it saves a huge amount of time not having to go between different modeling programs.
https://i.redd.it/zfv4v472063f1.gif
Let me know if you have any questions and I will try to answer them all. Thanks!
https://redd.it/1kw15ha
@r_lua
Leadwerks Community
Ultra Engine 0.9.9 Adds a Built-in Code Editor, Mesh Reduction Tools, and Thousands of Free Game Assets
Ultra Engine 0.9.9 is here with new features, improved usability, and access to thousands of free 3D assets to use in your games. This new update is the most stable and user-friendly version of our engine and editor to date. Revised Interface We've made great…
Solving Lua exercise
I will pay $100 to help me solve these last two Lua problems .
https://redd.it/1kwqsy1
@r_lua
I will pay $100 to help me solve these last two Lua problems .
https://redd.it/1kwqsy1
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Looking for a fivem backend dev! (Paid)
Need a guy who can help me finish my noscript. Please dm me if you are interested!
https://redd.it/1kwvg9h
@r_lua
Need a guy who can help me finish my noscript. Please dm me if you are interested!
https://redd.it/1kwvg9h
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Macro lua auto click G hub Logitech X Pro Superlight
Olá, a tempos venho vendo que aqui no comunidade, quando si ah uma duvida referente a scrip lua, os brabo estão aqui.
Então! eu tenho um scrip que uso e sem nenhum problema com ele, mas queria adicionar a função de auto click tambem para funcionar junto com todo o restante.
O quero adicionar o seguinte comando, o mouse ficar clicando o botao esquerdo continuamente enquanto estiver presionado e para ao soltar logitecamente.
Atualmente uso esse noscript;
local Spray_Randomize = math.random(29, 31)
local AK47_Pattern = {
{ x = 1, y = 1 }, { x = -1, y = -1 },
}
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
if IsKeyLockOn("capslock") then
repeat
Sleep(9)
MoveMouseRelative(0, 6)
Sleep(9)
MoveMouseRelative(0 ,-6)
until not IsMouseButtonPressed(1)
end
end
end
https://redd.it/1kwyjzz
@r_lua
Olá, a tempos venho vendo que aqui no comunidade, quando si ah uma duvida referente a scrip lua, os brabo estão aqui.
Então! eu tenho um scrip que uso e sem nenhum problema com ele, mas queria adicionar a função de auto click tambem para funcionar junto com todo o restante.
O quero adicionar o seguinte comando, o mouse ficar clicando o botao esquerdo continuamente enquanto estiver presionado e para ao soltar logitecamente.
Atualmente uso esse noscript;
local Spray_Randomize = math.random(29, 31)
local AK47_Pattern = {
{ x = 1, y = 1 }, { x = -1, y = -1 },
}
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
if IsKeyLockOn("capslock") then
repeat
Sleep(9)
MoveMouseRelative(0, 6)
Sleep(9)
MoveMouseRelative(0 ,-6)
until not IsMouseButtonPressed(1)
end
end
end
https://redd.it/1kwyjzz
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Astra v0.20 released - A Lua 5.1-5.4/JIT/Luau web server runtime
Astra is a Lua 5.1-5.4/JIT/Luau runtime written in Rust using mlua project. The runtime tries to be as easy to use and performant as possible, and focus mainly for web servers. Its aim is to be a single binary that you can drop anywhere to run your servers, with the speed and safety of Rust, but without having the complexity and build times. Almost all of the components is written in Rust using different popular crates.
Example usage:
-- Create a new server
local server = Astra.http.server:new()
-- Register a route
server:get("/", function()
return "hello from default Astra instance!"
end)
-- Configure the server
server.port = 3000
-- Run the server
server:run()
The runtime currently features HTTP1/2 server (axum), client (reqwest), SQL driver (sqlx), async tasks (tokio), crypto (sha2, sha3, base64), JSON (serde_json), cookies (tower), and many other smaller but useful things such as pretty printing, data validation, ...
In the v0.20 release, there has been a huge refactor in the code structure and API design, making it finally somewhat usable outside. There has also been some production testing internally at ArkForge and some other users in startups, although I would not personally recommend full production use of it as its quite young.
I am the main developer of it as well, feel free to AMA
https://redd.it/1kxhnb8
@r_lua
Astra is a Lua 5.1-5.4/JIT/Luau runtime written in Rust using mlua project. The runtime tries to be as easy to use and performant as possible, and focus mainly for web servers. Its aim is to be a single binary that you can drop anywhere to run your servers, with the speed and safety of Rust, but without having the complexity and build times. Almost all of the components is written in Rust using different popular crates.
Example usage:
-- Create a new server
local server = Astra.http.server:new()
-- Register a route
server:get("/", function()
return "hello from default Astra instance!"
end)
-- Configure the server
server.port = 3000
-- Run the server
server:run()
The runtime currently features HTTP1/2 server (axum), client (reqwest), SQL driver (sqlx), async tasks (tokio), crypto (sha2, sha3, base64), JSON (serde_json), cookies (tower), and many other smaller but useful things such as pretty printing, data validation, ...
In the v0.20 release, there has been a huge refactor in the code structure and API design, making it finally somewhat usable outside. There has also been some production testing internally at ArkForge and some other users in startups, although I would not personally recommend full production use of it as its quite young.
I am the main developer of it as well, feel free to AMA
https://redd.it/1kxhnb8
@r_lua
GitHub
GitHub - ArkForgeLabs/Astra: 🔥 Blazingly Fast 🔥 web server runtime for Lua
🔥 Blazingly Fast 🔥 web server runtime for Lua. Contribute to ArkForgeLabs/Astra development by creating an account on GitHub.
Can anyone tell me how to install lua and luarocks in user environment on Linux?
So the thing is i don't want to download this with sudo privilege. And building the package doesn't seem very straightforward to me. I am not able to make luarocks work.
I am beginner in Lua, I have worked with python package managers such as lua and apparently the setup of luarocks is not as straightforward as uv.
Can anyone walk me through the installation and project setup. I could move past installing a luarocks package and run it in the project. All in all I am not able to configure.
https://redd.it/1kxkm8m
@r_lua
So the thing is i don't want to download this with sudo privilege. And building the package doesn't seem very straightforward to me. I am not able to make luarocks work.
I am beginner in Lua, I have worked with python package managers such as lua and apparently the setup of luarocks is not as straightforward as uv.
Can anyone walk me through the installation and project setup. I could move past installing a luarocks package and run it in the project. All in all I am not able to configure.
https://redd.it/1kxkm8m
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Can Roblox Studio programming be talked about in this reddit?
Roblox Studio's main coding language is Lua (or, Luau) but it doesn't seem very appropriate to talk about here. Otherwise, is this OK?
https://redd.it/1kxwwcr
@r_lua
Roblox Studio's main coding language is Lua (or, Luau) but it doesn't seem very appropriate to talk about here. Otherwise, is this OK?
https://redd.it/1kxwwcr
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Beat Iphone app for learning lua
Ok guys I dont want crap about how a laptop would be better or websites or your 10 paragraphs in 1 message (Im not gonna read all that) I want an app like mimo but its teaches lua, that has a dashboard that is good. Dont go ahead and yap just give me an APP (not website) and explain why its good
https://redd.it/1kyezmu
@r_lua
Ok guys I dont want crap about how a laptop would be better or websites or your 10 paragraphs in 1 message (Im not gonna read all that) I want an app like mimo but its teaches lua, that has a dashboard that is good. Dont go ahead and yap just give me an APP (not website) and explain why its good
https://redd.it/1kyezmu
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Starting lua?
Can somebody recommend me to a brief introduction to lua? maybe roblox sided?
Im at the level of making flappy bird game in python with tkinter. Id be glad for any links and guides ty!
All opinions are helpful
https://redd.it/1kyybt6
@r_lua
Can somebody recommend me to a brief introduction to lua? maybe roblox sided?
Im at the level of making flappy bird game in python with tkinter. Id be glad for any links and guides ty!
All opinions are helpful
https://redd.it/1kyybt6
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Langfix: Pure-Lua fix for some things in the language, especially missing in LuaJIT
https://github.com/thenumbernine/langfix-lua
https://redd.it/1kyyzf7
@r_lua
https://github.com/thenumbernine/langfix-lua
https://redd.it/1kyyzf7
@r_lua
GitHub
GitHub - thenumbernine/langfix-lua: Pure-Lua fix for some things in the language, especially missing in LuaJIT
Pure-Lua fix for some things in the language, especially missing in LuaJIT - thenumbernine/langfix-lua
Prosody 13.0.2 released - An XMPP/Jabber server written in Lua
https://blog.prosody.im/prosody-13.0.2-released/
https://redd.it/1kzbbc7
@r_lua
https://blog.prosody.im/prosody-13.0.2-released/
https://redd.it/1kzbbc7
@r_lua
blog.prosody.im
Prosody 13.0.2 released
We are pleased to announce a new minor release from our stable branch.
This update addresses various issues that have been noticed since the previous release, as well as a few improvements, including some important fixes for invites. Some log messages and…
This update addresses various issues that have been noticed since the previous release, as well as a few improvements, including some important fixes for invites. Some log messages and…
Functions under the Hood (Lua 5.1/Luau)
Hi!
I'm mostly posting this to see if anyone understands what the difference is between two or three different things within Lua 5.1 or Luau somewhere in the stack or under the hood. I can't decide whether this is a Help flair or a Discussion flair, so do let me know if it's more fitted for the Discussion tag and I'll see what I can do about it.
Anyways, I understand that this subreddit is mostly based around Lua - I'm mostly doing all of this in Roblox Studio, so it's more of a Lua 5.1/Luau question, but...
Why is:
local f; f = function() end
different from
local function func()
end
when inspected using debug.info() (similar to Lua's debug.getinfo())?
For example, when I call debug.info(1, 'n') in local f; function() end, it returns: ""
but when I call it in local function func() end, it returns: "func" (the function name)
Does anyone understand what's different between the two? I understand local f; function() end is in a sense an anonymous function, but why does it matter that much under the hood?
If this is too roblox-inclined, tell me and I'll happily move this post over to r/robloxgamedev or elsewhere.
https://redd.it/1kzgnao
@r_lua
Hi!
I'm mostly posting this to see if anyone understands what the difference is between two or three different things within Lua 5.1 or Luau somewhere in the stack or under the hood. I can't decide whether this is a Help flair or a Discussion flair, so do let me know if it's more fitted for the Discussion tag and I'll see what I can do about it.
Anyways, I understand that this subreddit is mostly based around Lua - I'm mostly doing all of this in Roblox Studio, so it's more of a Lua 5.1/Luau question, but...
Why is:
local f; f = function() end
different from
local function func()
end
when inspected using debug.info() (similar to Lua's debug.getinfo())?
For example, when I call debug.info(1, 'n') in local f; function() end, it returns: ""
but when I call it in local function func() end, it returns: "func" (the function name)
Does anyone understand what's different between the two? I understand local f; function() end is in a sense an anonymous function, but why does it matter that much under the hood?
If this is too roblox-inclined, tell me and I'll happily move this post over to r/robloxgamedev or elsewhere.
https://redd.it/1kzgnao
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Need A bit help with Neovim plugin development
I am working on a project called model-cmp.nvim, which used python to run LLMs locally and allow text autocomplete in neovim using the model predictions. The development is taking longer than expected, the model efficiency development is taking too much time, though I can handle that part. While keeping the modelapi in one hand, it is very difficult to develop actual plugin. So I was wondering if someone would like to handle the plugin development process. The link for the plugin is https://github.com/PyDevC/model-cmp.nvim
https://redd.it/1l031vy
@r_lua
I am working on a project called model-cmp.nvim, which used python to run LLMs locally and allow text autocomplete in neovim using the model predictions. The development is taking longer than expected, the model efficiency development is taking too much time, though I can handle that part. While keeping the modelapi in one hand, it is very difficult to develop actual plugin. So I was wondering if someone would like to handle the plugin development process. The link for the plugin is https://github.com/PyDevC/model-cmp.nvim
https://redd.it/1l031vy
@r_lua
GitHub
GitHub - PyDevC/model-cmp.nvim: Testing Autocomplete via various models. Only for neovim
Testing Autocomplete via various models. Only for neovim - PyDevC/model-cmp.nvim
Recoil noscript need help is this going to work?
EnablePrimaryMouseButtonEvents(true)
-- Define all weapons and their recoil values (name = {x, y})
local weapons = {
{name = "R4C", recoil = {-1, 20}},
{name = "F2", recoil = {-1, 14}},
{name = "L8", recoil = {0, 10}},
{name = "AR33", recoil = {0, 11}},
{name = "G36C", recoil = {-1, 14}},
{name = "556XL", recoil = {-1, 11}},
{name = "6P41", recoil = {-1, 11}},
-- Add more weapons here
}
local weaponIndex = 1
local recoilEnabled = false
function OnEvent(event, arg)
-- Toggle recoil ON/OFF with Right Mouse Button (3)
if event == "MOUSEBUTTONPRESSED" and arg == 3 then
recoilEnabled = not recoilEnabled
if recoilEnabled then
OutputLogMessage("Recoil ON (%s)\n", weaponsweaponIndex.name)
else
OutputLogMessage("Recoil OFF\n")
end
end
-- Cycle weapons with Mouse Button 4 (arg == 4)
if event == "MOUSEBUTTONPRESSED" and arg == 4 then
weaponIndex = weaponIndex + 1
if weaponIndex > #weapons then
weaponIndex = 1
end
OutputLogMessage("Switched to: %s\n", weaponsweaponIndex.name)
end
-- Recoil control loop
if recoilEnabled and IsMouseButtonPressed(1) then
local recoil = weaponsweaponIndex.recoil
repeat
MoveMouseRelative(recoil1, recoil2)
Sleep(9)
until not IsMouseButtonPressed(1)
end
end
https://redd.it/1l0iljs
@r_lua
EnablePrimaryMouseButtonEvents(true)
-- Define all weapons and their recoil values (name = {x, y})
local weapons = {
{name = "R4C", recoil = {-1, 20}},
{name = "F2", recoil = {-1, 14}},
{name = "L8", recoil = {0, 10}},
{name = "AR33", recoil = {0, 11}},
{name = "G36C", recoil = {-1, 14}},
{name = "556XL", recoil = {-1, 11}},
{name = "6P41", recoil = {-1, 11}},
-- Add more weapons here
}
local weaponIndex = 1
local recoilEnabled = false
function OnEvent(event, arg)
-- Toggle recoil ON/OFF with Right Mouse Button (3)
if event == "MOUSEBUTTONPRESSED" and arg == 3 then
recoilEnabled = not recoilEnabled
if recoilEnabled then
OutputLogMessage("Recoil ON (%s)\n", weaponsweaponIndex.name)
else
OutputLogMessage("Recoil OFF\n")
end
end
-- Cycle weapons with Mouse Button 4 (arg == 4)
if event == "MOUSEBUTTONPRESSED" and arg == 4 then
weaponIndex = weaponIndex + 1
if weaponIndex > #weapons then
weaponIndex = 1
end
OutputLogMessage("Switched to: %s\n", weaponsweaponIndex.name)
end
-- Recoil control loop
if recoilEnabled and IsMouseButtonPressed(1) then
local recoil = weaponsweaponIndex.recoil
repeat
MoveMouseRelative(recoil1, recoil2)
Sleep(9)
until not IsMouseButtonPressed(1)
end
end
https://redd.it/1l0iljs
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I'm creating a little casino game for fun, what minigames could I include?
https://redd.it/1l0k3qr
@r_lua
https://redd.it/1l0k3qr
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
hello...
followed a tutorial on youtube from 4 years ago on how to install lua and it didn't work....
how the hell do i install lua????
https://redd.it/1l0lygx
@r_lua
followed a tutorial on youtube from 4 years ago on how to install lua and it didn't work....
how the hell do i install lua????
https://redd.it/1l0lygx
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community