1
0
Fork 0
Commit graph

38 commits

Author SHA1 Message Date
Anton Gomez Alvedro
6ae3fae393 Add io.include() function to Nasal base library
io.inlude() loads and executes a Nasal file in place, effectively embedding
the script in the calling namespace. The function adds a symbol mark in the
namespace to avoid duplicate loading.

Additionally, in this path:

 + io.basename() & io.dirname(): Convenience functions for managing path
   strings. Designed after their unix counterparts.

 + string.normpath(): Improved support for relative paths. It can now handle
   paths starting with double dots, like ../../Directory
2013-12-08 11:51:34 -06:00
Anders Gidenstam
24d9e19cd8 Nasal/string.nas: Corrected a misspelled variable name. 2012-05-20 22:50:59 +02:00
Stuart Buchanan
bb9e21f6e6 Revert "Initial check-in of MP groups function"
This reverts commit e9113980449fe50eb186a3b2e26bc88dc613d841.
2010-06-27 23:23:56 +01:00
Stuart Buchanan
fee08cca57 Initial check-in of MP groups function 2010-06-18 21:13:47 +01:00
mfranz
9957c0a6e1 add eXtended isstring: isxstring(), which also applies to \n 2009-01-27 19:27:21 +00:00
mfranz
14a928f391 trim: allow to specify alternative trim class function 2009-01-27 01:42:46 +00:00
mfranz
c350a7b6a8 s/fixpath/normpath/ (as in python) 2008-10-15 16:35:11 +00:00
mfranz
77480233a6 ok, and now really fix it :-P 2008-10-06 20:22:28 +00:00
mfranz
459add7acb d'oh ... s/setlistener/_setlistener/ 2008-10-06 20:12:50 +00:00
mfranz
437dbf524d aircraft.nas: light: remove backwards compatibility warning
multikey.nas: don't show %% in option display for %
string.nas: scanf: add -1 return mode; documentation
2008-10-03 20:46:08 +00:00
mfranz
e6e1f8ae20 - move color functions from debug.nas to string.nas
- multikey.nas: add exit/no-exit markers to help output
2008-10-03 15:20:12 +00:00
mfranz
fbd73ee7d3 multikey.nas: don't show empty ("reserved") entries
string.nas: scanf: detect %% correctly
2008-10-03 09:47:40 +00:00
mfranz
3fbb11b27a scanf: don't bark on empty test string if format ends with number element 2008-10-02 00:58:57 +00:00
mfranz
5fd89049bb add field width to %s & coding style 2008-10-01 19:51:44 +00:00
tat
04d90bae5a Added: %s support for scanf 2008-10-01 18:36:09 +00:00
mfranz
df90d69de9 string.scanf(): return elements in vector given as argument; function
only returns success (0: no match, 1: extensible match, 2: safe match)
2008-09-29 10:06:16 +00:00
mfranz
3197bc3f24 string.scanf(): more efficient and (more :) correct %f detection 2008-09-28 20:23:14 +00:00
mfranz
13a5e62995 scanf: '+' or '-' alone aren't really numbers 2008-09-28 16:20:49 +00:00
mfranz
3f4df41fc7 add simple scanf function (a.k.a. poor man's regex) 2008-09-26 12:04:57 +00:00
mfranz
917cace77c string.nas: remove forgotten debug message
props.nas: replace some "arg[*]" by named args
aircraft.nas: load aircraft data only if the file exists (to avoid warning)
debug.nas: no space before colon & fixed comment & cosmetics
2008-08-14 22:13:25 +00:00
mfranz
ae40faf4e5 cosmetics (comment fixes & improvements, variable name) 2008-07-27 22:00:58 +00:00
mfranz
fee6139da5 partly revert last change: thisfunc() isn't safe enough for this purpose 2008-07-23 00:41:18 +00:00
mfranz
7bbbfa6a8e use thisfunc() instead of caller(0)[1] 2008-07-22 23:26:46 +00:00
mfranz
8b6ff24167 make sure functions used by the security code are tamper-proof 2008-07-22 21:22:59 +00:00
mfranz
86475efa5e fixpath: handle empty strings 2008-07-11 15:23:23 +00:00
mfranz
b8ba3c5f66 cosmetics (no braces for one-liner functions; looks nicer, IMHO) 2008-07-03 16:24:52 +00:00
mfranz
cf9f30cb11 fixpath(): simplify by using new join() and replace() functions 2008-06-22 11:33:13 +00:00
mfranz
d86b1b9c74 string.nas: new functions string.join() and string.replace()
debug.nas: let benchmark() repeat tested function
io.nas: cosmetics
aircraft.nas: initialize time property only once
2008-06-21 07:10:32 +00:00
mfranz
4d17687f12 move fixpath back to string.nas. It *is* about strings, after all, and also
usable for property paths, so io.nas doesn't seem the right place.
2008-06-13 13:01:38 +00:00
mfranz
7d9bd68742 - move fixpath() from "string" to "io" module
- first stab at Nasal security model: allow writing files only to authorized
  dirs. (Most of the debug messages will be removed later.)
2008-06-13 11:35:55 +00:00
mfranz
2866043c3d - prop_key_handler: limitate history to history-max-size on loading
- string/debug: cosmetics
2008-06-08 11:14:57 +00:00
mfranz
4b5550520b character class fixes (isfoo()) 2007-11-26 09:50:18 +00:00
mfranz
9dfa8830a7 more isfoo() functions (yes, I intend to use them :-) 2007-11-16 17:16:42 +00:00
mfranz
dfd21c722d - add more "var" keywords, fix indentation, drop some parentheses,
fix comments, consistency fixes, ...
- aircraft.nas: angular_lowpass -> minor speedup
2007-10-07 15:12:05 +00:00
mfranz
43d6e707bb minus can't be delimiter in a [] range 2007-06-22 20:41:00 +00:00
mfranz
cfd9c1b48f pointless spelling fixes 2007-06-22 18:49:38 +00:00
mfranz
248d4fcf60 - fix behavior for broken input
- more documentation
2007-06-22 17:52:37 +00:00
mfranz
f827653668 - create new Nasal module string.nas with simple shell style pattern matching
algorithm (needed for the file selector and useful for other purposes, like
  assembling lists of livery or screenshot files etc.)
- io.nas: move fixpath to string.nas (it's not only useful for file paths
  but can also be used for property paths)
- screen.nas: move trim to string.nas (used by screen.nas and nasal-console.xml)
- gui.nas: add pattern matching to FileSelctor
- ufo.nas: use patterm matching (only *.ac and *.xml files shall be listed)
2007-06-22 14:13:30 +00:00