You might have wondered what the "go", "want", "get" and "grab" functions in the API are for. Well, it's easy: They're all synonyms :) [Originally, I wanted to call the function "in", but sadly, that is a keyword in Lua.]
It's just one of the most-used functions in TinyBrain: Including another snippet. You just pass the snippet ID and the snippet is loaded and expands into you current context.
For example, both of these statements have the same result:
get("#175")
go(175)
The former is a little better because it automatically turns the #175 into a link in the program listing. Function-wise, there's no difference.
Each of these statements gives you the "tableToString" function which is defined in #175.
If you want to run the included snippets in a separate sandbox, you can pass the sandbox as a second argument:
env = newCleanEnv()
get("#175", env)
assert(env.tableToString)
newCleanEnv means the included snippet does not see any of the variables or functions you define in your snippet. Safety is our first goal! :-)Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Recognizer | Recognition Result | Visualize | Recalc |
|---|---|---|---|
| #308 | 1065 | [visualize] |
| Snippet ID: | #189 |
| Snippet name: | go, want, get, grab |
| Eternal ID of this version: | #189/1 |
| Text MD5: | 02cbefa7a8d578a118cba1f9ae0b4efd |
| Author: | stefan |
| Category: | official documents |
| Type: | Document |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2014-01-19 01:22:08 |
| Source code size: | 1065 bytes / 20 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1080 / 278 |
| Referenced in: | #3000202 - Answer for stefanreich (>> T conversion bot) #3000238 - Answer for stefanreich (>> t power bot) #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |