1
0
Fork 0

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:
mfranz 2008-10-03 20:46:08 +00:00
parent e6e1f8ae20
commit 437dbf524d
3 changed files with 12 additions and 10 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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"));