Log In  

I made an editor that pops out in a window, since I'm having trouble exporting it properly so I'll drop the src here

local editor
local gui

window(150,200)

menuitem({
    id=0,
    label="Save to ram",
    action=function()
        store("/ram/cart/main.lua",table.concat(editor:get_text(),"\n"),{})
        notify("saved to /ram/cart/main.lua")
    end
})

menuitem({
    id=1,
    label="Run from ram",
    action=function()
        create_process("/ram/cart/main.lua")
    end
})

function _init()
    gui = create_gui()

    editor = gui:attach_text_editor({
        x=0,y=0,
        width=150,
        height=200,
        syntax_highlighting=true,
        show_line_numbers=true,
        markup=false,
        embed_pods=true,
        has_search=true
    })

    window {
        title="Popout editor"
    }

    editor:attach_scrollbars({autohide=true})

    editor:set_text(fetch("/ram/cart/main.lua"))
end

function _draw()
    gui:update_all()
    gui:draw_all()
end

It's very limited currently but I plan on updating it a little more as I learn. Feel free to poke around the code and make modifications of your own.

(I'll make a proper cartridge post once I can export it in the correct format)

P#143048 2024-03-15 02:37 ( Edited 2024-03-15 19:47)

This has been moved to https://www.lexaloffle.com/bbs/?tid=140693 (since the new version allows png exports on windows)

P#143190 2024-03-15 19:46

[Please log in to post a comment]