Debug.hx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C)2005-2016 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package lua;
  23. /**
  24. Externs for the "debug" class for Haxe lua
  25. **/
  26. import haxe.Constraints.Function;
  27. import lua.Table.AnyTable;
  28. @:native("debug")
  29. extern class Debug {
  30. public static function getlocal(stackLevel : Int, varName : String) : Dynamic;
  31. public static function setlocal(stackLevel : Int, varName: String, value: Dynamic) : Void;
  32. public static function getinfo(stackLevel : Int) : DebugInfo;
  33. public static function sethook(?fun : Function, ?monitor : String) : Void;
  34. public static function debug() : Void;
  35. public static function gethook(thread : Coroutine) : Function;
  36. public static function getregistry() : AnyTable;
  37. public static function getmetatable(value : AnyTable) : AnyTable;
  38. public static function setmetatable(value : AnyTable, table : AnyTable) : Void;
  39. public static function getupvalue(f : Function, up : Int) : Dynamic;
  40. public static function setupvalue(f : Function, up : Int, val : Dynamic) : Void;
  41. public static function getuservalue(val : Dynamic) : Dynamic;
  42. public static function setuservalue(udata : Dynamic, val : Dynamic) : Void;
  43. public static function traceback(?thread : Coroutine, ?message : String, ?level : Int) : Void;
  44. public static function upvalueid(f : Function, n : Int) : Dynamic;
  45. public static function upvaluejoin(f1 : Function, n1 : Int, f2 : Function, n2 : Int) : Void;
  46. }
  47. typedef DebugInfo = {
  48. currentline : Int,
  49. func : Function,
  50. istailcall : Bool,
  51. isvararg : Bool,
  52. lastlinedefined : Int,
  53. linedefined : Int,
  54. name : String,
  55. namewhat : String,
  56. nparams : Int,
  57. nups : Int,
  58. short_src : String,
  59. source : String,
  60. what : String
  61. }