Skip to content

:waifs() Built-In#58

Open
biscuitWizard wants to merge 7 commits intolisdude:masterfrom
SindomeCorp:all_waifs
Open

:waifs() Built-In#58
biscuitWizard wants to merge 7 commits intolisdude:masterfrom
SindomeCorp:all_waifs

Conversation

@biscuitWizard
Copy link
Copy Markdown
Contributor

@biscuitWizard biscuitWizard commented Jan 20, 2022

Added a builtin that returns all waifs called "waifs()"

It is garbage collector safe and doesn't maintain a reference to waifs.

For example:

;$waif
=> #118  (Generic Waif)
@prop me.test {} +rwc
Property added with value {}.
;me.test = {$waif:new()}
=> {[[class = #118, owner = #2]]}
;waifs()
=> {[[class = #118, owner = #2]]}
;me.test = {} 
=> {}
;waifs()
=> {}

When the game recycles the WAIF it also removes it from the cache of all waif references. This is much faster than the in-moo implementation of searching every property on every object in the game and is much safer.

@biscuitWizard
Copy link
Copy Markdown
Contributor Author

I've also added an optional argument that lets you specify the type of waif you are looking for:

@prop me.test {} +rwc
Property added with value {}.
;me.test = {$waif:new()}
=> {[[class = #118, owner = #2]]}
;waifs($waif)
=> {[[class = #118, owner = #2]]}
@create $waif named "Mysterious Waif"
You now have Mysterious Waif with object number #64 and parent Generic Waif (#118).
;waifs(#64)
=> {}
;waif_stats()
=> ["pending_recycle" -> 0, "total" -> 0]
;me.test = {#64:new()}
=> {[[class = #64, owner = #2]]}
;waifs(#64)
=> {[[class = #64, owner = #2]]}
;waifs($waif)
=> {}

@biscuitWizard biscuitWizard changed the title All waifs :waifs() Built-In Jan 20, 2022
StraylightRunMOO added a commit to StraylightRunMOO/toaststunt that referenced this pull request Apr 5, 2023
MAX_BASE_FUNC overflow causes function 256 (counting from 0) to overflow, creating a call to function 0 (run_gc)

Checking out from master, the function is `char_list()`. Checking `;function_info()[257][1]` should tell you the affected builtin if you're running a modified build.

Before:
```
;char_list("bob")
#-1:Input to EVAL (this == #-1), line 3:  Incorrect number of arguments (expected 0; got 1)
... called from built-in function eval()
... called from lisdude#58:eval_cmd_string, line 19
... called from lisdude#58:eval*-d, line 13
(End of traceback)
```

After:
```
;char_list("bob")
=> {"b", "o", "b"}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant