ldoc icon indicating copy to clipboard operation
ldoc copied to clipboard

custom_display_name_handler in config.ld is almost useless: string library is not available

Open van-de-bugger opened this issue 10 years ago • 1 comments
trafficstars

Hi,

I am trying to utilize custom_display_name_handler in my config.ld with no success, because string library is not available within config.ld. Attempt to call string.format or string.sub causes ldoc failure:

template failed for foo: [string "config"]:11: attempt to index a nil value (global 'string')

Built-in functions are available (like print or pairs), but string manipulation abilities are limited with string concatenation operator ... This is too restrictive.

Please let standard libraries, namely string and table, be available from within config.ld.

ldoc v1.4.3, lua 5.3.0.

van-de-bugger avatar Jun 03 '15 23:06 van-de-bugger

There's a way to use most string functions, and that's to use them as methods, e.g. ('hello %s'):format('dolly') (the standard metatable for strings has __index==string). I agree that table functions could be useful, however.

stevedonovan avatar Jun 26 '16 17:06 stevedonovan

For string functions the previous comment has a way to use them. For ever more advanced functions the v1.5.0 release includes a way to include (non-sandboxed) way to load modules.

alerque avatar May 04 '23 20:05 alerque