ID:1424721
 
Not a bug
BYOND Version:501
Operating System:Windows 8 Pro 64-bit
Web Browser:Chrome 31.0.1650.57
Applies to:DM Language
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
Calling text2path() with /proc paths doesn't output the correct path, instead choosing to put out null.
This messes up feeding proc paths into typesof().

Numbered Steps to Reproduce Problem:
1. Run code.
2. Frown as code prints a blank line instead of "/foo/proc"

Code Snippet (if applicable) to Reproduce Problem:
/foo/proc/test()
src << text2path("/foo/proc")
/mob/Login()


Expected Results:
"/foo/proc" to be printed to the user's screen.

Actual Results:
A blank line is printed to the user's screen; text2path returns null.

Does the problem occur:
Every time? Or how often? Everytime.
In other games? n/a
In other user accounts? n/a
On other computers? Yes.

When does the problem NOT occur?
When running text2path with paths that don't end with /proc

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:
None.
text2path only applies to datums, iirc. There are special properties with proc and verb paths...special enough where you can use them just as text in place of a path, without text2path.

can you give an example of where you'd like to use text2path with proc paths?
/proc/callHook(hook)
var/hook_path = text2path("/hook/[hook]")
if(!hook_path)
error("Invalid hook '/hook/[hook]' called.")
return 0

var/hook_proc = text2path("[hook_path]/proc")
if(!hook_proc) // Hook has no procs, do nothing.
return 1

var/caller = new hook_path
var/status = 1
for(var/P in typesof(hook_proc))
if(!call(caller, P)())
error("Hook '[P]' failed or runtimed.")
status = 0

return status

If there's an easier way to do this, I'd love to hear it.
Couldn't you use hascall()?
Yup, hascall() is pretty much the best way to do this, from what I see.
hascall() won't allow me to do what typesof(foo/proc) does; call every proc defined on an object.
I believe typesof() allows types as text strings, so, sure it would.
You don't need to use text2path, actually. The typesof proc uses text and shows off how wonderfully inconsistent DM is.

poop
proc/A() world << "A"
proc/B() world << "B"
proc/C() world << "C"

dung
proc/D() world << "D"

mob/Login()
var poop/poop = new /poop/dung
for(var/p in typesof("[poop.type]/proc"))
call(poop, p)()

// Output:
// D
Stephen001 resolved issue (Not a bug)