mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-11 22:31:52 +09:00
Working beeper (it can send morse)
Former-commit-id: 02553a52405ef4bba0d3f8f781f710b6c5b3ae16 Former-commit-id: 6cee7d2b44563a664756651d73a4b1ddfa70cf2f
This commit is contained in:
@@ -22,11 +22,11 @@ internal class HostAccessProvider(globals: Globals, computer: BaseTerrarumComput
|
||||
globals["native"]["println"] = PrintLn()
|
||||
globals["native"]["isHalted"] = IsHalted(computer)
|
||||
|
||||
globals["native"]["closeInputString"] = NativeCloseInputString(computer.term!!)
|
||||
globals["native"]["closeInputKey"] = NativeCloseInputKey(computer.term!!)
|
||||
globals["native"]["openInput"] = NativeOpenInput(computer.term!!)
|
||||
globals["native"]["getLastStreamInput"] = NativeGetLastStreamInput(computer.term!!)
|
||||
globals["native"]["getLastKeyPress"] = NativeGetLastKeyPress(computer.term!!)
|
||||
globals["native"]["closeInputString"] = NativeCloseInputString(computer.term)
|
||||
globals["native"]["closeInputKey"] = NativeCloseInputKey(computer.term)
|
||||
globals["native"]["openInput"] = NativeOpenInput(computer.term)
|
||||
globals["native"]["getLastStreamInput"] = NativeGetLastStreamInput(computer.term)
|
||||
globals["native"]["getLastKeyPress"] = NativeGetLastKeyPress(computer.term)
|
||||
|
||||
// while lua's dofile/require is fixiated to fs, this command allows
|
||||
// libraries in JAR to be loaded.
|
||||
|
||||
@@ -24,6 +24,7 @@ internal class Term(globals: Globals, term: Teletype) {
|
||||
globals["term"]["width"] = Term.GetWidth(term)
|
||||
globals["term"]["scroll"] = Term.Scroll(term)
|
||||
globals["term"]["isTeletype"] = Term.IsTeletype(term)
|
||||
globals["term"]["bell"] = Term.Bell(term)
|
||||
|
||||
if (term is Terminal) {
|
||||
globals["term"]["emitRaw"] = Term.EmitRaw(term)
|
||||
@@ -59,7 +60,14 @@ internal class Term(globals: Globals, term: Teletype) {
|
||||
throw LuaError("bad argument (string expected, got ${this.typename()})")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Bell(val tty: Teletype) : OneArgFunction() {
|
||||
override fun call(pattern: LuaValue): LuaValue {
|
||||
tty.bell(pattern.checkjstring())
|
||||
return LuaValue.NONE
|
||||
}
|
||||
}
|
||||
|
||||
class WriteString(val tty: Teletype) : LuaFunction() {
|
||||
override fun call(p0: LuaValue): LuaValue {
|
||||
if (tty is Terminal)
|
||||
|
||||
Reference in New Issue
Block a user