Greed/Wren: Difference between revisions

m
Minor tidy
(Added code.)
 
m (Minor tidy)
 
(One intermediate revision by the same user not shown)
Line 1:
===Code===
{{trans|Go}}
{{libheader|ncurses}}
Line 7:
{{works with|Ubuntu 20.04}}
An embedded script so we can use the ncurses library.
<langsyntaxhighlight ecmascriptlang="wren">/* greedGreed.wren */
 
import "./dynamic" for Struct
Line 216:
NC.echo()
NC.endwin()
NC.cursSet(1)</langsyntaxhighlight>
<br>
We now embed this in the following C program, build and run it.
<langsyntaxhighlight lang="c">/* gcc greedGreed.c -o greedGreed -lncurses -lwren -lm */
 
#include <stdio.h>
Line 410:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "greedGreed.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 431:
free(script);
return 0;
}</langsyntaxhighlight>
9,487

edits