diff --git a/src/runtime/globals.ts b/src/runtime/globals.ts index 5764e0d..8992ce6 100644 --- a/src/runtime/globals.ts +++ b/src/runtime/globals.ts @@ -29,6 +29,7 @@ import { } from 'fs'; import path from 'path'; import { Runtime } from 'inspector'; +import { NumericLiteral } from '../parser/ast'; export function createGlobalEnv(filename: string): Environment { const env = new Environment(); @@ -169,6 +170,14 @@ export function createGlobalEnv(filename: string): Environment { return MK_NUMBER(str.length); }), ) + .set( + 'inyuguti', + MK_NATIVE_FN((args, env) => { + const str = (args[0] as StringVal).value; + const charIndex = (args[1] as NumberVal).value; + return MK_STRING(str.charAt(charIndex)); + }), + ) .set( 'inyuguti_nkuru', MK_NATIVE_FN((args, env) => {