8000 More functions · Issue #6 · rafael2k/lua · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

More functions #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
toncho11 opened this issue Mar 7, 2025 · 7 comments
Open

More functions #6

toncho11 opened this issue Mar 7, 2025 · 7 comments

Comments

@toncho11
Copy link
Collaborator
toncho11 commented Mar 7, 2025

We need to either port some Lua libraries or implement some functions directly into the base.

Here is a initial list of functions that are good to have on ELKS:

@toncho11
Copy link
Collaborator Author
toncho11 commented Mar 7, 2025

So the ctrl+c should be something like that:

local function main()
    while true do
        print("Running... Press Ctrl+C to stop.")
        os.execute("sleep 1")  -- Simulate work
    end
end

local success, err = pcall(main)

if not success then
    print("Interrupted! Exiting gracefully.")
end

@toncho11
Copy link
Collaborator Author
toncho11 commented Mar 7, 2025

@ghaerr What is the recommended way to perform millisecond sleep of 40 ms for example?
libc/system/usleep.c ? So it should be:

#include <unistd.h>
usleep(40000);

for example?

@ghaerr
Copy link
ghaerr commented Mar 7, 2025

Yes, that's correct @toncho11.

@rafael2k
Copy link
Owner
rafael2k commented Mar 8, 2025

How about wrapping some curses functions just like these ones:
https://github.com/rafael2k/bobcat/tree/main/src/curses

@rafael2k
Copy link
Owner
rafael2k commented Mar 8, 2025

I think we should move all these functions to loslib, as it is an os-dependent function in lua definition.

@toncho11
Copy link
Collaborator Author
toncho11 commented Mar 8, 2025

Yes, that's correct @toncho11.

Thanks. I see you used also:

void GdDelay(unsigned long msecs)
{
    struct timeval timeval;

    timeval.tv_sec = msecs / 1000;
    timeval.tv_usec = (msecs % 1000) * 1000;
    select(0, NULL, NULL, NULL, &timeval);
}

@rafael2k
Copy link
Owner

@toncho11, I'm not sure about which recent changes in drawcube.lua did this, but it is running out-of-memory after running some time. I feel some kind of memory leak in the new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0