hedgewars/LuaPas.pas
author Wuzzy <Wuzzy2@mail.ru>
Mon, 10 Dec 2018 09:01:27 +0100
changeset 14426 dce60c706f01
parent 14220 3c36a4e66c82
permissions -rw-r--r--
Tweak damage tag delay
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
13943
3a0d09a31f5f fix library names in engine
alfadur
parents: 13512
diff changeset
    17
const LuaLibName =
3a0d09a31f5f fix library names in engine
alfadur
parents: 13512
diff changeset
    18
{$IFDEF LUA_INTERNAL}
3a0d09a31f5f fix library names in engine
alfadur
parents: 13512
diff changeset
    19
    {$IFDEF WIN32_VCPKG}'hwlua'{$ELSE}'libhwlua'{$ENDIF}
3a0d09a31f5f fix library names in engine
alfadur
parents: 13512
diff changeset
    20
{$ELSE}
3a0d09a31f5f fix library names in engine
alfadur
parents: 13512
diff changeset
    21
    {$IFDEF WIN32_VCPKG}'lua'{$ELSE}'liblua'{$ENDIF}
3a0d09a31f5f fix library names in engine
alfadur
parents: 13512
diff changeset
    22
{$ENDIF};
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
    23
14220
3c36a4e66c82 make engine windows checks work for 64bit builds
alfadur
parents: 13943
diff changeset
    24
{$IFNDEF WINDOWS}
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
    25
    {$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
    26
{$ENDIF}
9205
abce6011f86c aaaaand let's not forget about lua, which has also a slightly revised build process
koda
parents: 8838
diff changeset
    27
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    28
type
8847
ff7fbab7cd56 update branch again
koda
parents: 8026 8838
diff changeset
    29
{$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
    30
    size_t   = Cardinal;
7073
26f960656cc9 help pas2c
unc0rr
parents: 7043
diff changeset
    31
{$ENDIF}
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    32
    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
    33
    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
    34
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    35
    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
    36
    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
    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
(*****************************************************************************)
3acdb4dac6eb 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
(*                               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
    40
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    41
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    42
(*
3acdb4dac6eb 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
** $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
    44
** 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
    45
** 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
    46
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    47
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    48
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    49
** {==================================================================
3acdb4dac6eb 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
@@ 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
    51
** 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
    52
** 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
    53
** 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
    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
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    57
    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
    58
    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
    59
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    60
(*
3acdb4dac6eb 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
@@ 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
    62
@* 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
    63
** 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
    64
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    65
3043
3acdb4dac6eb 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
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    67
    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
    68
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    69
(*
3acdb4dac6eb 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
@@ 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
    71
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    72
3043
3acdb4dac6eb 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
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    74
    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
    75
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    76
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    77
@@ LUA_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
    78
@@ 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
    79
** 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
    80
** 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
    81
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
    82
3043
3acdb4dac6eb 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
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    84
    LUA_PROMPT  = '> ';
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
    85
    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
    86
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
    87
(*
3acdb4dac6eb 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
@@ 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
    89
@* 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
    90
@@ 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
    91
@@ 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
    92
** 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
    93
** 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
    94
*)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
    95
{function  lua_readline(L : Plua_State;
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
    96
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
    97
3043
3acdb4dac6eb 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
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
    99
3043
3acdb4dac6eb 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
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
   101
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   102
(*
3acdb4dac6eb 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
@@ 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
   104
@* 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
   105
** 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
   106
** 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
   107
*/
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   108
#include <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
   109
#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
   110
#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
   111
*)
3acdb4dac6eb 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
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   113
    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
   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
(*****************************************************************************)
3acdb4dac6eb 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.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
   117
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   118
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   119
(*
3acdb4dac6eb 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
** $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
   121
** Lua - An Extensible Extension Language
13512
36f3f77e9b1b Switch from http:// to https:// URLs where possible
Wuzzy <Wuzzy2@mail.ru>
parents: 11823
diff changeset
   122
** Lua.org, PUC-Rio, Brazil (https://www.lua.org)
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   123
** 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
   124
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   125
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   126
3043
3acdb4dac6eb 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
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   128
    LUA_VERSION     = '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
   129
    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
   130
    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
   131
    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
   132
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   133
    (* mark for precompiled code (`<esc>Lua') *)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   134
    //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
   135
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   136
    (* 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
   137
    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
   138
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   139
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   140
    ** pseudo-indices
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   141
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   142
    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
   143
    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
   144
    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
   145
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   146
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   147
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
   148
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   149
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   150
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   151
   (* 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
   152
    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
   153
    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
   154
    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
   155
    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
   156
    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
   157
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   158
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   159
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   160
   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
   161
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   162
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   163
    ** 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
   164
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   165
    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
   166
    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
   167
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   168
  (*
3acdb4dac6eb 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
  ** 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
   170
  *)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   171
  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
   172
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   173
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   174
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   175
    (*
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   176
    ** basic types
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   177
    *)
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   178
    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
   179
    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
   180
    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
   181
    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
   182
    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
   183
    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
   184
    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
   185
    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
   186
    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
   187
    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
   188
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   189
    (* 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
   190
    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
   191
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   192
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   193
    (* 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
   194
    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
   195
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   196
    (* 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
   197
    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
   198
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   199
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   200
(*
3acdb4dac6eb 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
** 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
   202
*)
3acdb4dac6eb 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_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
   204
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   205
3043
3acdb4dac6eb 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
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
   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
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
   209
    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
   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
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
   212
    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
   213
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   214
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   215
(*
3acdb4dac6eb 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
** 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
   217
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   218
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
   219
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   220
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   221
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
   222
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   223
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   224
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
   225
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   226
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   227
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
   228
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   229
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   230
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
   231
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   232
3043
3acdb4dac6eb 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
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
   234
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   235
3043
3acdb4dac6eb 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
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
   237
    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
   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
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
   240
    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
   241
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   242
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   243
(*
3acdb4dac6eb 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
** 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
   245
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   246
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
   247
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   248
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   249
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
   250
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   251
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   252
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
   253
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   254
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   255
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
   256
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   257
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   258
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
   259
    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
   260
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   261
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
   262
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   263
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   264
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
   265
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   266
3043
3acdb4dac6eb 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
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
   268
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   269
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   270
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
   271
    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
   272
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
   273
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
   274
    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
   275
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
   276
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
   277
    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
   278
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   279
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
   280
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   281
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   282
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
   283
    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
   284
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   285
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
   286
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   287
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   288
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
   289
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   290
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   291
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
   292
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   293
3043
3acdb4dac6eb 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
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
   295
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   296
3043
3acdb4dac6eb 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
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
   298
    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
   299
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   300
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   301
(*
3acdb4dac6eb 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
** 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
   303
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   304
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
   305
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   306
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   307
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
   308
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   309
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   310
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
   311
    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
   312
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   313
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
   314
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   315
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   316
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
   317
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   318
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   319
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
   320
    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
   321
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   322
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   323
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
   324
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   325
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   326
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
   327
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   328
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   329
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
   330
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   331
3043
3acdb4dac6eb 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
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
   333
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   334
3043
3acdb4dac6eb 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
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
   336
    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
   337
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   338
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   339
(*
3acdb4dac6eb 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
** 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
   341
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   342
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
   343
    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
   344
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   345
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
   346
    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
   347
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   348
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
   349
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   350
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   351
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
   352
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   353
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   354
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
   355
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   356
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   357
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
   358
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   359
3043
3acdb4dac6eb 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
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
   361
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   362
3043
3acdb4dac6eb 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
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
   364
    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
   365
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   366
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   367
(*
3acdb4dac6eb 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
** 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
   369
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   370
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
   371
    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
   372
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   373
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
   374
    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
   375
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   376
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
   377
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   378
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   379
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
   380
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   381
3043
3acdb4dac6eb 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
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
   383
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   384
3043
3acdb4dac6eb 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
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
   386
    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
   387
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   388
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   389
** `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
   390
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   391
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
   392
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   393
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   394
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
   395
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   396
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   397
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
   398
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   399
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   400
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
   401
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   402
3043
3acdb4dac6eb 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
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
   405
    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
   406
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   407
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   408
(*
3acdb4dac6eb 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
** 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
   410
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   411
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
   412
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   413
3043
3acdb4dac6eb 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
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
   415
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   416
3043
3acdb4dac6eb 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
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
   418
    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
   419
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   420
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   421
** 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
   422
*)
8026
4a4f21070479 merge xymeng's gsoc engine with a few updates (and further checks on symbol definitions)
koda
parents: 7151
diff changeset
   423
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   424
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   425
    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
   426
    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
   427
    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
   428
    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
   429
    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
   430
    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
   431
    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
   432
    LUA_GCSETSTEPMUL = 7;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   433
3043
3acdb4dac6eb 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
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
   435
    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
   436
3acdb4dac6eb 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
** 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
   439
*)
3acdb4dac6eb 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
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
   441
    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
   442
3acdb4dac6eb 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
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
   444
    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
   445
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   446
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
   447
    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
   448
3acdb4dac6eb 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
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
   450
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   451
3043
3acdb4dac6eb 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
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
   453
    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
   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
(*
3acdb4dac6eb 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
** 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
   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
*)
3acdb4dac6eb 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
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
   461
3acdb4dac6eb 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
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
   463
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   464
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
   465
3acdb4dac6eb 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
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
   467
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
   468
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
   469
3043
3acdb4dac6eb 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_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
   471
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
   472
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
   473
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
   474
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
   475
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
   476
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
   477
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
   478
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   479
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
   480
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   481
procedure lua_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
   482
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
   483
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   484
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
   485
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
   486
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   487
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   488
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   489
** 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
   490
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   491
function lua_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
   492
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   493
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
   494
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   495
function lua_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
   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
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   498
    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
   499
    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
   500
3acdb4dac6eb 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
** 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
   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
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   508
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   509
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   510
** 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
   511
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   512
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   513
    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
   514
    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
   515
    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
   516
    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
   517
    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
   518
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   519
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   520
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   521
** 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
   522
*)
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   523
    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
   524
    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
   525
    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
   526
    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
   527
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   528
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   529
    lua_Debug = packed record
10293
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   530
    event : LUA_INTEGER_;
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   531
    name : PChar;               (* (n) *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   532
    namewhat : PChar;           (* (n) `global', `local', `field', `method' *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   533
    what : PChar;               (* (S) `Lua', `C', `main', `tail' *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   534
    source : PChar;             (* (S) *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   535
    currentline : LUA_INTEGER_; (* (l) *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   536
    nups : LUA_INTEGER_;        (* (u) number of upvalues *)
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   537
    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
   538
    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
   539
    (* private part *)
10293
201ea4989985 state file name and line number in lua error messages
sheepluva
parents: 10238
diff changeset
   540
    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
   541
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   542
    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
   543
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   544
  (* 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
   545
  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
   546
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   547
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   548
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
   549
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   550
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   551
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
   552
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   553
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   554
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
   555
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   556
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   557
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
   558
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   559
3043
3acdb4dac6eb 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
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
   561
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   562
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   563
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
   564
    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
   565
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   566
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
   567
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   568
3043
3acdb4dac6eb 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
{$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
   570
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
   571
    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
   572
{$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
   573
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   574
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
   575
    cdecl; external LuaLibName;
10015
4feced261c68 partial merge of the webgl branch
koda
parents: 9236
diff changeset
   576
3043
3acdb4dac6eb 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
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
   578
    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
   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
(*****************************************************************************)
3acdb4dac6eb 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
(*                                  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
   583
(*****************************************************************************)
3acdb4dac6eb 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
** $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
   587
** 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
   588
** 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
   589
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   590
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   591
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   592
    (* 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
   593
    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
   594
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   595
    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
   596
    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
   597
    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
   598
    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
   599
    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
   600
    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
   601
    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
   602
    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
   603
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   604
function 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
   605
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   606
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   607
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
   608
    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
   609
3acdb4dac6eb 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
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
   611
    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
   612
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   613
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
   614
    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
   615
3acdb4dac6eb 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
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
   617
    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
   618
3acdb4dac6eb 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
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
   620
    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
   621
3acdb4dac6eb 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
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
   623
    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
   624
3acdb4dac6eb 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
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
   626
    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
   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
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
   629
    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
   630
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   631
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
   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
(*****************************************************************************)
3acdb4dac6eb 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
(*                                  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
   636
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   637
3acdb4dac6eb 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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   639
** $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
   640
** 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
   641
** 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
   642
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   643
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
   644
// 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
   645
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
   646
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
   647
3043
3acdb4dac6eb 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
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   649
    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
   650
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   651
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   652
    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
   653
    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
   654
    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
   655
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   656
    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
   657
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   658
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
   659
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
   660
    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
   661
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
   662
    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
   663
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
   664
    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
   665
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
   666
    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
   667
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
   668
    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
   669
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
   670
    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
   671
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
   672
    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
   673
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
   674
    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
   675
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
   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_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
   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
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   680
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
   681
    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
   682
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
   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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   685
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
   686
    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
   687
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
   688
    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
   689
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
   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
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
   693
    cdecl; external LuaLibName;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   694
function luaL_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
   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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   697
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
   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
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
   700
    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
   701
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   702
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
   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_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
   706
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   707
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
   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_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
   711
    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
   712
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
   713
    cdecl; external LuaLibName;
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   714
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   715
function luaL_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
   716
    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
   717
3acdb4dac6eb 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
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
   719
    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
   720
3acdb4dac6eb 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
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
   722
    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
   723
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   724
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
   725
    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
   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
(*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   729
** ===============================================================
3acdb4dac6eb 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
** 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
   731
** ===============================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   732
*)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   733
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   734
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
   735
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
   736
function luaL_optstring(L : Plua_State; n : LongInt; d : PChar) : PChar;
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   737
function luaL_checkint(L : Plua_State; n : LongInt) : lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   738
function luaL_optint(L : Plua_State; n : LongInt; d : lua_Integer): lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   739
function luaL_checklong(L : Plua_State; n : LongInt) : lua_Integer;
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
   740
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
   741
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   742
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
   743
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
   744
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
   745
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
   746
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
   747
3043
3acdb4dac6eb 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
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
   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
(* 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
   751
#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
   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
** {======================================================
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   756
** 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
   757
** =======================================================
3acdb4dac6eb 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
*)
3acdb4dac6eb 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
3acdb4dac6eb 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
type
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   761
    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
   762
    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
   763
    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
   764
    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
   765
    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
   766
    end;
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   767
    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
   768
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
   769
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
   770
3043
3acdb4dac6eb 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
(* 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
   772
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
   773
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   774
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
   775
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   776
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
   777
    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
   778
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
   779
    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
   780
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
   781
    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
   782
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
   783
    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
   784
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
   785
    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
   786
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
   787
    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
   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
(* ====================================================== *)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   790
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   791
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   792
(* 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
   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
(* 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
   795
const
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   796
    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
   797
    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
   798
3acdb4dac6eb 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
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
   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
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
   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
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
   804
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   805
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   806
(******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   807
(******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   808
(******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   809
3acdb4dac6eb 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
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
   811
3acdb4dac6eb 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
uses
11823
0fba6cb098a1 drop SysUtils inclusion from 5 files where it is not needed anymore
sheepluva
parents: 11821
diff changeset
   813
  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
   814
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   815
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   816
(*                            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
   817
(*****************************************************************************)
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   818
{
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   819
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
   820
var
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   821
    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
   822
var
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   823
    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
   824
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   825
    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
   826
    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
   827
    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
   828
    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
   829
end;
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
   830
}
3043
3acdb4dac6eb 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
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
   832
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
   833
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
   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
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
   836
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
   837
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
   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
3acdb4dac6eb 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
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   841
(*                                  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
   842
(*****************************************************************************)
3acdb4dac6eb 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
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
   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_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
   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_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
   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_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
   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_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
   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_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
   857
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
   858
3acdb4dac6eb 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
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
   860
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   861
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
   862
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
   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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   865
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
   866
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   867
    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
   868
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
   869
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
   870
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
   871
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
   872
    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
   873
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
   874
3043
3acdb4dac6eb 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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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_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
   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
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
   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_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
   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_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
   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_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
   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_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
   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_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
   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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   925
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
   926
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   927
    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
   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_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
   931
begin
6817
daaf0834c4d2 - Apply unit's namespace to current scope when referencing unit name
unc0rr
parents: 6580
diff changeset
   932
    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
   933
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
   934
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   935
function lua_tostringA(L : Plua_State; idx : LongInt) : ansistring;
10127
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   936
var p: PChar;
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   937
begin
10127
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   938
    p:= lua_tolstring(L, idx, nil);
7f29a65aa1e4 It compiles \o/
unc0rr
parents: 10124
diff changeset
   939
    lua_tostringA := ansistring(p);
10124
aabd1b75d5a3 Even more explicit type conversions and other stuff to help pas2c use ansistrings
unc0rr
parents: 10015
diff changeset
   940
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
   941
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   942
function lua_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
   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_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
   945
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   946
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   947
procedure lua_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
   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_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
   950
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   951
3acdb4dac6eb 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
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
   953
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   954
    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
   955
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
   956
3043
3acdb4dac6eb 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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   958
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   959
(*                                  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
   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
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
   963
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
   964
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
   965
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   966
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   967
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   968
(*                                  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
   969
(*****************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   970
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
   971
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
   972
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
   973
    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
   974
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
   975
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   976
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
   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
    (* 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
   979
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
   980
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   981
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
   982
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   983
    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
   984
        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
   985
    else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
   986
        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
   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_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
   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_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
   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
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
   994
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
   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_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
   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_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
  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_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
  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_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
  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_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
  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_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
  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_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
  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
5089
90266b67fff8 This better matches lua headers
nemo
parents: 5088
diff changeset
  1014
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
  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_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
  1017
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1018
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1019
function luaL_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
  1020
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1021
    luaL_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
  1022
end;
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1023
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
  1024
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
  1025
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
  1026
    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
  1027
    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
  1028
        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
  1029
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
  1030
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
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
  1032
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
  1033
    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
  1034
    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
  1035
        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
  1036
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
  1037
3043
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1038
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
  1039
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1040
    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
  1041
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
  1042
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
  1043
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
  1044
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
  1045
    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
  1046
        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
  1047
    (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
  1048
    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
  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
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
  1051
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
  1052
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
  1053
    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
  1054
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
  1055
3043
3acdb4dac6eb 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
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
  1057
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
  1058
  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
  1059
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
  1060
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1061
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
  1062
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1063
    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
  1064
        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
  1065
    else
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1066
        begin
7151
ec15d9e1a7e3 pas2c stuff
unc0rr
parents: 7073
diff changeset
  1067
        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
  1068
        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
  1069
        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
  1070
        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
  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_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
  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
    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
  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
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
  1079
begin
6580
6155187bf599 A partial reformatting of the pascal code to have consistent syntax. Things that are still inconsistent.
lovelacer
parents: 6453
diff changeset
  1080
    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
  1081
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
  1082
3acdb4dac6eb 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
* 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
  1086
*  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
  1087
*  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
  1088
*
3acdb4dac6eb 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
*
3acdb4dac6eb 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
* 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
  1091
* 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
  1092
* "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
  1093
* 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
  1094
* 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
  1095
* 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
  1096
* 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
  1097
*
3acdb4dac6eb 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
* 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
  1099
* 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
  1100
*
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1101
* THE 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
  1102
* 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
  1103
* 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
  1104
* 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
  1105
* 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
  1106
* 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
  1107
* 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
  1108
******************************************************************************)
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1109
3acdb4dac6eb Just tidying up a bit. Comments, moving uMisc to end of frees in case ones above it need logging
nemo
parents: 2948
diff changeset
  1110
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
  1111
3407
dcc129c4352e Engine:
smxx
parents: 3043
diff changeset
  1112
{$HINTS ON}