hedgewars/LuaPas.pas
author Wuzzy <Wuzzy2@mail.ru>
Fri, 09 Mar 2018 19:05:59 +0100
changeset 13145 5083fb0a2992
parent 11823 0fba6cb098a1
child 13512 36f3f77e9b1b
permissions -rw-r--r--
A Classic Fairytale: Harden all missions against missing campaign variables in team file and assume default values This assumes the worst case in which the team file is missing all campaign variables except Progress. This has been successfully tested with all 10 missions and still generates a logical storyline. By default, the game assumes: - The cyborg's offer in mission 2 was refused - The traitor in mission 5 was killed As a consequence, missions 8 and 10 use the princessScene cut scene.
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.
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    11
 *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    12
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    13
interface
7043
7c080e5ac8d0 Some work to make more units compile after conversion to c
unc0rr
parents: 6817
diff changeset
    14
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
    15
{.$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
    16
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
    17
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
    18
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
    19
{$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
    20
    {$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
    21
{$ENDIF}
9205
abce6011f86c aaaaand let's not forget about lua, which has also a slightly revised build process
koda
parents: 8838
diff changeset
    22
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
    23
type
8847
ff7fbab7cd56 update branch again
koda
parents: 8026 8838
diff changeset
    24
{$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
    25
    size_t   = Cardinal;
7073
26f960656cc9 help pas2c
unc0rr
parents: 7043
diff changeset
    26
{$ENDIF}
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    27
    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
    28
    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
    29
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    30
    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
    31
    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
    32
3acdb4dac6eb 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
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    34
(*                               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
    35
(*****************************************************************************)
3acdb4dac6eb 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
** $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
    39
** 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
    40
** 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
    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
3acdb4dac6eb 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
(*
3acdb4dac6eb 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
** {==================================================================
3acdb4dac6eb 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
@@ 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
    46
** 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
    47
** 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
    48
** 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
    49
** ===================================================================
3acdb4dac6eb 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
*)
3acdb4dac6eb 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
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    52
    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
    53
    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
    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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    56
@@ 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
    57
@* 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
    58
** 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
    59
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    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
    61
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    62
    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
    63
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    64
(*
3acdb4dac6eb 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
@@ 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
    66
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    67
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
    68
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    69
    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
    70
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    71
(*
3acdb4dac6eb 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
@@ 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
    73
@@ 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
    74
** 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
    75
** 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
    76
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    77
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
    78
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    79
    LUA_PROMPT  = '> ';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    80
    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
    81
3acdb4dac6eb 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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    83
@@ 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
    84
@* 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
    85
@@ 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
    86
@@ 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
    87
** 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
    88
** 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
    89
*)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
    90
{function  lua_readline(L : Plua_State;
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
    91
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
    92
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
    93
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
    94
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
    95
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
    96
3acdb4dac6eb 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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    98
@@ 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
    99
@* 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
   100
** 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
   101
** 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
   102
*/
3acdb4dac6eb 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
#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
   104
#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
   105
#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
   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
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   108
    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
   109
3acdb4dac6eb 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
(*                                  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
   112
(*****************************************************************************)
3acdb4dac6eb 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
** $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
   116
** 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
   117
** 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
   118
** 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
   119
*)
3acdb4dac6eb 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
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   121
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
   122
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   123
    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
   124
    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
   125
    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
   126
    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
   127
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   128
    (* mark for precompiled code (`<esc>Lua') *)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   129
    //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
   130
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   131
    (* 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
   132
    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
   133
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   134
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   135
    ** pseudo-indices
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   136
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   137
    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
   138
    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
   139
    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
   140
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   141
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
   142
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
   143
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   144
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
   145
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   146
   (* 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
   147
    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
   148
    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
   149
    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
   150
    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
   151
    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
   152
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   153
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
   154
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   155
   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
   156
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   157
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   158
    ** 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
   159
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   160
    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
   161
    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
   162
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   163
  (*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   164
  ** 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
   165
  *)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   166
  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
   167
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   168
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
   169
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   170
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   171
    ** basic types
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   172
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   173
    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
   174
    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
   175
    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
   176
    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
   177
    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
   178
    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
   179
    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
   180
    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
   181
    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
   182
    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
   183
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   184
    (* 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
   185
    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
   186
3acdb4dac6eb 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
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   188
    (* 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
   189
    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
   190
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   191
    (* 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
   192
    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
   193
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   194
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
   195
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   196
** 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
   197
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   198
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
   199
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   200
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
   201
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
   202
    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
   203
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
   204
    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
   205
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   206
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
   207
    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
   208
3acdb4dac6eb 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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   211
** 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
   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
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
   214
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   215
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
   216
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
   217
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   218
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
   219
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
   220
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   221
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
   222
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
   223
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   224
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
   225
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
   226
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   227
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
   228
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
   229
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   230
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
   231
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
   232
    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
   233
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   234
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
   235
    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
   236
3acdb4dac6eb 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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   239
** 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
   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
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
   242
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   243
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
   244
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
   245
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   246
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
   247
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
   248
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   249
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
   250
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
   251
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   252
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
   253
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
   254
    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
   255
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
   256
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
   257
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   258
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
   259
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
   260
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   261
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
   262
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
   263
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   264
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
   265
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
   266
    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
   267
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   268
function lua_tonumber(L : Plua_State; idx : LongInt) : lua_Number;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   269
    cdecl; external LuaLibName;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   270
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   271
function lua_tointeger(L : Plua_State; idx : LongInt) : lua_Integer;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   272
    cdecl; external LuaLibName;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   273
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
   274
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
   275
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   276
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   277
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
   278
    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
   279
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
   280
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
   281
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   282
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
   283
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
   284
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   285
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
   286
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
   287
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   288
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
   289
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
   290
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   291
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
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
   293
    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
   294
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   295
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   296
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   297
** 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
   298
*)
3acdb4dac6eb 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
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
   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
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
   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
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
   306
    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
   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
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
   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
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
   312
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   313
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
   314
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
   315
    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
   316
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   317
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
   318
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
   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_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
   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_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
   325
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
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_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
   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
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
   331
    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
   332
3acdb4dac6eb 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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   334
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   335
** 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
   336
*)
3acdb4dac6eb 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
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
   338
    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
   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_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
   341
    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
   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_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
   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_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
   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
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
   350
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   351
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
   352
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
   353
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   354
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
   355
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
   356
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   357
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
   358
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
   359
    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
   360
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   361
3acdb4dac6eb 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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   363
** 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
   364
*)
3acdb4dac6eb 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_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
   366
    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
   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_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
   369
    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
   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
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
   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
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
   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
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
   378
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   379
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
   380
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
   381
    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
   382
3acdb4dac6eb 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
** `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
   385
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   386
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
   387
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   388
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   389
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
   390
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   391
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   392
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
   393
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   394
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   395
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
   396
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   397
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
   398
3acdb4dac6eb 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_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
   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
(*
3acdb4dac6eb 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
** 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
   405
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   406
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
   407
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   408
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
   409
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
   410
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   411
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
   412
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
   413
    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
   414
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   415
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   416
** 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
   417
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   418
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
   419
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   420
    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
   421
    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
   422
    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
   423
    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
   424
    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
   425
    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
   426
    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
   427
    LUA_GCSETSTEPMUL = 7;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   428
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
   429
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
   430
    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
   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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   433
** 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
   434
*)
3acdb4dac6eb 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_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
   436
    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
   437
3acdb4dac6eb 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_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
   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
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
   442
    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
   443
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   444
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
   445
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   446
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
   447
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
   448
    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
   449
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   450
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   451
** ===============================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   452
** 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
   453
** ===============================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   454
*)
3acdb4dac6eb 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
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
   456
3acdb4dac6eb 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
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
   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
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
   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
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
   462
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   463
function  lua_strlen(L : Plua_State; idx : LongInt) : LongInt;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   464
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
   465
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
   466
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
   467
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
   468
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
   469
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
   470
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
   471
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
   472
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
   473
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   474
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
   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
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
   477
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
   478
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   479
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
   480
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
   481
3acdb4dac6eb 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
(*
3acdb4dac6eb 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
** 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
   485
*)
3acdb4dac6eb 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
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
   487
3acdb4dac6eb 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
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
   489
3acdb4dac6eb 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_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
   491
3acdb4dac6eb 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
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   493
    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
   494
    lua_Chuckwriter = lua_Writer;
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
   495
3acdb4dac6eb 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
(* ====================================================================== *)
3acdb4dac6eb 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
(*
3acdb4dac6eb 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
** 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
   501
** =======================================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   502
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   503
3acdb4dac6eb 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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   505
** 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
   506
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   507
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   508
    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
   509
    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
   510
    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
   511
    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
   512
    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
   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
3acdb4dac6eb 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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   516
** 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
   517
*)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   518
    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
   519
    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
   520
    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
   521
    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
   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_Debug = packed record
10293
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   525
    event : LUA_INTEGER_;
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   526
    name : PChar;               (* (n) *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   527
    namewhat : PChar;           (* (n) `global', `local', `field', `method' *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   528
    what : PChar;               (* (S) `Lua', `C', `main', `tail' *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   529
    source : PChar;             (* (S) *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   530
    currentline : LUA_INTEGER_; (* (l) *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   531
    nups : LUA_INTEGER_;        (* (u) number of upvalues *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   532
    linedefined : LUA_INTEGER_; (* (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
   533
    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
   534
    (* private part *)
10293
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   535
    i_ci : LUA_INTEGER_;        (* 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
   536
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   537
    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
   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
  (* 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
   540
  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
   541
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   542
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   543
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
   544
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   545
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   546
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
   547
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   548
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   549
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
   550
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   551
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   552
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
   553
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   554
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
   555
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
   556
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   557
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
   558
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
   559
    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
   560
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   561
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
   562
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   563
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
   564
{$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
   565
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
   566
    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
   567
{$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
   568
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   569
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
   570
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   571
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
   572
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
   573
    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
   574
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   575
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   576
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   577
(*                                  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
   578
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   579
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   580
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   581
** $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
   582
** 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
   583
** 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
   584
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   585
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   586
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   587
    (* 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
   588
    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
   589
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   590
    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
   591
    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
   592
    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
   593
    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
   594
    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
   595
    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
   596
    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
   597
    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
   598
3acdb4dac6eb 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
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
   600
    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
   601
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   602
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
   603
    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
   604
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   605
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
   606
    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
   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
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
   609
    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
   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
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
   612
    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
   613
3acdb4dac6eb 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
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
   615
    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
   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
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
   618
    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
   619
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   620
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
   621
    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
   622
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   623
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
   624
    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
   625
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   626
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
   627
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   628
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   629
(*****************************************************************************)
3acdb4dac6eb 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
(*                                  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
   631
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   632
3acdb4dac6eb 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
** $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
   635
** 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
   636
** 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
   637
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   638
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   639
// not compatibility with the behavior of setn/getn in Lua 5.0
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   640
function  luaL_getn(L : Plua_State; idx : LongInt) : LongInt;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   641
procedure luaL_setn(L : Plua_State; i, j : LongInt);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   642
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
   643
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   644
    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
   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
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   647
    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
   648
    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
   649
    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
   650
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   651
    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
   652
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   653
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   654
procedure luaL_openlib(L : Plua_State; const libname : PChar; const lr : PluaL_Reg; nup : LongInt);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   655
    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
   656
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
   657
    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
   658
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
   659
    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
   660
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
   661
    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
   662
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
   663
    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
   664
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
   665
    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
   666
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
   667
    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
   668
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
   669
    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
   670
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
   671
    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
   672
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
   673
    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
   674
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   675
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
   676
    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
   677
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
   678
    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
   679
3acdb4dac6eb 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
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
   681
    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
   682
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
   683
    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
   684
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
   685
    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
   686
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   687
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
   688
    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
   689
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
   690
    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
   691
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   692
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
   693
    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
   694
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
   695
    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
   696
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   697
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
   698
    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
   699
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   700
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
   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
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
   703
    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
   704
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   705
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
   706
    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
   707
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
   708
    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
   709
3acdb4dac6eb 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
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
   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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   713
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
   714
    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
   715
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   716
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
   717
    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
   718
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   719
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
   720
    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
   721
3acdb4dac6eb 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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   723
(*
3acdb4dac6eb 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
** ===============================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   725
** 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
   726
** ===============================================================
3acdb4dac6eb 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
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   729
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
   730
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
   731
function luaL_optstring(L : Plua_State; n : LongInt; d : PChar) : PChar;
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   732
function luaL_checkint(L : Plua_State; n : LongInt) : lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   733
function luaL_optint(L : Plua_State; n : LongInt; d : lua_Integer): lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   734
function luaL_checklong(L : Plua_State; n : LongInt) : lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   735
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
   736
3acdb4dac6eb 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
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
   738
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   739
function luaL_dofile(L : Plua_State; fn : PChar) : LongInt;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   740
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   741
function luaL_dostring(L : Plua_State; s : PChar) : LongInt;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   742
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
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
   744
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   745
(* 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
   746
#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
   747
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   748
3acdb4dac6eb 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
** 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
   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
*)
3acdb4dac6eb 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
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   756
    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
   757
    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
   758
    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
   759
    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
   760
    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
   761
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   762
    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
   763
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   764
procedure luaL_addchar(B : PluaL_Buffer; c : Char);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   765
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
   766
(* compatibility only *)
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   767
procedure luaL_putchar(B : PluaL_Buffer; c : Char);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   768
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
   769
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
   770
3acdb4dac6eb 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
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
   772
    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
   773
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
   774
    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
   775
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
   776
    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
   777
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
   778
    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
   779
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
   780
    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
   781
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
   782
    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
   783
3acdb4dac6eb 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
(* ====================================================== *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   785
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   786
3acdb4dac6eb 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
(* 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
   788
3acdb4dac6eb 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
(* 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
   790
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   791
    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
   792
    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
   793
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   794
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
   795
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   796
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
   797
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   798
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
   799
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   800
3acdb4dac6eb 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
(******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   802
(******************************************************************************)
3acdb4dac6eb 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
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
   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
uses
11823
0fba6cb098a1 drop SysUtils inclusion from 5 files where it is not needed anymore
sheepluva
parents: 11821
diff changeset
   808
  uUtils;
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
   809
3acdb4dac6eb 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
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   811
(*                            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
   812
(*****************************************************************************)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   813
{
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   814
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
   815
var
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   816
    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
   817
var
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   818
    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
   819
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   820
    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
   821
    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
   822
    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
   823
    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
   824
end;
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   825
}
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
   826
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
   827
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
   828
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
   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
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
   831
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
   832
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
   833
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   834
3acdb4dac6eb 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
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   836
(*                                  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
   837
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   838
3acdb4dac6eb 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
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
   840
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   841
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
   842
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
   843
3acdb4dac6eb 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
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
   845
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   846
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
   847
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
   848
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   849
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
   850
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   851
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
   852
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
   853
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   854
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
   855
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   856
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
   857
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
   858
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
   859
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   860
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
   861
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   862
    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
   863
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
   864
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   865
function  lua_strlen(L : Plua_State; idx : LongInt) : LongInt;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   866
begin
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   867
    lua_strlen := lua_objlen(L, idx);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   868
end;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   869
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
   870
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
   871
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   872
    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
   873
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
   874
3acdb4dac6eb 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
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
   876
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   877
    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
   878
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
   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
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
   881
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   882
    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
   883
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
   884
3acdb4dac6eb 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
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
   886
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   887
    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
   888
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
   889
3acdb4dac6eb 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
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
   891
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   892
    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
   893
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
   894
3acdb4dac6eb 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
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
   896
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   897
    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
   898
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
   899
3acdb4dac6eb 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
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
   901
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   902
    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
   903
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
   904
3acdb4dac6eb 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
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
   906
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   907
    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
   908
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
   909
3acdb4dac6eb 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
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
   911
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   912
    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
   913
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
   914
3acdb4dac6eb 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
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
   916
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   917
    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
   918
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
   919
3acdb4dac6eb 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
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
   921
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   922
    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
   923
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
   924
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   925
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
   926
begin
6817
daaf0834c4d2 - Apply unit's namespace to current scope when referencing unit name
unc0rr
parents: 6580
diff changeset
   927
    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
   928
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
   929
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   930
function lua_tostringA(L : Plua_State; idx : LongInt) : ansistring;
10127
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   931
var p: PChar;
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   932
begin
10127
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   933
    p:= lua_tolstring(L, idx, nil);
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   934
    lua_tostringA := ansistring(p);
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   935
end;
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   936
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
   937
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
   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_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
   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
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
   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_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
   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
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
   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_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
   950
end;
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   951
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
   952
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   953
(*****************************************************************************)
3acdb4dac6eb 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
(*                                  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
   955
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   956
3acdb4dac6eb 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
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
   958
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
   959
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
   960
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   961
3acdb4dac6eb 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
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   963
(*                                  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
   964
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   965
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   966
function luaL_getn(L : Plua_State; idx : LongInt) : LongInt;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   967
begin
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   968
    luaL_getn := lua_objlen(L, idx);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   969
end;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
   970
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
   971
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
   972
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   973
    (* 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
   974
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
   975
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   976
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
   977
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   978
    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
   979
        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
   980
    else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   981
        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
   982
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
   983
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   984
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
   985
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   986
    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
   987
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
   988
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   989
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
   990
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   991
    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
   992
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
   993
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   994
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
   995
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   996
    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
   997
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
   998
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   999
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
  1000
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1001
    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
  1002
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
  1003
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
  1004
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
  1005
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1006
    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
  1007
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
  1008
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
  1009
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
  1010
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1011
    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
  1012
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
  1013
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1014
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
  1015
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1016
    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
  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
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1019
function luaL_dofile(L : Plua_State; fn : PChar) : LongInt;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1020
begin
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1021
    luaL_dofile := luaL_loadfile(L, fn);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1022
    if luaL_dofile = 0 then
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1023
        luaL_dofile := lua_pcall(L, 0, 0, 0);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1024
end;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1025
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1026
function luaL_dostring(L : Plua_State; s : PChar) : LongInt;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1027
begin
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1028
    luaL_dostring := luaL_loadstring(L, s);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1029
    if luaL_dostring = 0 then
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1030
        luaL_dostring := lua_pcall(L, 0, 0, 0);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1031
end;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1032
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
  1033
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
  1034
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1035
    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
  1036
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
  1037
10238
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1038
procedure luaL_addchar(B : PluaL_Buffer; c : Char);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1039
begin
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1040
    if not(B^.p < B^.buffer + LUAL_BUFFERSIZE) then
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1041
        luaL_prepbuffer(B);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1042
    (B^.p^) := c;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1043
    Inc(B^.p);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1044
end;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1045
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1046
procedure luaL_putchar(B : PluaL_Buffer; c : Char);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1047
begin
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1048
    luaL_addchar(B, c);
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1049
end;
7e20804db6a2 rolling back (most of) lua 5.2 compatibility patches. hopefully that will unbreak unC0Rr's lua issues for now.
sheepluva
parents: 10230
diff changeset
  1050
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
  1051
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
  1052
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
  1053
  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
  1054
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
  1055
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1056
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
  1057
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1058
    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
  1059
        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
  1060
    else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1061
        begin
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
  1062
        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
  1063
        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
  1064
        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
  1065
        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
  1066
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
  1067
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1068
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
  1069
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1070
    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
  1071
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
  1072
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1073
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
  1074
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1075
    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
  1076
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
  1077
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1078
3acdb4dac6eb 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
(******************************************************************************
3acdb4dac6eb 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
* 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
  1081
*  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
  1082
*  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
  1083
*
3acdb4dac6eb 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
*
3acdb4dac6eb 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
* 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
  1086
* 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
  1087
* "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
  1088
* 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
  1089
* 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
  1090
* 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
  1091
* 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
  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
* 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
  1094
* 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
  1095
*
3acdb4dac6eb 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
* 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
  1097
* 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
  1098
* 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
  1099
* 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
  1100
* 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
  1101
* 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
  1102
* 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
  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
3acdb4dac6eb 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
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
  1106
3407
dcc129c4352e Engine:
smxx
parents: 3043
diff changeset
  1107
{$HINTS ON}