Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

Redirecting stdout #128

Description

@Frityet

I am trying to redirect stdout to a <pre>, so I did

    const handleExecute = async () => {
        setOutput('')
        try {
            const lua = await getLuaState()
            const _G = lua.getGlobalTable()
            // const io = _G.get('io') as LuaTable
            _G.set('print', (args: any) => {
                console.log({ args })
                setOutput((prev) => prev + args + '\n')
                console.log("print(): " + args)
            })
            await lua.run(code);
        } catch (error: any) {
            setOutput("Error: " + error.message)
        }
    }

however args seems to be undefined for any input

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions