aircraft.nas: light: remove backwards compatibility warning
multikey.nas: don't show %% in option display for % string.nas: scanf: add -1 return mode; documentation
This commit is contained in:
parent
e6e1f8ae20
commit
437dbf524d
3 changed files with 12 additions and 10 deletions
|
@ -192,11 +192,6 @@ var light = {
|
||||||
stretch = arg[c];
|
stretch = arg[c];
|
||||||
c += 1;
|
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];
|
m.pattern = arg[c];
|
||||||
c += 1;
|
c += 1;
|
||||||
if (size(arg) > c and arg[c] != nil)
|
if (size(arg) > c and arg[c] != nil)
|
||||||
|
|
|
@ -125,6 +125,8 @@ var Dialog = {
|
||||||
forindex (var i; options) {
|
forindex (var i; options) {
|
||||||
var name = options[i].getNode("name", 1).getValue();
|
var name = options[i].getNode("name", 1).getValue();
|
||||||
var desc = options[i].getNode("desc", 1).getValue() or "";
|
var desc = options[i].getNode("desc", 1).getValue() or "";
|
||||||
|
if (name == "%%")
|
||||||
|
name = '%';
|
||||||
var c = g.addChild("text");
|
var c = g.addChild("text");
|
||||||
c.set("label", name);
|
c.set("label", name);
|
||||||
c.set("row", i);
|
c.set("row", i);
|
||||||
|
|
|
@ -234,7 +234,12 @@ replace = func(str, old, new) {
|
||||||
##
|
##
|
||||||
# Simple scanf function. Takes an input string, a pattern, and a
|
# Simple scanf function. Takes an input string, a pattern, and a
|
||||||
# vector. It returns 0 if the format didn't match, and appends
|
# 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 = []);
|
# 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
|
success = 1; # unsafe match
|
||||||
f = format.getc();
|
f = format.getc();
|
||||||
if (f == nil)
|
if (f == nil)
|
||||||
die("scanf: trailing % in format");
|
return -1; # format ended with %
|
||||||
if (f == `%`) {
|
if (f == `%`) {
|
||||||
if (str.getc() != `%`)
|
if (str.getc() != `%`)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -371,7 +376,7 @@ var setcolors = func(enabled) {
|
||||||
# Add ANSI color codes to string, if terminal-ansi-colors are enabled and
|
# Add ANSI color codes to string, if terminal-ansi-colors are enabled and
|
||||||
# stderr prints to a terminal. Example:
|
# 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;
|
var color = func nil;
|
||||||
setcolors(getprop("/sim/startup/terminal-ansi-colors"));
|
setcolors(getprop("/sim/startup/terminal-ansi-colors"));
|
||||||
|
|
Loading…
Reference in a new issue