diff --git a/Nasal/aircraft.nas b/Nasal/aircraft.nas index 6209abadc..1280e9bd5 100644 --- a/Nasal/aircraft.nas +++ b/Nasal/aircraft.nas @@ -192,11 +192,6 @@ var light = { stretch = arg[c]; c += 1; } - if (typeof(arg[c]) != "vector") { - die("aircraft.nas: the arguments of aircraft.light.new() have changed!\n" ~ - " *** BEFORE: aircraft.light.new(property, 0.1, 0.9, switch)\n" ~ - " *** NOW: aircraft.light.new(property, [0.1, 0.9], switch)"); - } m.pattern = arg[c]; c += 1; if (size(arg) > c and arg[c] != nil) diff --git a/Nasal/multikey.nas b/Nasal/multikey.nas index d5915a8e9..82fe9bd95 100644 --- a/Nasal/multikey.nas +++ b/Nasal/multikey.nas @@ -125,6 +125,8 @@ var Dialog = { forindex (var i; options) { var name = options[i].getNode("name", 1).getValue(); var desc = options[i].getNode("desc", 1).getValue() or ""; + if (name == "%%") + name = '%'; var c = g.addChild("text"); c.set("label", name); c.set("row", i); @@ -201,9 +203,9 @@ var help = func { print(string.color("33", sprintf("\n-- %s %s", title, substr(line, size(title) + 2)))); } if (k[1].getNode("no-exit") != nil) - desc ~= string.color("32", " +"); + desc ~= string.color("32", " +"); elsif (k[1].getNode("exit") != nil) - desc ~= string.color("31", " $"); + desc ~= string.color("31", " $"); printf("%s\t%s", colorize(k[0]), desc); } print(string.color("33", "\n-- Legend -------------------------------------------")); diff --git a/Nasal/string.nas b/Nasal/string.nas index 5a3aa0b9c..025c150cb 100644 --- a/Nasal/string.nas +++ b/Nasal/string.nas @@ -234,7 +234,12 @@ replace = func(str, old, new) { ## # Simple scanf function. Takes an input string, a pattern, and a # vector. It returns 0 if the format didn't match, and appends -# all found elements to the given vector. +# all found elements to the given vector. Return values: +# +# -1 string matched format ending with % (i.e. more chars than format cared about) +# 0 string didn't match format +# 1 string matched, but would still match if the right chars were added +# 2 string matched, and would not if any character would be added # # var r = string.scanf("comm3freq123.456", "comm%ufreq%f", var result = []); # @@ -271,7 +276,7 @@ var scanf = func(test, format, result) { success = 1; # unsafe match f = format.getc(); if (f == nil) - die("scanf: trailing % in format"); + return -1; # format ended with % if (f == `%`) { if (str.getc() != `%`) return 0; @@ -371,7 +376,7 @@ var setcolors = func(enabled) { # Add ANSI color codes to string, if terminal-ansi-colors are enabled and # stderr prints to a terminal. Example: # -# print(string.color("31", "this is red")); +# print(string.color("31;1", "this is red")); # var color = func nil; setcolors(getprop("/sim/startup/terminal-ansi-colors"));