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
Doxygen Lua documentation help
I'm making a Lua interpreter with the Lua C API and want to make a documentation for it. Everything seems fine, besides writing the functions inside the library: e. g.: This is a function that is for Doxygen:
nil os.delay(number seconds)
I want it to show it as is, but instead, Doxygen parses it like this:
nil os delay(number seconds)
Basically, Doxygen treats the library (os) as a type (nil os delay, this is not what I want), instead of leaving it as is (which is what i want: nil os.delay)
Here are some similar documentation pages I found that do what I want to achieve:
http://onelua.x10.mx/vita/docs/en/group__adhoc.html
https://jcnmsg.github.io/LuaDEV-R0-PSP/original/spanish/html/group___i_n_i.html
I have spent all day trying to fix this, including issuing it to the Doxygen repo, but I haven't found any solution so far.
https://redd.it/1l0pny1
@r_lua
I'm making a Lua interpreter with the Lua C API and want to make a documentation for it. Everything seems fine, besides writing the functions inside the library: e. g.: This is a function that is for Doxygen:
nil os.delay(number seconds)
I want it to show it as is, but instead, Doxygen parses it like this:
nil os delay(number seconds)
Basically, Doxygen treats the library (os) as a type (nil os delay, this is not what I want), instead of leaving it as is (which is what i want: nil os.delay)
Here are some similar documentation pages I found that do what I want to achieve:
http://onelua.x10.mx/vita/docs/en/group__adhoc.html
https://jcnmsg.github.io/LuaDEV-R0-PSP/original/spanish/html/group___i_n_i.html
I have spent all day trying to fix this, including issuing it to the Doxygen repo, but I haven't found any solution so far.
https://redd.it/1l0pny1
@r_lua
Why do Lua tables need commas?
Wouldn't the grammar still be unambiguous if tables didn't need commas?
https://redd.it/1l0qppp
@r_lua
Wouldn't the grammar still be unambiguous if tables didn't need commas?
https://redd.it/1l0qppp
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
After Python, which language should I learn??
I’m currently learning Python, and want to learn a new language after to make games as a passion project.
After I learn Python, should I learn GDScript to make games on Godot, or should I learn Lua to make games on Roblox?
Which would be easier or harder to learn?
Which would benefit me the most?
https://redd.it/1l0tntr
@r_lua
I’m currently learning Python, and want to learn a new language after to make games as a passion project.
After I learn Python, should I learn GDScript to make games on Godot, or should I learn Lua to make games on Roblox?
Which would be easier or harder to learn?
Which would benefit me the most?
https://redd.it/1l0tntr
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
After learning Pico8 what is best next (Picotron, Playdate, Love2D or jump to Godot).
Like the noscript says, I'm in love with the Lua language when I started making small games in Pico8, and now I want to make something much bigger, or maybe do the same games but outside Pico8, to learn more advanced things. What is your recommendation? Thanks
https://redd.it/1l146my
@r_lua
Like the noscript says, I'm in love with the Lua language when I started making small games in Pico8, and now I want to make something much bigger, or maybe do the same games but outside Pico8, to learn more advanced things. What is your recommendation? Thanks
https://redd.it/1l146my
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How do I get started on Lua?
im quite new to lua and im not too sure on how to get started, is there any advice you guys can give me to start coding?
https://redd.it/1l1ergq
@r_lua
im quite new to lua and im not too sure on how to get started, is there any advice you guys can give me to start coding?
https://redd.it/1l1ergq
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
LSPlua_ls Your workspace is set to
How to solve this problem?
https://redd.it/1l1ne71
@r_lua
C:\Users\waffle. Lua language server refused to load this directory.How to solve this problem?
https://redd.it/1l1ne71
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Local Lua Debugger by Tom Blind
Im a beginner in Lua and especially VSCode and i heard that some extensions can have viruses, i wonder if this extension is safe because it only have 50k downloads.
https://redd.it/1l1s3i7
@r_lua
Im a beginner in Lua and especially VSCode and i heard that some extensions can have viruses, i wonder if this extension is safe because it only have 50k downloads.
https://redd.it/1l1s3i7
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I Wanna learn to program in Lua
Well, here we are. Sorry if you misread anything in this text. It's not my native language, so I want to learn to program in Lua. I've been really interested in this language. I've been doing some research, but I don't know how to get started. I speak Spanish, and the articles out there don't compare to the English ones. Could you please help me? I'd like to learn, but I don't know how. Could you send me articles, videos, or whatever, or explain it to me? That would be great.
https://redd.it/1l1wq7x
@r_lua
Well, here we are. Sorry if you misread anything in this text. It's not my native language, so I want to learn to program in Lua. I've been really interested in this language. I've been doing some research, but I don't know how to get started. I speak Spanish, and the articles out there don't compare to the English ones. Could you please help me? I'd like to learn, but I don't know how. Could you send me articles, videos, or whatever, or explain it to me? That would be great.
https://redd.it/1l1wq7x
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How can I compile a single lua file into an exe?
I just want to compile a stand alone (vanilla) .lua into an exe. I tried using srlua but I just couldn't figure it out I guess. There were next to no instructions on how to set it up. I tried to compile the srlua.c into an exe with gcc but that threw an error saying it couldn't find lua.h. there were a few header files I could see it wouldn't be able to find, so I downloaded the lua src and tried to manually link them. To no one's surprise that didn't work. I've tried about 100 different things and nothing works
https://redd.it/1l3lfnl
@r_lua
I just want to compile a stand alone (vanilla) .lua into an exe. I tried using srlua but I just couldn't figure it out I guess. There were next to no instructions on how to set it up. I tried to compile the srlua.c into an exe with gcc but that threw an error saying it couldn't find lua.h. there were a few header files I could see it wouldn't be able to find, so I downloaded the lua src and tried to manually link them. To no one's surprise that didn't work. I've tried about 100 different things and nothing works
https://redd.it/1l3lfnl
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I Want to Learn
My son loves computers.
I've made a couple of super basic Scratch projects with him showing me the ropes and received more praise than I probably deserved.
That is the extent of my knowledge...but not the extent of my ambition. I really want to learn how to code. Like proper coding.
The kid and I love Roblox so I feel like choosing a first language connected to a shared passion might be best. So Lua....
I tried watching YouTube to get my feet wet only to find that nothing made sense.
Please help me. I need an introduction that starts at level zero. Where do I look/go/watch?
https://redd.it/1l3spff
@r_lua
My son loves computers.
I've made a couple of super basic Scratch projects with him showing me the ropes and received more praise than I probably deserved.
That is the extent of my knowledge...but not the extent of my ambition. I really want to learn how to code. Like proper coding.
The kid and I love Roblox so I feel like choosing a first language connected to a shared passion might be best. So Lua....
I tried watching YouTube to get my feet wet only to find that nothing made sense.
Please help me. I need an introduction that starts at level zero. Where do I look/go/watch?
https://redd.it/1l3spff
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
A Cross-Platform “Batteries-Included” Lua Networking Toolkit
This is my first time posting here—please forgive any mistakes or inappropriate formatting.
silly is a cross-platform “super wrapper” (Windows/Linux/macOS) that bundles TCP/UDP, HTTP, WebSocket, RPC, timers, and more into one easy-to-use framework.
Built-in network primitives (sockets, HTTP client/server, WebSocket, RPC)
Event loop & timers, all exposed as idiomatic Lua functions
Daemonization, logging, process management out of the box
Self-contained deployment (no C modules needed, aside from optional
Check out the
▶️ Repo & docs: https://github.com/findstr/silly
Feel free to share feedback or ask questions!
https://redd.it/1l3ts1v
@r_lua
This is my first time posting here—please forgive any mistakes or inappropriate formatting.
silly is a cross-platform “super wrapper” (Windows/Linux/macOS) that bundles TCP/UDP, HTTP, WebSocket, RPC, timers, and more into one easy-to-use framework.
Built-in network primitives (sockets, HTTP client/server, WebSocket, RPC)
Event loop & timers, all exposed as idiomatic Lua functions
Daemonization, logging, process management out of the box
Self-contained deployment (no C modules needed, aside from optional
libreadline)Check out the
examples/ folder (socket, HTTP, RPC, WebSocket, timer) to see how fast you can go from zero to a fully event-driven service. Everything is MIT-licensed—fork it, tweak it, or just learn from it.▶️ Repo & docs: https://github.com/findstr/silly
Feel free to share feedback or ask questions!
https://redd.it/1l3ts1v
@r_lua
GitHub
GitHub - findstr/silly: Lightweight, high-performance Lua network framework. Supports TCP, UDP, WebSocket, gRPC, Redis, MySQL,…
Lightweight, high-performance Lua network framework. Supports TCP, UDP, WebSocket, gRPC, Redis, MySQL, Prometheus, and etcd v3. Includes SSL/TLS and a built-in debugger. - findstr/silly
Catch output from function called via load(string)
Hey there,
I'm coming back to lua after some time away... I'm trying to call a constructor based on a string from some Tiled output. I've had success doing this using the `load` function - the constructor is being called - but I can't seem to get a reference to the object created. Here's some example code:
function AddElement(_type, _x, _y)
if (_type == null) then return end
local s = _type .. "(" .. tostring(_x) .. "," .. tostring(_y) .. ")"
local makeElement = load(s)
local e = makeElement()
table.insert(elements, 1, e)
print(#elements)
end
I am seeing output from print statements inside the elements' constructors, but the `elements` table is not increasing in size, and `e` seems to be nil. Any ideas?
https://redd.it/1l432f2
@r_lua
Hey there,
I'm coming back to lua after some time away... I'm trying to call a constructor based on a string from some Tiled output. I've had success doing this using the `load` function - the constructor is being called - but I can't seem to get a reference to the object created. Here's some example code:
function AddElement(_type, _x, _y)
if (_type == null) then return end
local s = _type .. "(" .. tostring(_x) .. "," .. tostring(_y) .. ")"
local makeElement = load(s)
local e = makeElement()
table.insert(elements, 1, e)
print(#elements)
end
I am seeing output from print statements inside the elements' constructors, but the `elements` table is not increasing in size, and `e` seems to be nil. Any ideas?
https://redd.it/1l432f2
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I'm new to programming trying to build a timetable generator for my school
when placing the subjects monday will be filled up completely but the other days will have a lot of free slots
function TimeTable_Placement()
local days = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}
local daily_limit = 11
local doubleCountperday = {}
for class_name, subject_groups in pairs(Grouped_subjects) do
TimeTable[class_name\] = {}
for _, day in ipairs(days) do
TimeTable[class_name\][day\] = {}
doubleCountperday[day\] = 0
for p = 1, daily_limit do
TimeTable[class_name\][day\][p\] = nil
end
local reserved = Reserved_Periods[class_name\][day\] or {}
for period, reserved_name in pairs(reserved) do
TimeTable[class_name\][day\][period\] = reserved_name
end
end
for _, subject_group in ipairs(subject_groups) do
local placed = false
local needs_double = false
local subjects_done
local weekly_periods
for _, day in ipairs(days) do
for p = 1, daily_limit do
local try_double = false
local required_periods = 1
for _, subject in ipairs(subject_group) do
if DoublePeriodSubjects[subject\] then -- looks at the subjects to check if the user set this subject to need double
needs_double = true
end
if needs_double and doubleCountperday[day\] < 3 and ((Classes[class_name\][subject\].subject_periods_per_week - Classes[class_name\][subject\].Subjects_done_in_week ) >= 2 ) then -- checks if the number of double periods scheduled in the day are less than two then checks if the subjects remaining in the week are 2 or more so that it can set double periods
required_periods = 2
try_double = true
else
required_periods = 1
try_double = false
end
end
for _, subject in ipairs(subject_group) do
if subject == "math" then
print(Classes[class_name\][subject\].subject_periods_per_week)
end
end
if try_double then
if TimeTable[class_name\][day\][p + 1\] == nil and TimeTable[class_name\][day\][p\] == nil then
if p + required_periods - 1 <= daily_limit then
local conflict = false
for _, subject in ipairs(subject_group) do
if Classes[class_name\][subject\].Subjects_done_in_week >= Classes[class_name\][subject\].subject_periods_per_week then print("break") placed = false end
end
for offset = 0, required_periods - 1 do
for _, subject in ipairs(subject_group) do
local teacher = Get_teacher((Classes[class_name\][subject\]))
if teacher_schedule[teacher\] and teacher_schedule[teacher\][day .. (p + offset)\] then
conflict = true
break
end
end
if conflict then break end
end
if not conflict then
for offset = 0, required_periods - 1 do
if type(TimeTable[class_name\][day\][p\]) \~= "string" and type(TimeTable[class_name\][day\][p + 1\]) \~= "string" then
for _, subject in ipairs(subject_group) do
local teacher = Get_teacher((Classes[class_name\][subject\]))
TimeTable[class_name\][day\][p + offset\] = TimeTable[class_name\][day\][p + offset\] or {}
doubleCountperday[day\] = doubleCountperday[day\] + 1
table.insert(TimeTable[class_name\][day\][p + offset\], {
subject = subject,
teacher = teacher
})
if teacher then
teacher_schedule[teacher\] = teacher_schedule[teacher\] or {}
teacher_schedule[teacher\][day .. (p + offset)\] = true
end
for _, subject in ipairs(subject_group) do
Classes[class_name\][subject\].Subjects_done_in_week = Classes[class_name\][subject\].Subjects_done_in_week + 2
end
placed = true
break
end
end
end
end
if placed then break end
end
end
end
end
if not placed then
for p = 1, daily_limit do
local conflict = false
if TimeTable[class_name\][day\][p\] == nil then
for _, subject in ipairs(subject_group) do
local teacher = Get_teacher(Classes[class_name\][subject\])
for _, subject in ipairs(subject_group) do
print("Placing
when placing the subjects monday will be filled up completely but the other days will have a lot of free slots
function TimeTable_Placement()
local days = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday"}
local daily_limit = 11
local doubleCountperday = {}
for class_name, subject_groups in pairs(Grouped_subjects) do
TimeTable[class_name\] = {}
for _, day in ipairs(days) do
TimeTable[class_name\][day\] = {}
doubleCountperday[day\] = 0
for p = 1, daily_limit do
TimeTable[class_name\][day\][p\] = nil
end
local reserved = Reserved_Periods[class_name\][day\] or {}
for period, reserved_name in pairs(reserved) do
TimeTable[class_name\][day\][period\] = reserved_name
end
end
for _, subject_group in ipairs(subject_groups) do
local placed = false
local needs_double = false
local subjects_done
local weekly_periods
for _, day in ipairs(days) do
for p = 1, daily_limit do
local try_double = false
local required_periods = 1
for _, subject in ipairs(subject_group) do
if DoublePeriodSubjects[subject\] then -- looks at the subjects to check if the user set this subject to need double
needs_double = true
end
if needs_double and doubleCountperday[day\] < 3 and ((Classes[class_name\][subject\].subject_periods_per_week - Classes[class_name\][subject\].Subjects_done_in_week ) >= 2 ) then -- checks if the number of double periods scheduled in the day are less than two then checks if the subjects remaining in the week are 2 or more so that it can set double periods
required_periods = 2
try_double = true
else
required_periods = 1
try_double = false
end
end
for _, subject in ipairs(subject_group) do
if subject == "math" then
print(Classes[class_name\][subject\].subject_periods_per_week)
end
end
if try_double then
if TimeTable[class_name\][day\][p + 1\] == nil and TimeTable[class_name\][day\][p\] == nil then
if p + required_periods - 1 <= daily_limit then
local conflict = false
for _, subject in ipairs(subject_group) do
if Classes[class_name\][subject\].Subjects_done_in_week >= Classes[class_name\][subject\].subject_periods_per_week then print("break") placed = false end
end
for offset = 0, required_periods - 1 do
for _, subject in ipairs(subject_group) do
local teacher = Get_teacher((Classes[class_name\][subject\]))
if teacher_schedule[teacher\] and teacher_schedule[teacher\][day .. (p + offset)\] then
conflict = true
break
end
end
if conflict then break end
end
if not conflict then
for offset = 0, required_periods - 1 do
if type(TimeTable[class_name\][day\][p\]) \~= "string" and type(TimeTable[class_name\][day\][p + 1\]) \~= "string" then
for _, subject in ipairs(subject_group) do
local teacher = Get_teacher((Classes[class_name\][subject\]))
TimeTable[class_name\][day\][p + offset\] = TimeTable[class_name\][day\][p + offset\] or {}
doubleCountperday[day\] = doubleCountperday[day\] + 1
table.insert(TimeTable[class_name\][day\][p + offset\], {
subject = subject,
teacher = teacher
})
if teacher then
teacher_schedule[teacher\] = teacher_schedule[teacher\] or {}
teacher_schedule[teacher\][day .. (p + offset)\] = true
end
for _, subject in ipairs(subject_group) do
Classes[class_name\][subject\].Subjects_done_in_week = Classes[class_name\][subject\].Subjects_done_in_week + 2
end
placed = true
break
end
end
end
end
if placed then break end
end
end
end
end
if not placed then
for p = 1, daily_limit do
local conflict = false
if TimeTable[class_name\][day\][p\] == nil then
for _, subject in ipairs(subject_group) do
local teacher = Get_teacher(Classes[class_name\][subject\])
for _, subject in ipairs(subject_group) do
print("Placing