NetLogo / Tortoise

Compiler and runtime engine for NetLogo models that runs in JavaScript 🐢
https://netlogoweb.org
Other
56 stars 27 forks source link

Add small API for introspecting compilation results #225

Closed TheBizzle closed 3 years ago

TheBizzle commented 3 years ago

@LaCuneta, you mentioned that you'd find this sort of thing useful for NetTango, so I wanted to run the API by you before merging it into master.

It is as follows:

BrowserCompiler.listGlobalVars

Returns: Array[{ name: String_AnyCase, type: "interface" | "user" }]

BrowserCompiler.listProcedures

Returns: Array[{ argCount: Int, isReporter: Boolean, isUseableByObserver: Boolean, isUseableByTurtles: Boolean, name: String_LowerCase }]

BrowserCompiler.listVarsForBreed(String_AnyCase)

Returns: Array[String_LowerCase]

(Includes built-ins, like who and size)

Let me know if you would like to see any changes made. :sunglasses: