Questions tagged [anura]

Anura is a free open-source cross-platform 2D game engine written in C++. It has a built-in interpreter for FFL (Frogatto Formula Language), a pure functional language used to code its games or other modules. Its module code and configuration data are stored in FSON, a custom version of JSON. Use this tag for all issues related to building, installing, or developing content with the Anura game engine.

9 questions
2
votes
2 answers

advanced ffl: conditional expression then-expressions activation

Here is a snippet from https://github.com/anura-engine/anura/blob/55bc02244f0faba5e0831578a3c1c9a82e7bf569/src/formula_function.cpp#L923-L931: FUNCTION_DEF(if, 2, -1, "if(a,b,c)") const int nargs = static_cast(NUM_ARGS); …
1737973
  • 159
  • 18
  • 42
2
votes
2 answers

keyword - FFL: Where vs. Let

I was trying to understand the following code: def() ->commands if(deferred_passive_abilities != [], let [{ability: class passive_ability, creature: class creature}] items = []; let found = false; …
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

`ld` complains of no such file or directory, when it exists by exact name

I have a rather old-school Makefile which calls g++ to compile my program on Ubuntu¹. When I run make, it prints out the following error after some compilation happens. /usr/bin/ld: cannot find -l/usr/lib/x86_64-linux-gnu/libX11.so: No such file or…
DDR
  • 392
  • 1
  • 4
  • 14
0
votes
1 answer

FFL: second identifier from where clause not recognized

I believe my syntax is correct on this one, but for some reason the Anura FFL parser is not recognizing the second identifier choice defined in my where clause. What am I missing? def(class creature creature, class game_state game) ->commands [ …
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

Combine asserting clauses with where clauses

I have noticed that when I have multiple where clauses and multiple asserting clauses, that I get often get syntax errors when I combine them together. The error will say "unexpected token after where". How should I write it to avoid this error?…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
2 answers

filter max of N

Could it be possible to write in FFL a version of filter that stops filtering after the first negative match, i.e. the remaining items are assumed to be positive matches? more generally, a filter. Example: removeMaxOf1([1,2,3,4], value>=2) Expected…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

Understanding the evaluation and execution order with semicolon syntax

I already learned a little bit about FFL semicolons from my previous question. However, it is still not clear what order of evaluation or execution they enforce. So here is a more concrete example: [ expr_a, expr_b ; expr_c, expr_d ; expr_e, expr_f…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

Understanding the lib keyword

Is lib a special keyword for Frogatto Formula Language (FFL)? That seems to be the way of invoking class methods. For example: where frog = lib.citadel.create_creature('Giant Frog') Also, I am interested to know where can I find a list of all the…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51
0
votes
1 answer

should FFL where clause allow referring to previous variable?

So, in Frogatto Formula Language we can have a where clause with multiple assignments, like where a = yadda, b = foo However I can't refer to a in the assignment of b ? I was hoping to simplify by breaking it into steps, where a = ..., b =…
Patrick Parker
  • 4,863
  • 4
  • 19
  • 51