hedgewars/LuaPas.pas
author sheepluva
Mon, 28 Apr 2014 16:52:00 +0200
changeset 10230 361d36ec5181
parent 10127 7f29a65aa1e4
child 10238 7e20804db6a2
permissions -rw-r--r--
minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3407
dcc129c4352e Engine:
smxx
parents: 3043
diff changeset
     1
{$HINTS OFF}
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
     2
{$INCLUDE "options.inc"}
3407
dcc129c4352e Engine:
smxx
parents: 3043
diff changeset
     3
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
     4
unit LuaPas;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
     5
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
     6
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
     7
 * A complete Pascal wrapper for Lua 5.1 DLL module.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
     8
 *
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
     9
 * Created by Geo Massar, 2006
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    10
 * Distributed as free/open source.
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
    11
 *
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
    12
 * Note: This file contains custom modification for Hedgewars
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
    13
 * These changes should accomplish compatibility for both lua 5.1 and 5.2
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
    14
 * Differences: In 5.1 set/getglobal ARE macros and tonumber/tointeger are NOT
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    15
 *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    16
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    17
interface
7043
7c080e5ac8d0 Some work to make more units compile after conversion to c
unc0rr
parents: 6817
diff changeset
    18
uses uConsts;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    19
{.$DEFINE LUA_GETHOOK}
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    20
9208
acb2492288e5 heavily rework lua discovery and linking, needs testing but it's more similar to what we do for other libraries now
koda
parents: 9205
diff changeset
    21
const LuaLibName = {$IFDEF LUA_INTERNAL}'libhwlua'{$ELSE}'liblua'{$ENDIF};
acb2492288e5 heavily rework lua discovery and linking, needs testing but it's more similar to what we do for other libraries now
koda
parents: 9205
diff changeset
    22
acb2492288e5 heavily rework lua discovery and linking, needs testing but it's more similar to what we do for other libraries now
koda
parents: 9205
diff changeset
    23
{$IFNDEF WIN32}
acb2492288e5 heavily rework lua discovery and linking, needs testing but it's more similar to what we do for other libraries now
koda
parents: 9205
diff changeset
    24
    {$linklib lua}
acb2492288e5 heavily rework lua discovery and linking, needs testing but it's more similar to what we do for other libraries now
koda
parents: 9205
diff changeset
    25
{$ENDIF}
9205
abce6011f86c aaaaand let's not forget about lua, which has also a slightly revised build process
koda
parents: 8838
diff changeset
    26
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    27
type
8847
ff7fbab7cd56 update branch again
koda
parents: 8026 8838
diff changeset
    28
{$IFNDEF PAS2C}
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    29
    size_t   = Cardinal;
