下面请跟着图老师小编一起来了解下lua头文件的pas翻译_lua.h,精心挑选的内容希望大家喜欢,不要忘记点个赞哦!
【 tulaoshi.com - 编程语言 】
{ unit Lua;
interface
const
LuaDLL = 'LuaLibDll.dll';
type
lua_state = pointer;
int = integer;
size_t = int;
va_list = int;
const
sLUA_VERSION = 'Lua 5.0.2';
sLUA_COPYRIGHT = 'Copyright (C) 1994-2004 Tecgraf, PUC-Rio';
sLUA_AUTHORS = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes';
{ option for multiple returns in `lua_pcall' and `lua_call' }
LUA_MULTRET = -1;
{
** pseudo-indices
}
LUA_REGISTRYINDEX = -10000;
LUA_GLOBALSINDEX = -10001;
// #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
{ error codes for `lua_load' and `lua_pcall' }
LUA_ERRRUN = 1;
LUA_ERRFILE = 2;
LUA_ERRSYNTAX = 3;
LUA_ERRMEM = 4;
LUA_ERRERR = 5;
// typedef struct lua_State lua_State;
type
lua_CFunction = function(L: lua_state): int;
{
** functions that read/write blocks when loading/dumping Lua chunks
}
lua_Chunkreader = function(L: lua_State; ud: pointer; sz: size_t): pchar;
lua_Chunkwriter = function(L: lua_State; p: pointer; sz: size_t; ud: pointer):
int;
{
** basic types
}
const
LUA_TNONE = -1;
LUA_TNIL = 0;
LUA_TBOOLEAN = 1;
LUA_TLIGHTUSERDATA = 2;
LUA_TNUMBER = 3;
LUA_TSTRING = 4;
LUA_TTABLE = 5;
LUA_TFUNCTION = 6;
LUA_TUSERDATA = 7;
LUA_TTHREAD = 8;
{ minimum Lua stack available to a C function }
LUA_MINSTACK = 20;
{
** generic extra include file
}
{ type of numbers in Lua }
type
lua_Number = double;
{
** state manipulation
}
function lua_open: lua_State; stdcall; external Luadll;
procedure lua_close(L: lua_State); stdcall; external Luadll;
function lua_newthread(L: lua_State): lua_State; stdcall; external Luadll;
function lua_atpanic(L: lua_State; panicf: lua_CFunction): lua_CFunction;
stdcall; external Luadll;
{
** basic stack manipulation
}
function lua_gettop(L: lua_State): int; stdcall; external Luadll;
procedure lua_settop(L: lua_State; idx: int); stdcall; external Luadll;
procedure lua_pushvalue(L: lua_State; idx: int); stdcall; external Luadll;
procedure lua_remove(L: lua_State; idx: int); stdcall; external Luadll;
procedure lua_insert(L: lua_State; idx: int); stdcall; external Luadll;
procedure lua_replace(L: lua_State; idx: int); stdcall; external Luadll;
function lua_checkstack(L: lua_State; sz: int): int; stdcall; external Luadll;
procedure lua_xmove(fromls: lua_State; tols: lua_State; n: int); stdcall;
external
Luadll;
{
** access functions (stack - C)
}
function lua_isnumber(L: lua_State; idx: int): int; stdcall; external Luadll;
function lua_isstring(L: lua_State; idx: int): int; stdcall; external Luadll;
function lua_iscfunction(L: lua_State; idx: int): int; stdcall; external Luadll;
function lua_isuserdata(L: lua_State; idx: int): int; stdcall; external Luadll;
function lua_type(L: lua_State; idx: int): int; stdcall; external Luadll;
function lua_typename(L: lua_State; tp: int): pchar; stdcall; external Luadll;
function lua_equal(L: lua_State; idx1: int; idx2: int): int; stdcall; external
Luadll;
function lua_rawequal(L: lua_State; idx1: int; idx2: int): int; stdcall; external
Luadll;
function lua_lessthan(L: lua_State; idx1: int; idx2: int): int; stdcall; external
Luadll;
function lua_tonumber(L: lua_State; idx: int): lua_Number; stdcall; external
Luadll;
function lua_toboolean(L: lua_State; idx: int): int; stdcall; external Luadll;
function lua_tostring(L: lua_State; idx: int): pchar; stdcall; external Luadll;
function lua_strlen(L: lua_State; idx: int): size_t; stdcall; external Luadll;
function lua_tocfunction(L: lua_State; idx: int): lua_CFunction; stdcall;
external Luadll;
procedure lua_touserdata(L: lua_State; idx: int); stdcall; external Luadll;
function lua_tothread(L: lua_State; idx: int): lua_State; stdcall; external
Luadll;
procedure lua_topointer(L: lua_State; idx: int); stdcall; external Luadll;
{
** push functions (C - stack)
}
procedure lua_pushnil(L: lua_State); stdcall; external Luadll;
procedure lua_pushnumber(L: lua_State; n: lua_Number); stdcall; external Luadll;
procedure lua_pushlstring(L: lua_State; s: pchar; st: size_t); stdcall; external
Luadll;
procedure lua_pushstring(L: lua_State; s: pchar); stdcall; external Luadll;
function lua_pushvfstring(L: lua_State; fmt: pchar; argp: va_list): pchar;
stdcall; external Luadll;
function lua_pushfstring(L: lua_State; fmt: pchar): pchar; stdcall; external
Luadll;
procedure lua_pushcclosure(L: lua_State; fn: lua_CFunction; n: int); stdcall;
external Luadll;
procedure lua_pushboolean(L: lua_State; b: int); stdcall; external Luadll;
procedure lua_pushlightuserdata(L: lua_State; p: pointer); stdcall; external
Luadll;
{
** get functions (Lua - stack)
}
procedure lua_gettable(L: lua_State; idx: int); stdcall; external Luadll;
procedure lua_rawget(L: lua_State; idx: int); stdcall; external Luadll;
procedure lua_rawgeti(L: lua_State; idx: int; n: int); stdcall; external Luadll;
procedure lua_newtable(L: lua_State); stdcall; external Luadll;
procedure lua_newuserdata(L: lua_State; sz: size_t); stdcall; external Luadll;
function lua_getmetatable(L: lua_State; objindex: int): int; stdcall; external
Luadll;
procedure lua_getfenv(L: lua_State; idx: int); stdcall; external Luadll;
{
** set functions (stack - Lua)
}
procedure lua_settable(L: lua_State; idx: int); stdcall; external Luadll;
procedure lua_rawset(L: lua_State; idx: int); stdcall; external Luadll;
procedure lua_rawseti(L: lua_State; idx: int; n: int); stdcall; external Luadll;
function lua_setmetatable(L: lua_State;
objindex: int): int; stdcall; external Luadll;
function lua_setfenv(L: lua_State; idx: int): int; stdcall; external Luadll;
{
** `load' and `call' functions (load and run Lua code)
}
procedure lua_call(L: lua_State; nargs: int;
nresults: int); stdcall; external Luadll;
function lua_pcall(L: lua_State; nargs: int; nresults: int;
errfunc: int): int; stdcall; external Luadll;
function lua_cpcall(L: lua_State; func: lua_CFunction;
ud: pointer): int; stdcall; external Luadll;
function lua_load(L: lua_State; reader: lua_Chunkreader; dt: pointer;
chunkname: pchar): int; stdcall; external Luadll;
function lua_dump(L: lua_State; writer: lua_Chunkwriter;
data: pointer): int; stdcall; external Luadll;
{
** coroutine functions
}
function lua_yield(L: lua_State; nresults: int): int; stdcall; external Luadll;
function lua_resume(L: lua_State; narg: int): int; stdcall; external Luadll;
{
** garbage-collection functions
}
function lua_getgcthreshold(L: lua_State): int; stdcall; external Luadll;
function lua_getgccount(L: lua_State): int; stdcall; external Luadll;
procedure lua_setgcthreshold(L: lua_State; newthreshold: int); stdcall; external
Luadll;
{
** miscellaneous functions
}
function lua_version: pchar; stdcall; external Luadll;
function lua_error(L: lua_State): int; stdcall; external Luadll;
function lua_next(L: lua_State; idx: int): int; stdcall; external Luadll;
procedure lua_concat(L: lua_State; n: int); stdcall; external Luadll;
{
** ===============================================================
** some useful macros
** ===============================================================
}
{
#DEFfine lua_boxpointer(L, u)
(*(void **)(lua_newuserdata(L, sizeof(void * ))) = (u))
#DEFfine lua_unboxpointer(L, i) (*(void **)(lua_touserdata(L, i)))
#DEFfine lua_pop(L, n)lua_settop(L, -(n) - 1)
#DEFfine lua_register(L, n, f)
(lua_pushstring(L, n),
lua_pushcfunction(L, f),
lua_settable(L, LUA_GLOBALSINDEX))
#DEFine lua_pushcfunction(L, f)lua_pushcclosure(L, f, 0)
#DEFine lua_isfunction(L, n)(lua_type(L, n) = = LUA_TFUNCTION)
#DEFine lua_istable(L, n)(lua_type(L, n) = = LUA_TTABLE)
#DEFine lua_islightuserdata(L, n)(lua_type(L, n) = = LUA_TLIGHTUSERDATA)
#DEFine lua_isnil(L, n)(lua_type(L, n) = = LUA_TNIL)
#DEFine lua_isboolean(L, n)(lua_type(L, n) = = LUA_TBOOLEAN)
#DEFine lua_isnone(L, n)(lua_type(L, n) = = LUA_TNONE)
#DEFine lua_isnoneornil(L, n)(lua_type(L, n) = 0)
#DEFine lua_pushliteral(L, s)
lua_pushlstring(L, "" s, (sizeof(s) / sizeof(char)) - 1)
}
{
** compatibility macros and functions
}
function lua_pushupvalues(L: lua_State): int; stdcall; external Luadll;
{
** MACRO Functions
}
procedure lua_getregistry(L: lua_state);
procedure lua_setglobal(L: lua_state; s: pchar);
procedure lua_getglobal(L: lua_state; s: pchar);
{ compatibility with ref system }
{ pre-defined references }
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.
*****************************************************************************}
来源:http://www.tulaoshi.com/n/20160219/1619236.html
看过《lua头文件的pas翻译_lua.h》的人还看了以下文章 更多>>