Jump to content




Lua Debug Library in CC?


  • You cannot reply to this topic
2 replies to this topic

#1 ArqiTek

  • New Members
  • 1 posts

Posted 29 October 2015 - 03:01 PM

Is lua's debug library implemented in CC? I was hoping to use debug.getinfo to improve traceability.

My code's pretty heavy on the coroutines so when a function parameter is mishandled higher up the stack the default trace usually doesn't cut it. error(_,level) has been helpful but it would be nice to avoid having to throw exceptions whenever there's a problem...

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 29 October 2015 - 03:23 PM

Nope, the debug API is purposely disabled, as exposing it would break the sandbox's internal walls between the computers.

#3 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 29 October 2015 - 03:25 PM

If you are running on a local world, CCTweaks adds an option to enable the debug api (add "debug" to globalWhitelist in the config) - though obviously don't do this on a server.

If you just want to trace, you can get the current function + line through pcall and error:
local _, func = pcall(error, "", 2)

 -- Or even:
print(select(2, pcall(error, "", 2))

Edited by SquidDev, 29 October 2015 - 03:27 PM.






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users