打印本文 打印本文 关闭窗口 关闭窗口
lua头文件的pas翻译_lua.h
作者:武汉SEO闵涛  文章来源:敏韬网  点击数2022  更新时间:2009/4/23 18:27:20  文章录入:mintao  责任编辑:mintao
eferences }
const
  LUA_NOREF = -2;
  LUA_REFNIL = -1;
  {
  #DEF ine lua_ref(L, lock)((lock)? luaL_ref(L, LUA_REGISTRYINDEX): \
    (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))

  #DEF ine lua_unref(L, ref)luaL_unref(L, LUA_REGISTRYINDEX, (ref))

  #DEF ine lua_getref(L, ref)lua_rawgeti(L, LUA_REGISTRYINDEX, ref)
  }
  {
  ** {======================================================================
  ** useful definitions for Lua kernel and libraries
  ** =======================================================================
  }

  { formats for Lua numbers }
const
  LUA_NUMBER_SCAN = ''''%lf'''';
  LUA_NUMBER_FMT = ''''%.14 g'''';

  { = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
  = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = }

  {
  ** {======================================================================
  ** Debug API
  ** =======================================================================
  }

  {
  ** Event codes
  }
  LUA_HOOKCALL = 0;
  LUA_HOOKRET = 1;
  LUA_HOOKLINE = 2;
  LUA_HOOKCOUNT = 3;
  LUA_HOOKTAILRET = 4;

  {
  ** Event masks
  }

  LUA_MASKCALL = (1 shl LUA_HOOKCALL);
  LUA_MASKRET = (1 shl LUA_HOOKRET);
  LUA_MASKLINE = (1 shl LUA_HOOKLINE);
  LUA_MASKCOUNT = (1 shl LUA_HOOKCOUNT);

  LUA_IDSIZE = 60;
type

  lua_Debug = record
    event: int;
    name: pchar; // (n)
    namewhat: pchar; // (n) `global'''', `local'''', `field'''', `method''''
    what: pchar; /// (S) `Lua'''', `C'''', `main'''', `tail''''
    source: pchar; // (S)
    currentline: int; // (l)
    nups: int; // (u) number of upvalues
    linedefined: int; // (S)
    short_src: array[0..LUA_IDSIZE] of char; // (S)
    // private part
    i_ci: int; // active function
  end;

  lua_Hook = procedure(L: lua_state; ar: lua_debug);

function lua_getstack(L: lua_State; level: int;
  ar: lua_Debug): int; stdcall; external Luadll;
function lua_getinfo(L: lua_State; what: pchar;
  ar: lua_Debug): int; stdcall; external Luadll;
function lua_getlocal(L: lua_State; ar: lua_Debug;
  n: int): pchar; stdcall; external Luadll;
function lua_setlocal(L: lua_State; ar: lua_Debug;
  n: int): pchar; stdcall; external Luadll;
function lua_getupvalue(L: lua_State; funcindex: int;
  n: int): pchar; stdcall; external Luadll;
function lua_setupvalue(L: lua_State; funcindex: int;
  n: int): pchar; stdcall; external Luadll;

function lua_sethook(L: lua_State; func: lua_Hook; mask: int;
  count: int): int; stdcall; external Luadll;
function lua_gethook(L: lua_State): lua_Hook; stdcall; external Luadll;
function lua_gethookmask(L: lua_State): int; stdcall; external Luadll;
function lua_gethookcount(L: lua_State): int; stdcall; external Luadll;

var
  luaState: lua_state;
  luaDebug: lua_Debug; { activation record }

implementation

procedure lua_getregistry(L: lua_state);
begin
  lua_pushvalue(L, LUA_REGISTRYINDEX);
end;

procedure lua_setglobal(L: lua_state; s: pchar);
begin
  lua_pushstring(L, s);
  lua_insert(L, -2);
  lua_settable(L, LUA_GLOBALSINDEX);
end;

procedure lua_getglobal(L: lua_state; s: pchar);
begin
  lua_pushstring(L, s);
  lua_gettable(L, LUA_GLOBALSINDEX);
end;

end.

{ ====================================================================== }

{*****************************************************************************
* Copyright (C) 1994-2004 Tecgraf, PUC-Rio.  All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*****************************************************************************}

上一页  [1] [2] 

打印本文 打印本文 关闭窗口 关闭窗口