7073
26f960656cc9 help pas2c
unc0rr
parents: 7043
diff changeset
    30
{$ENDIF}
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    31
    Psize_t  = ^size_t;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    32
    PPointer = ^Pointer;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    33
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    34
    lua_State = record end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    35
    Plua_State = ^lua_State;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    36
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    37
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    38
(*                               luaconfig.h                                 *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    39
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    40
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    41
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    42
** $Id: luaconf.h,v 1.81 2006/02/10 17:44:06 roberto Exp $
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    43
** Configuration file for Lua
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    44
** See Copyright Notice in lua.h
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    45
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    46
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    47
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    48
** {==================================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    49
@@ LUA_NUMBER is the type of numbers in Lua.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    50
** CHANGE the following definitions only if you want to build Lua
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    51
** with a number type different from double. You may also need to
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    52
** change lua_number2int & lua_number2integer.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    53
** ===================================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    54
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    55
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    56
    LUA_NUMBER_  = Double;            // ending underscore is needed in Pascal
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    57
    LUA_INTEGER_ = PtrInt;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    58
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    59
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    60
@@ LUA_IDSIZE gives the maximum size for the description of the source
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    61
@* of a function in debug information.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    62
** CHANGE it if you want a different size.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    63
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    64
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    65
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    66
    LUA_IDSIZE = 60;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    67
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    68
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    69
@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    70
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    71
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    72
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    73
    LUAL_BUFFERSIZE = 1024;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    74
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    75
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    76
@@ LUA_PROMPT is the default prompt used by stand-alone Lua.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    77
@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    78
** CHANGE them if you want different prompts. (You can also change the
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    79
** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    80
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    81
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    82
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    83
    LUA_PROMPT  = '> ';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    84
    LUA_PROMPT2 = '>> ';
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    85
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    86
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    87
@@ lua_readline defines how to show a prompt and then read a line from
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    88
@* the standard input.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    89
@@ lua_saveline defines how to "save" a read line in a "history".
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    90
@@ lua_freeline defines how to free a line read by lua_readline.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    91
** CHANGE them if you want to improve this functionality (e.g., by using
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    92
** GNU readline and history facilities).
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    93
*)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
    94
{function  lua_readline(L : Plua_State;
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
    95
var b : PChar; p : PChar): Boolean;}
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    96
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    97
procedure lua_saveline(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    98
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    99
procedure lua_freeline(L : Plua_State; b : PChar);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   100
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   101
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   102
@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   103
@* is, whether we're running lua interactively).
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   104
** CHANGE it if you have a better definition for non-POSIX/non-Windows
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   105
** systems.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   106
*/
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   107
#include <io.h>
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   108
#include <stdio.h>
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   109
#define lua_stdin_is_tty()  _isatty(_fileno(stdin))
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   110
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   111
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   112
    lua_stdin_is_tty = TRUE;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   113
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   114
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   115
(*                                  lua.h                                    *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   116
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   117
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   118
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   119
** $Id: lua.h,v 1.216 2006/01/10 12:50:13 roberto Exp $
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   120
** Lua - An Extensible Extension Language
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   121
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   122
** See Copyright Notice at the end of this file
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   123
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   124
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   125
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   126
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   127
    LUA_VERSION     = 'Lua 5.1';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   128
    LUA_VERSION_NUM = 501;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   129
    LUA_COPYRIGHT   = 'Copyright (C) 1994-2006 Tecgraf, PUC-Rio';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   130
    LUA_AUTHORS     = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes';
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   131
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   132
    (* mark for precompiled code (`<esc>Lua') *)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   133
    //LUA_SIGNATURE = #27'Lua';
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   134
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   135
    (* option for multiple returns in `lua_pcall' and `lua_call' *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   136
    LUA_MULTRET = -1;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   137
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   138
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   139
    ** pseudo-indices
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   140
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   141
    LUA_REGISTRYINDEX = -10000;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   142
    LUA_ENVIRONINDEX  = -10001;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   143
    LUA_GLOBALSINDEX  = -10002;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   144
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   145
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   146
function lua_upvalueindex(idx : LongInt) : LongInt;   // a marco
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   147
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   148
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   149
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   150
   (* thread status; 0 is OK *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   151
    LUA_YIELD_    = 1;     // Note: the ending underscore is needed in Pascal
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   152
    LUA_ERRRUN    = 2;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   153
    LUA_ERRSYNTAX = 3;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   154
    LUA_ERRMEM    = 4;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   155
    LUA_ERRERR    = 5;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   156
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   157
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   158
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   159
   lua_CFunction = function(L : Plua_State) : LongInt; cdecl;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   160
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   161
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   162
    ** functions that read/write blocks when loading/dumping Lua chunks
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   163
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   164
    lua_Reader = function (L : Plua_State; ud : Pointer; sz : Psize_t) : PChar; cdecl;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   165
    lua_Writer = function (L : Plua_State; const p : Pointer; sz : size_t; ud : Pointer) : LongInt; cdecl;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   166
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   167
  (*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   168
  ** prototype for memory-allocation functions
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   169
  *)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   170
  lua_Alloc = function (ud, ptr : Pointer; osize, nsize : size_t) : Pointer; cdecl;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   171
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   172
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   173
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   174
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   175
    ** basic types
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   176
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   177
    LUA_TNONE          = -1;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   178
    LUA_TNIL           = 0;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   179
    LUA_TBOOLEAN       = 1;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   180
    LUA_TLIGHTUSERDATA = 2;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   181
    LUA_TNUMBER        = 3;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   182
    LUA_TSTRING        = 4;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   183
    LUA_TTABLE         = 5;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   184
    LUA_TFUNCTION      = 6;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   185
    LUA_TUSERDATA      = 7;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   186
    LUA_TTHREAD        = 8;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   187
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   188
    (* minimum Lua stack available to a C function *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   189
    LUA_MINSTACK = 20;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   190
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   191
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   192
    (* type of numbers in Lua *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   193
    lua_Number = LUA_NUMBER_;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   194
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   195
    (* type for integer functions *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   196
    lua_Integer = LUA_INTEGER_;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   197
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   198
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   199
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   200
** state manipulation
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   201
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   202
function  lua_newstate(f : lua_Alloc; ud : Pointer) : Plua_State;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   203
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   204
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   205
procedure lua_close(L: Plua_State);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   206
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   207
function  lua_newthread(L : Plua_State) : Plua_State;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   208
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   209
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   210
function  lua_atpanic(L : Plua_State; panicf : lua_CFunction) : lua_CFunction;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   211
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   212
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   213
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   214
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   215
** basic stack manipulation
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   216
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   217
function  lua_gettop(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   218
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   219
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   220
procedure lua_settop(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   221
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   222
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   223
procedure lua_pushvalue(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   224
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   225
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   226
procedure lua_remove(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   227
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   228
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   229
procedure lua_insert(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   230
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   231
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   232
procedure lua_replace(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   233
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   234
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   235
function  lua_checkstack(L : Plua_State; sz : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   236
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   237
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   238
procedure lua_xmove(src, dest : Plua_State; n : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   239
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   240
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   241
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   242
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   243
** access functions (stack -> C)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   244
*)
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   245
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   246
{$IFNDEF LUA51}
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   247
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   248
function lua_tointegerx(L : Plua_State; idx : LongInt; success : PInteger) : lua_Integer;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   249
    cdecl; external LuaLibName;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   250
function lua_tointeger(L : Plua_State; idx : LongInt) : lua_Integer;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   251
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   252
function lua_tonumberx(L : Plua_State; idx : LongInt; success : PInteger) : lua_Number;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   253
    cdecl; external LuaLibName;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   254
function lua_tonumber(L : Plua_State; idx : LongInt) : lua_Number;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   255
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   256
{$ELSE}
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   257
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   258
function lua_tointeger(L : Plua_State; idx : LongInt) : lua_Integer;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   259
    cdecl; external LuaLibName;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   260
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   261
function lua_tonumber(L : Plua_State; idx : LongInt) : lua_Number;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   262
    cdecl; external LuaLibName;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   263
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   264
{$ENDIF}
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   265
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   266
function lua_isnumber(L : Plua_State; idx : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   267
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   268
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   269
function lua_isstring(L : Plua_State; idx : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   270
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   271
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   272
function lua_iscfunction(L : Plua_State; idx : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   273
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   274
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   275
function lua_isuserdata(L : Plua_State; idx : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   276
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   277
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   278
function lua_type(L : Plua_State; idx : LongInt) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   279
    cdecl; external LuaLibName;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   280
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   281
function lua_typename(L : Plua_State; tp : LongInt) : PChar;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   282
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   283
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   284
function lua_equal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   285
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   286
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   287
function lua_rawequal(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   288
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   289
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   290
function lua_lessthan(L : Plua_State; idx1, idx2 : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   291
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   292
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   293
function lua_toboolean(L : Plua_State; idx : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   294
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   295
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   296
function lua_tolstring(L : Plua_State; idx : LongInt; len : Psize_t) : PChar;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   297
    cdecl; external LuaLibName;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   298
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   299
function lua_objlen(L : Plua_State; idx : LongInt) : size_t;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   300
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   301
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   302
function lua_tocfunction(L : Plua_State; idx : LongInt) : lua_CFunction;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   303
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   304
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   305
function lua_touserdata(L : Plua_State; idx : LongInt) : Pointer;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   306
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   307
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   308
function lua_tothread(L : Plua_State; idx : LongInt) : Plua_State;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   309
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   310
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   311
function lua_topointer(L : Plua_State; idx : LongInt) : Pointer;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   312
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   313
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   314
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   315
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   316
** push functions (C -> stack)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   317
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   318
procedure lua_pushnil(L : Plua_State);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   319
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   320
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   321
procedure lua_pushnumber(L : Plua_State; n : lua_Number);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   322
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   323
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   324
procedure lua_pushinteger(L : Plua_State; n : lua_Integer);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   325
    cdecl; external LuaLibName;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   326
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   327
procedure lua_pushlstring(L : Plua_State; const s : PChar; ls : size_t);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   328
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   329
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   330
procedure lua_pushstring(L : Plua_State; const s : PChar);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   331
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   332
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   333
function  lua_pushvfstring(L : Plua_State;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   334
    const fmt : PChar; argp : Pointer) : PChar;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   335
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   336
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   337
function  lua_pushfstring(L : Plua_State; const fmt : PChar) : PChar; varargs;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   338
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   339
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   340
procedure lua_pushcclosure(L : Plua_State; fn : lua_CFunction; n : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   341
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   342
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   343
procedure lua_pushboolean(L : Plua_State; b : LongBool);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   344
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   345
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   346
procedure lua_pushlightuserdata(L : Plua_State; p : Pointer);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   347
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   348
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   349
function  lua_pushthread(L : Plua_state) : Cardinal;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   350
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   351
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   352
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   353
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   354
** get functions (Lua -> stack)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   355
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   356
procedure lua_gettable(L : Plua_State ; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   357
    cdecl; external LuaLibName;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   358
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   359
procedure lua_getfield(L : Plua_State; idx : LongInt; k : PChar);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   360
    cdecl; external LuaLibName;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   361
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   362
procedure lua_rawget(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   363
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   364
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   365
procedure lua_rawgeti(L : Plua_State; idx, n : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   366
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   367
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   368
procedure lua_createtable(L : Plua_State; narr, nrec : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   369
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   370
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   371
function  lua_newuserdata(L : Plua_State; sz : size_t) : Pointer;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   372
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   373
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   374
function  lua_getmetatable(L : Plua_State; objindex : LongInt) : LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   375
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   376
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   377
procedure lua_getfenv(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   378
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   379
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   380
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   381
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   382
** set functions (stack -> Lua)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   383
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   384
procedure lua_settable(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   385
    cdecl; external LuaLibName;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   386
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   387
procedure lua_setfield(L : Plua_State; idx : LongInt; const k : PChar);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   388
    cdecl; external LuaLibName;
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   389
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   390
procedure lua_rawset(L : Plua_State; idx : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   391
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   392
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   393
procedure lua_rawseti(L : Plua_State; idx , n: LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   394
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   395
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   396
function lua_setmetatable(L : Plua_State; objindex : LongInt): LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   397
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   398
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   399
function lua_setfenv(L : Plua_State; idx : LongInt): LongBool;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   400
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   401
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   402
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   403
** `load' and `call' functions (load and run Lua code)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   404
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   405
procedure lua_call(L : Plua_State; nargs, nresults : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   406
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   407
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   408
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   409
{$IFNDEF LUA51}
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   410
function  lua_pcallk(L: Plua_State; nargs, nresults, errfunc, ctx: Integer; k: lua_CFunction): Integer;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   411
    cdecl; external LuaLibName;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   412
function  lua_pcall(L : Plua_State; nargs, nresults, errfunc : LongInt) : LongInt;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   413
{$ELSE}
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   414
function  lua_pcall(L : Plua_State; nargs, nresults, errfunc : LongInt) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   415
    cdecl; external LuaLibName;
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   416
{$ENDIF}
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   417
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   418
function  lua_cpcall(L : Plua_State; func : lua_CFunction; ud : Pointer) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   419
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   420
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   421
function  lua_load(L : Plua_State; reader : lua_Reader; dt : Pointer; const chunkname : PChar) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   422
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   423
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   424
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   425
function lua_dump(L : Plua_State; writer : lua_Writer; data: Pointer) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   426
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   427
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   428
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   429
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   430
** coroutine functions
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   431
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   432
function lua_yield(L : Plua_State; nresults : LongInt) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   433
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   434
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   435
function lua_resume(L : Plua_State; narg : LongInt) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   436
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   437
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   438
function lua_status(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   439
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   440
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   441
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   442
** garbage-collection functions and options
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   443
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   444
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   445
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   446
    LUA_GCSTOP       = 0;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   447
    LUA_GCRESTART    = 1;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   448
    LUA_GCCOLLECT    = 2;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   449
    LUA_GCCOUNT      = 3;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   450
    LUA_GCCOUNTB     = 4;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   451
    LUA_GCSTEP       = 5;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   452
    LUA_GCSETPAUSE   = 6;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   453
    LUA_GCSETSTEPMUL = 7;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   454
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   455
function lua_gc(L : Plua_State; what, data : LongInt) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   456
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   457
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   458
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   459
** miscellaneous functions
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   460
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   461
function lua_error(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   462
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   463
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   464
function lua_next(L : Plua_State; idx : LongInt) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   465
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   466
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   467
procedure lua_concat(L : Plua_State; n : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   468
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   469
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   470
function  lua_getallocf(L : Plua_State; ud : PPointer) : lua_Alloc;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   471
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   472
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   473
procedure lua_setallocf(L : Plua_State; f : lua_Alloc; ud : Pointer);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   474
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   475
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   476
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   477
** ===============================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   478
** some useful macros
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   479
** ===============================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   480
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   481
procedure lua_pop(L : Plua_State; n : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   482
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   483
procedure lua_newtable(L : Plua_State);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   484
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   485
procedure lua_register(L : Plua_State; n : PChar; f : lua_CFunction);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   486
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   487
procedure lua_pushcfunction(L : Plua_State; f : lua_CFunction);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   488
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   489
function lua_isfunction(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   490
function lua_istable(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   491
function lua_islightuserdata(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   492
function lua_isnil(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   493
function lua_isboolean(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   494
function lua_isthread(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   495
function lua_isnone(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   496
function lua_isnoneornil(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   497
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   498
procedure lua_pushliteral(L : Plua_State; s : PChar);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   499
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   500
procedure lua_setglobal(L : Plua_State; s : PChar);
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   501
{$IFNDEF LUA51}
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   502
    cdecl;  external LuaLibName;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   503
{$ENDIF}
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   504
procedure lua_getglobal(L : Plua_State; s : PChar);
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   505
{$IFNDEF LUA51}
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   506
    cdecl;  external LuaLibName;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   507
{$ENDIF}
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   508
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   509
function lua_tostring(L : Plua_State; idx : LongInt) : shortstring;
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   510
function lua_tostringA(L : Plua_State; idx : LongInt) : ansistring;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   511
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   512
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   513
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   514
** compatibility macros and functions
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   515
*)
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   516
(*
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   517
function lua_open : Plua_State;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   518
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   519
procedure lua_getregistry(L : Plua_State);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   520
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   521
function lua_getgccount(L : Plua_State) : LongInt;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   522
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   523
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   524
    lua_Chuckreader = lua_Reader;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   525
    lua_Chuckwriter = lua_Writer;
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   526
*)
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   527
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   528
(* ====================================================================== *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   529
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   530
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   531
** {======================================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   532
** Debug API
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   533
** =======================================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   534
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   535
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   536
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   537
** Event codes
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   538
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   539
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   540
    LUA_HOOKCALL    = 0;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   541
    LUA_HOOKRET     = 1;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   542
    LUA_HOOKLINE    = 2;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   543
    LUA_HOOKCOUNT   = 3;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   544
    LUA_HOOKTAILRET = 4;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   545
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   546
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   547
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   548
** Event masks
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   549
*)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   550
    LUA_MASKCALL  = 1 shl LUA_HOOKCALL;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   551
    LUA_MASKRET   = 1 shl LUA_HOOKRET;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   552
    LUA_MASKLINE  = 1 shl LUA_HOOKLINE;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   553
    LUA_MASKCOUNT = 1 shl LUA_HOOKCOUNT;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   554
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   555
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   556
    lua_Debug = packed record
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   557
    event : LongInt;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   558
    name : PChar;          (* (n) *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   559
    namewhat : PChar;      (* (n) `global', `local', `field', `method' *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   560
    what : PChar;          (* (S) `Lua', `C', `main', `tail' *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   561
    source : PChar;        (* (S) *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   562
    currentline : LongInt; (* (l) *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   563
    nups : LongInt;        (* (u) number of upvalues *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   564
    linedefined : LongInt; (* (S) *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   565
    short_src : array [0..LUA_IDSIZE-1] of Char; (* (S) *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   566
    (* private part *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   567
    i_ci : LongInt;        (* active function *)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   568
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   569
    Plua_Debug = ^lua_Debug;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   570
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   571
  (* Functions to be called by the debuger in specific events *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   572
  lua_Hook = procedure (L : Plua_State; ar : Plua_Debug); cdecl;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   573
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   574
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   575
function lua_getstack(L : Plua_State; level : LongInt; ar : Plua_Debug) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   576
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   577
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   578
function lua_getinfo(L : Plua_State; const what : PChar; ar: Plua_Debug): LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   579
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   580
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   581
function lua_getlocal(L : Plua_State; ar : Plua_Debug; n : LongInt) : PChar;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   582
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   583
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   584
function lua_setlocal(L : Plua_State; ar : Plua_Debug; n : LongInt) : PChar;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   585
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   586
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   587
function lua_getupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   588
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   589
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   590
function lua_setupvalue(L : Plua_State; funcindex, n : LongInt) : PChar;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   591
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   592
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   593
function lua_sethook(L : Plua_State; func : lua_Hook; mask, count: LongInt): LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   594
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   595
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   596
{$IFDEF LUA_GETHOOK}
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   597
function lua_gethook(L : Plua_State) : lua_Hook;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   598
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   599
{$ENDIF}
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   600
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   601
function lua_gethookmask(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   602
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   603
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   604
function lua_gethookcount(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   605
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   606
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   607
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   608
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   609
(*                                  lualib.h                                 *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   610
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   611
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   612
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   613
** $Id: lualib.h,v 1.36 2005/12/27 17:12:00 roberto Exp $
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   614
** Lua standard libraries
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   615
** See Copyright Notice at the end of this file
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   616
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   617
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   618
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   619
    (* Key to file-handle type *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   620
    LUA_FILEHANDLE  = 'FILE*';
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   621
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   622
    LUA_COLIBNAME   = 'coroutine';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   623
    LUA_TABLIBNAME  = 'table';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   624
    LUA_IOLIBNAME   = 'io';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   625
    LUA_OSLIBNAME   = 'os';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   626
    LUA_STRLIBNAME  = 'string';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   627
    LUA_MATHLIBNAME = 'math';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   628
    LUA_DBLIBNAME   = 'debug';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   629
    LUA_LOADLIBNAME = 'package';
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   630
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   631
function luaopen_base(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   632
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   633
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   634
function luaopen_table(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   635
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   636
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   637
function luaopen_io(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   638
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   639
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   640
function luaopen_os(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   641
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   642
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   643
function luaopen_string(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   644
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   645
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   646
function luaopen_math(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   647
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   648
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   649
function luaopen_debug(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   650
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   651
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   652
function luaopen_package(L : Plua_State) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   653
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   654
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   655
procedure luaL_openlibs(L : Plua_State);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   656
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   657
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   658
procedure lua_assert(x : Boolean);    // a macro
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   659
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   660
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   661
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   662
(*                                  lauxlib.h                                *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   663
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   664
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   665
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   666
** $Id: lauxlib.h,v 1.87 2005/12/29 15:32:11 roberto Exp $
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   667
** Auxiliary functions for building Lua libraries
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   668
** See Copyright Notice at the end of this file.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   669
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   670
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   671
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   672
    LUA_ERRFILE = LUA_ERRERR + 1;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   673
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   674
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   675
    luaL_Reg = packed record
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   676
    name : PChar;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   677
    func : lua_CFunction;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   678
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   679
    PluaL_Reg = ^luaL_Reg;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   680
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   681
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   682
(*procedure luaL_openlib(L : Plua_State; const libname : PChar; const lr : PluaL_Reg; nup : LongInt);
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   683
    cdecl; external LuaLibName;*)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   684
procedure luaL_register(L : Plua_State; const libname : PChar; const lr : PluaL_Reg);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   685
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   686
function luaL_getmetafield(L : Plua_State; obj : LongInt; const e : PChar) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   687
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   688
function luaL_callmeta(L : Plua_State; obj : LongInt; const e : PChar) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   689
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   690
function luaL_typerror(L : Plua_State; narg : LongInt; const tname : PChar) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   691
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   692
function luaL_argerror(L : Plua_State; numarg : LongInt; const extramsg : PChar) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   693
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   694
function luaL_checklstring(L : Plua_State; numArg : LongInt; ls : Psize_t) : PChar;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   695
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   696
function luaL_optlstring(L : Plua_State; numArg : LongInt; const def: PChar; ls: Psize_t) : PChar;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   697
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   698
function luaL_checknumber(L : Plua_State; numArg : LongInt) : lua_Number;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   699
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   700
function luaL_optnumber(L : Plua_State; nArg : LongInt; def : lua_Number) : lua_Number;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   701
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   702
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   703
function luaL_checkinteger(L : Plua_State; numArg : LongInt) : lua_Integer;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   704
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   705
function luaL_optinteger(L : Plua_State; nArg : LongInt; def : lua_Integer) : lua_Integer;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   706
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   707
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   708
procedure luaL_checkstack(L : Plua_State; sz : LongInt; const msg : PChar);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   709
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   710
procedure luaL_checktype(L : Plua_State; narg, t : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   711
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   712
procedure luaL_checkany(L : Plua_State; narg : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   713
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   714
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   715
function luaL_newmetatable(L : Plua_State; const tname : PChar) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   716
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   717
function luaL_checkudata(L : Plua_State; ud : LongInt; const tname : PChar) : Pointer;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   718
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   719
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   720
procedure luaL_where(L : Plua_State; lvl : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   721
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   722
function  luaL_error(L : Plua_State; const fmt : PChar) : LongInt; varargs;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   723
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   724
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   725
function luaL_checkoption(L : Plua_State; narg : LongInt; const def : PChar; const lst : array of PChar) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   726
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   727
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   728
function  luaL_ref(L : Plua_State; t : LongInt) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   729
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   730
procedure luaL_unref(L : Plua_State; t, ref : LongInt);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   731
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   732
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   733
function luaL_loadfile(L : Plua_State; const filename : PChar) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   734
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   735
function luaL_loadbuffer(L : Plua_State; const buff : PChar; sz : size_t; const name: PChar) : LongInt;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   736
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   737
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   738
function luaL_loadstring(L : Plua_State; const s : Pchar) : LongInt;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   739
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   740
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   741
function luaL_newstate : Plua_State;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   742
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   743
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   744
function luaL_gsub(L : Plua_State; const s, p, r : PChar) : PChar;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   745
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   746
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   747
function luaL_findtable(L : Plua_State; idx : LongInt; const fname : PChar; szhint : LongInt) : PChar;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   748
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   749
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   750
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   751
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   752
** ===============================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   753
** some useful macros
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   754
** ===============================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   755
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   756
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   757
function luaL_argcheck(L : Plua_State; cond : Boolean; numarg : LongInt; extramsg : PChar): LongInt;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   758
function luaL_checkstring(L : Plua_State; n : LongInt) : PChar;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   759
function luaL_optstring(L : Plua_State; n : LongInt; d : PChar) : PChar;
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   760
function luaL_checkint(L : Plua_State; n : LongInt) : lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   761
function luaL_optint(L : Plua_State; n : LongInt; d : lua_Integer): lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   762
function luaL_checklong(L : Plua_State; n : LongInt) : lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   763
function luaL_optlong(L : Plua_State; n : LongInt; d : lua_Integer) : lua_Integer;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   764
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   765
function luaL_typename(L : Plua_State; idx : LongInt) : PChar;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   766
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   767
procedure luaL_getmetatable(L : Plua_State; n : PChar);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   768
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   769
(* not implemented yet
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   770
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   771
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   772
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   773
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   774
** {======================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   775
** Generic Buffer manipulation
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   776
** =======================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   777
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   778
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   779
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   780
    luaL_Buffer = packed record
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   781
    p : PChar;       (* current position in buffer *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   782
    lvl : LongInt;   (* number of strings in the stack (level) *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   783
    L : Plua_State;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   784
    buffer : array [0..LUAL_BUFFERSIZE-1] of Char;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   785
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   786
    PluaL_Buffer = ^luaL_Buffer;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   787
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   788
(* compatibility only *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   789
procedure luaL_addsize(B : PluaL_Buffer; n : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   790
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   791
procedure luaL_buffinit(L : Plua_State; B : PluaL_Buffer);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   792
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   793
function  luaL_prepbuffer(B : PluaL_Buffer) : PChar;
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   794
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   795
procedure luaL_addlstring(B : PluaL_Buffer; const s : PChar; ls : size_t);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   796
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   797
procedure luaL_addstring(B : PluaL_Buffer; const s : PChar);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   798
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   799
procedure luaL_addvalue(B : PluaL_Buffer);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   800
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   801
procedure luaL_pushresult(B : PluaL_Buffer);
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   802
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   803
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   804
(* ====================================================== *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   805
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   806
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   807
(* compatibility with ref system *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   808
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   809
(* pre-defined references *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   810
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   811
    LUA_NOREF  = -2;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   812
    LUA_REFNIL = -1;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   813
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   814
function lua_ref(L : Plua_State; lock : Boolean) : LongInt;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   815
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   816
procedure lua_unref(L : Plua_State; ref : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   817
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   818
procedure lua_getref(L : Plua_State; ref : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   819
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   820
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   821
(******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   822
(******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   823
(******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   824
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   825
implementation
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   826
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   827
uses
5551
0897b947e7a0 use ansistring instead
nemo
parents: 5549
diff changeset
   828
  SysUtils;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   829
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   830
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   831
(*                            luaconfig.h                                    *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   832
(*****************************************************************************)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   833
{
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   834
function  lua_readline(L : Plua_State;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   835
var
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   836
    b : PChar; p : PChar): Boolean;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   837
var
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   838
    s : AnsiString;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   839
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   840
    Write(p);                        // show prompt
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   841
    ReadLn(s);                       // get line
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   842
    b := PChar(s);                   //   and return it
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   843
    lua_readline := (b[0] <> #4);          // test for ctrl-D
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   844
end;
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   845
}
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   846
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   847
{$IFNDEF LUA51}
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   848
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   849
(* compatibility with 5.2 *)
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   850
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   851
function lua_tointeger(L : Plua_State; idx : LongInt) : lua_Integer;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   852
begin
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   853
    lua_tointeger := lua_tointegerx(L, idx, nil);
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   854
end;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   855
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   856
function lua_tonumber(L : Plua_State; idx : LongInt) : lua_Number;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   857
begin
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   858
    lua_tonumber := lua_tonumberx(L, idx, nil);
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   859
end;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   860
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   861
function lua_pcall(L : Plua_State; nargs, nresults, errfunc : LongInt) : LongInt;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   862
begin
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   863
    lua_pcall := lua_pcallk(L, nargs, nresults, errfunc, 0, nil);
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   864
end;
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   865
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   866
{$ENDIF}
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   867
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   868
procedure lua_saveline(L : Plua_State; idx : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   869
begin
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   870
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   871
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   872
procedure lua_freeline(L : Plua_State; b : PChar);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   873
begin
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   874
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   875
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   876
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   877
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   878
(*                                  lua.h                                    *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   879
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   880
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   881
function lua_upvalueindex(idx : LongInt) : LongInt;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   882
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   883
lua_upvalueindex := LUA_GLOBALSINDEX - idx;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   884
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   885
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   886
procedure lua_pop(L : Plua_State; n : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   887
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   888
lua_settop(L, -n - 1);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   889
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   890
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   891
procedure lua_newtable(L : Plua_State);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   892
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   893
lua_createtable(L, 0, 0);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   894
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   895
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   896
procedure lua_register(L : Plua_State; n : PChar; f : lua_CFunction);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   897
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   898
lua_pushcfunction(L, f);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   899
lua_setglobal(L, n);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   900
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   901
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   902
procedure lua_pushcfunction(L : Plua_State; f : lua_CFunction);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   903
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   904
    lua_pushcclosure(L, f, 0);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   905
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   906
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   907
function lua_isfunction(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   908
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   909
    lua_isfunction := lua_type(L, n) = LUA_TFUNCTION;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   910
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   911
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   912
function lua_istable(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   913
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   914
    lua_istable := lua_type(L, n) = LUA_TTABLE;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   915
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   916
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   917
function lua_islightuserdata(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   918
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   919
    lua_islightuserdata := lua_type(L, n) = LUA_TLIGHTUSERDATA;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   920
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   921
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   922
function lua_isnil(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   923
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   924
    lua_isnil := lua_type(L, n) = LUA_TNIL;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   925
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   926
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   927
function lua_isboolean(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   928
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   929
    lua_isboolean := lua_type(L, n) = LUA_TBOOLEAN;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   930
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   931
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   932
function lua_isthread(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   933
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   934
    lua_isthread := lua_type(L, n) = LUA_TTHREAD;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   935
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   936
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   937
function lua_isnone(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   938
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   939
    lua_isnone := lua_type(L, n) = LUA_TNONE;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   940
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   941
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   942
function lua_isnoneornil(L : Plua_State; n : LongInt) : Boolean;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   943
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   944
    lua_isnoneornil := lua_type(L, n) <= 0;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   945
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   946
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   947
procedure lua_pushliteral(L : Plua_State; s : PChar);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   948
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   949
    lua_pushlstring(L, s, StrLen(s));
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   950
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   951
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   952
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   953
{$IFDEF LUA51}
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   954
procedure lua_setglobal(L : Plua_State; s : PChar);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   955
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   956
    lua_setfield(L, LUA_GLOBALSINDEX, s);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   957
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   958
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   959
procedure lua_getglobal(L: Plua_State; s: PChar);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   960
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   961
    lua_getfield(L, LUA_GLOBALSINDEX, s);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   962
end;
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   963
{$ENDIF}
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   964
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   965
function lua_tostring(L : Plua_State; idx : LongInt) : shortstring;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   966
begin
6817
daaf0834c4d2 - Apply unit's namespace to current scope when referencing unit name
unc0rr
parents: 6580
diff changeset
   967
    lua_tostring := StrPas(lua_tolstring(L, idx, nil));
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   968
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   969
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   970
function lua_tostringA(L : Plua_State; idx : LongInt) : ansistring;
10127
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   971
var p: PChar;
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   972
begin
10127
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   973
    p:= lua_tolstring(L, idx, nil);
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   974
    lua_tostringA := ansistring(p);
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   975
end;
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   976
(*
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   977
function lua_open : Plua_State;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   978
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   979
    lua_open := luaL_newstate;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   980
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   981
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   982
procedure lua_getregistry(L : Plua_State);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   983
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   984
    lua_pushvalue(L, LUA_REGISTRYINDEX);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   985
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   986
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   987
function lua_getgccount(L : Plua_State) : LongInt;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   988
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   989
    lua_getgccount := lua_gc(L, LUA_GCCOUNT, 0);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   990
end;
10230
361d36ec5181 minimal changes for compatibility with lua 5.2, thanks to v4hn for fixing standard library loads. note: ALSO compatibile with (internal) lua 5.1, until something bothers to upgrade bundled lua version
sheepluva
parents: 10127
diff changeset
   991
*)
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   992
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   993
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   994
(*                                  lualib.h                                 *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   995
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   996
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   997
procedure lua_assert(x : Boolean);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   998
begin
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   999
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1000
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1001
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1002
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1003
(*                                  lauxlib.h    n                           *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1004
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1005
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1006
procedure luaL_setn(L : plua_State; i, j : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1007
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1008
    (* no op *)
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1009
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1010
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1011
function luaL_argcheck(L : Plua_State; cond : Boolean; numarg : LongInt; extramsg : PChar): LongInt;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1012
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1013
    if not cond then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1014
        luaL_argcheck := luaL_argerror(L, numarg, extramsg)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1015
    else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1016
        luaL_argcheck := 0;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1017
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1018
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1019
function luaL_checkstring(L : Plua_State; n : LongInt) : PChar;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1020
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1021
    luaL_checkstring := luaL_checklstring(L, n, nil);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1022
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1023
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1024
function luaL_optstring(L : Plua_State; n : LongInt; d : PChar) : PChar;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1025
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1026
    luaL_optstring := luaL_optlstring(L, n, d, nil);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1027
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1028
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
  1029
function luaL_checkint(L : Plua_State; n : LongInt) : lua_Integer;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1030
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1031
    luaL_checkint := luaL_checkinteger(L, n);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1032
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1033
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
  1034
function luaL_optint(L : Plua_State; n : LongInt; d : lua_Integer): lua_Integer;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1035
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1036
    luaL_optint := luaL_optinteger(L, n, d);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1037
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1038
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
  1039
function luaL_checklong(L : Plua_State; n : LongInt) : lua_Integer;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1040
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1041
    luaL_checklong := luaL_checkinteger(L, n);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1042
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1043
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
  1044
function luaL_optlong(L : Plua_State; n : LongInt; d : lua_Integer) : lua_Integer;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1045
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1046
    luaL_optlong := luaL_optinteger(L, n, d);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1047
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1048
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1049
function luaL_typename(L : Plua_State; idx : LongInt) : PChar;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1050
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1051
    luaL_typename := lua_typename( L, lua_type(L, idx) );
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1052
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1053
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1054
procedure luaL_getmetatable(L : Plua_State; n : PChar);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1055
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1056
    lua_getfield(L, LUA_REGISTRYINDEX, n);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1057
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1058
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1059
procedure luaL_addsize(B : PluaL_Buffer; n : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1060
begin
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1061
  Inc(B^.p, n);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1062
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1063
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1064
function lua_ref(L : Plua_State; lock : Boolean) : LongInt;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1065
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1066
    if lock then
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1067
        lua_ref := luaL_ref(L, LUA_REGISTRYINDEX)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1068
    else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1069
        begin
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
  1070
        lua_pushstring(L, _P'unlocked references are obsolete');
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1071
        lua_error(L);
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1072
        lua_ref := 0;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1073
        end;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1074
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1075
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1076
procedure lua_unref(L : Plua_State; ref : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1077
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1078
    luaL_unref(L, LUA_REGISTRYINDEX, ref);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1079
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1080
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1081
procedure lua_getref(L : Plua_State; ref : LongInt);
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1082
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1083
    lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1084
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1085
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1086
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1087
(******************************************************************************
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1088
* Original copyright for the lua source and headers:
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1089
*  1994-2004 Tecgraf, PUC-Rio.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1090
*  www.lua.org.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1091
*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1092
*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1093
* Permission is hereby granted, free of charge, to any person obtaining
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1094
* a copy of this software and associated documentation files (the
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1095
* "Software"), to deal in the Software without restriction, including
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1096
* without limitation the rights to use, copy, modify, merge, publish,
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1097
* distribute, sublicense, and/or sell copies of the Software, and to
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1098
* permit persons to whom the Software is furnished to do so, subject to
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1099
* the following conditions:
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1100
*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1101
* The above copyright notice and this permission notice shall be
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1102
* included in all copies or substantial portions of the Software.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1103
*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1104
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1105
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1106
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1107
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1108
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1109
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1110
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1111
******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1112
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1113
end.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1114
3407
dcc129c4352e Engine:
smxx
parents: 3043
diff changeset
  1115
{$HINTS ON}