import { luaAssert , loadLuaFile } from "./luafuncs" ; import { Debugger } from "./debugger" ; declare const ____exports ; _G . lldebugger = _G . lldebugger || ____exports ; io . stdout . setvbuf ( "no" ) ; io . stderr . setvbuf ( "no" ) ; export function start ( breakImmediately ? ) { if ( breakImmediately === undefined ) { breakImmediately = ( os . getenv ( "LOCAL_LUA_DEBUGGER_VSCODE" ) === "1" ) ; } Debugger . debugGlobal ( breakImmediately ) ; } export function finish ( ) { Debugger . popHook ( ) ; } export function stop ( ) { Debugger . clearHook ( ) ; } export function runFile ( filePath , breakImmediately ? , arg ? ) { if ( typeof filePath !== "string" ) { throw `expected string as first argument to runFile, but got '${ type ( filePath ) }'` ; } if ( breakImmediately !== undefined && typeof breakImmediately !== "boolean" ) { throw `expected boolean as second argument to runFile, but got '${ type ( breakImmediately ) }'` ; } const env = setmetatable ( { arg } , { __index : _G } ) ; const [ func ] = luaAssert ( ... loadLuaFile ( filePath , env ) ) ; return Debugger . debugFunction ( func as Debugger . DebuggableFunction , breakImmediately , arg ?? [ ] ) ; } export function call ( func , breakImmediately ? , ... args ) { if ( typeof func !== "function" ) { throw `expected string as first argument to debugFile, but got '${ type ( func ) }'` ; } if ( breakImmediately !== undefined && typeof breakImmediately !== "boolean" ) { throw `expected boolean as second argument to debugFunction, but got '${ type ( breakImmediately ) }'` ; } return Debugger . debugFunction ( func as Debugger . DebuggableFunction , breakImmediately , args ) ; } export function requestBreak ( ) { Debugger . triggerBreak ( ) ; }