Skip to content

Commit 0cf962f

Browse files
bruter updated to 0.2.9
1 parent e6597de commit 0cf962f

File tree

12 files changed

+67
-145
lines changed

12 files changed

+67
-145
lines changed

bruter/example/benchmark.br

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ set Room from function {w h}
3838
set tmpw (- $w 1);
3939
set tmph (- $h 1);
4040
// create the walls on the limits
41-
//print $w $h;
41+
// print $w $h;
4242
for {set i 1} {< $i $w} {set i (+ $i 1)}
4343
{
44-
//print $i;
44+
// print $i;
4545
set temproom.map.$i.1 35;
4646
set temproom.map.$i.$tmph 35;
4747
};

bruter/example/compiling.br

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ set io (C.include stdio.h);
33
set codestr `return terra() br.io.printf("this code been printed from a executable file...\n") end`;
44

55
set main (lua.eval $codestr); // this set the main;
6-
export main; // this make sure the main function is exported, otherwise it will not be part of the compiled code;
6+
set exports.main $main; // this make sure the main function is exported, otherwise it will not be part of the compiled code;

bruter/example/conditions.br

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ set d true;
2222

2323

2424
// this is a "and" statement;
25-
if (== (:$c) (:$d))
25+
if (== $c $d)
2626
{
2727
print `$a == $b`;
2828
}
2929
else
3030
{
3131
// "or" statement;
32-
if (:$c;:$d)
32+
if (return $c;return $d)
3333
{
3434
print `$a != $b`;
3535
}
@@ -54,5 +54,5 @@ else
5454
set e 51;
5555
// only the value of the last statement is returned, the rest are ignored because they are nil;
5656
// : is a return statement just like return;
57-
set f (:$v;:$h;:$v;:$e);
57+
set f (: $v;: $h;: $v;: $e);
5858
print f = $f;

bruter/example/functions.br

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,4 @@ help b;
2929

3030
b.abc 55 44 11;
3131

32-
//print `sum 5 5 is` (sum 5 5);
33-
3432
print (b.strtest `this is a string`);

bruter/example/loop.br

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
vm.safe;
2-
lua.eval "print('Hello from Lua!')"; -- not gonna work because of vm.safe;
1+
lua.eval {print('Hello from Lua!')};
32

43
set a 45;
54
set b 5;

bruter/example/parenthesis.br

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using math;
2-
({set}({a})(+(4)(55)(6)(-(^(4)(4))(%(45)(7))))); // this is just to battle test the math parenthesis, keys and the math functions;
2+
({set} (: {a}) (+ (: 4) (: 55) (: 6) (- (^ (: 4) (: 4)) (% (: 45) (: 7))))); // this is just to battle test the math parenthesis, keys and the math functions;
33
print it is $a;
44

55

66
// in this case help is run 3 times and then return 4 when it haves a return the function stops;
7-
(help;help;help;return(4));
7+
(help;help;help;return 4);
88
// in this case help runs only the first time and then return 4, so the function is interrupted all the other commands after the first return are not executed;
9-
(help;return(4);help;help;help;return(12));
9+
(help;return help;help;help;help;return 12);

bruter/example/roguelike.br

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ set Room from function {w h}
3838
set tmpw (- $w 1);
3939
set tmph (- $h 1);
4040
// create the walls on the limits
41-
//print $w $h;
41+
// print $w $h;
4242
for {set i 1} {< $i $w} {set i (+ $i 1)}
4343
{
44-
//print $i;
44+
// print $i;
4545
set temproom.map.$i.1 35;
4646
set temproom.map.$i.$tmph 35;
4747
};

bruter/example/types.br

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
// (// (// multilevel sentence));
1212

1313
set variable 0; // this has setten a variable;
14-
($variable); // this is a variable enclosed in a sentence;
14+
(: $variable); // this is a variable enclosed in a sentence;
1515

16-
(true); // this is a boolean enclosed in a sentence;
17-
(false); // this is a boolean enclosed in a sentence;
16+
(: true); // this is a boolean enclosed in a sentence;
17+
(: false); // this is a boolean enclosed in a sentence;
1818

19-
(nil); // this is a nil enclosed in a sentence;
19+
(: nil); // this is a nil enclosed in a sentence;

bruter/lib/luatils/_string.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ end
106106

107107

108108
_string.replace = function(inputString, oldSubstring, newSubstring)
109-
newSubstring = newSubstring or ''
110-
return inputString:gsub(oldSubstring, newSubstring)
109+
return inputString:gsub(oldSubstring, newSubstring or "")
111110
end
112111

113112
_string.replace3 = function(inputString, oldSubstring, newSubstring) -- returns a string with the oldSubstring replaced by the newSubstring respecting the backticks enclosed strings and keeping them

bruter/libr/img.br

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// this lib does nothing;
1+
// this lib does nothing; ignore it;
22
set tokens from [];
33

44
set rgb (lua.eval {
@@ -24,7 +24,7 @@ set , (lua.eval {
2424
, 1 128 7 utils.array.sum;
2525
, 1 128 8 utils.array.tostring;
2626

27-
//lua utils _matrix;
27+
// lua utils _matrix;
2828
, 1 128 9 utils.matrix.includes;
2929
, 1 128 10 utils.matrix.new;
3030
, 1 128 11 utils.matrix.tostring;
@@ -35,7 +35,7 @@ set , (lua.eval {
3535
, 1 128 16 utils.matrix.reduce;
3636
, 1 128 17 utils.matrix.filter;
3737

38-
//lua utils _console;
38+
// lua utils _console;
3939
, 1 128 18 utils.console.colors.black;
4040
, 1 128 19 utils.console.colors.reset;
4141
, 1 128 20 utils.console.colors.red;
@@ -50,7 +50,7 @@ set , (lua.eval {
5050
, 1 128 29 utils.console.randomcolor;
5151
, 1 128 30 utils.console.movecursor;
5252

53-
//lua utils _encode_old;
53+
// lua utils _encode_old;
5454
, 1 128 31 utils.encode.shuffleTable;
5555
, 1 128 32 utils.encode.invertlabel;
5656
, 1 128 33 utils.encode.encrypt;
@@ -60,12 +60,12 @@ set , (lua.eval {
6060
, 1 128 37 utils.encode.save;
6161
, 1 128 38 utils.encode.load;
6262

63-
//lua utils _encode;
63+
// lua utils _encode;
6464
, 1 128 39 utils.encode.genKey;
6565
, 1 128 40 utils.encode.encrypt;
6666
, 1 128 41 utils.encode.decrypt;
6767

68-
//lua utils file;
68+
// lua utils file;
6969
, 1 128 42 utils.file.list;
7070
, 1 128 43 utils.file.isdir;
7171
, 1 128 44 utils.file.load.text;
@@ -74,10 +74,10 @@ set , (lua.eval {
7474
, 1 128 47 utils.file.load.charMap;
7575
, 1 128 48 utils.file.save.charMap;
7676
, 1 128 49 utils.file.load.map;
77-
, 1 128 50 utils.file.exist;
77+
// , 1 128 50 utils.file.exist; // removed;
7878
, 1 128 51 utils.file.check;
7979

80-
//lua utils _math;
80+
// lua utils _math;
8181
, 1 128 52 utils.math.regrad3;
8282
, 1 128 53 utils.math.scale;
8383
, 1 128 54 utils.math.vec2;
@@ -97,7 +97,7 @@ set , (lua.eval {
9797
, 1 128 68 utils.math.primo;
9898
, 1 128 69 utils.math.mmc;
9999

100-
//lua utils _string;
100+
// lua utils _string;
101101
, 1 128 70 utils.string.endsWith;
102102
, 1 128 71 utils.string.charAt;
103103
, 1 128 72 utils.string.byteAt;
@@ -110,7 +110,7 @@ set , (lua.eval {
110110
, 1 128 79 utils.string.trim;
111111
, 1 128 80 utils.string.firstWord;
112112

113-
//lua utils _table;
113+
// lua utils _table;
114114
, 1 128 81 utils.table.assign;
115115
, 1 128 82 utils.table.len;
116116
, 1 128 83 utils.table.add;
@@ -133,7 +133,7 @@ set , (lua.eval {
133133
, 1 128 100 utils.table.clear;
134134
, 1 128 101 utils.table.selfClear;
135135

136-
//lua utils init;
136+
// lua utils init;
137137
, 1 128 102 utils.isjit;
138138
, 1 128 103 utils.luaversion;
139139
, 1 128 104 utils.time;
@@ -153,7 +153,7 @@ set , (lua.eval {
153153
, 1 128 118 utils.repeater;
154154
, 1 128 119 utils.agendar;
155155

156-
//br.lua br
156+
// br.lua br
157157

158158
, 1 128 120 global;
159159
, 1 128 121 exports;
@@ -166,7 +166,7 @@ set , (lua.eval {
166166
, 1 128 128 vm.oneliner;
167167
, 1 128 129 this;
168168
, 1 128 130 vm.preprocessors.sugar;
169-
, 1 128 131 vm.safe;
169+
// , 1 128 131 vm.safe;// removed;
170170
, 1 128 132 +;
171171
, 1 128 133 -;
172172
, 1 128 134 *;
@@ -177,7 +177,7 @@ set , (lua.eval {
177177
, 1 128 139 ==;
178178
, 1 128 140 !=;
179179
, 1 128 141 includes;
180-
, 1 128 142 exists;
180+
// , 1 128 142 exists; // removed;
181181
, 1 128 143 vm.parsearg;
182182
, 1 128 144 vm.parseargs;
183183
, 1 128 145 vm.parseargsoptimized;
@@ -225,4 +225,5 @@ set , (lua.eval {
225225
, 1 128 187 shortcut;
226226

227227

228-
set , nil;
228+
set , nil;
229+
print "ok";

bruter/libr/math.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
br.math = {};
2+
13
-- heh
24
for k, v in pairs(math) do
35
br.math[k] = v;

0 commit comments

Comments
 (0)