public static DynValue NumberToString(Interpreter interpreter, ClrFunctionArguments args) { args.ExpectAtLeast(1) .ExpectIntegerAtIndex(0); var number = (int)args[0].Number; var toBase = 10; if (args.Count == 2) { args.ExpectIntegerAtIndex(1); toBase = (int)args[1].Number; } return(new DynValue(Convert.ToString(number, toBase))); }