mirror of
https://github.com/ValKmjolnir/Nasal-Interpreter.git
synced 2026-07-26 21:08:45 +08:00
🚀 add stl/csv.nas & ast name change
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
# lib csv.nas
|
||||
# ValKmjolnir 2022/10/15
|
||||
var read_csv=func(path,delimeter=",",endline="\n"){
|
||||
var context=io.fin(path);
|
||||
context=split(endline,context);
|
||||
forindex(var i;context){
|
||||
context[i]=split(delimeter,context[i]);
|
||||
}
|
||||
if(size(context)<=1){
|
||||
die("incorrect csv file <"~path~">: "~size(context)~" line(s).");
|
||||
}
|
||||
return {
|
||||
property:context[0],
|
||||
data:context[1:]
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user