Initial commit
This commit is contained in:
commit
19cfac0622
740 changed files with 35887 additions and 0 deletions
BIN
addons/lua502.dll
Normal file
BIN
addons/lua502.dll
Normal file
Binary file not shown.
BIN
addons/lua502.exp
Normal file
BIN
addons/lua502.exp
Normal file
Binary file not shown.
BIN
addons/lua502.lib
Normal file
BIN
addons/lua502.lib
Normal file
Binary file not shown.
BIN
addons/lua502.pdb
Normal file
BIN
addons/lua502.pdb
Normal file
Binary file not shown.
5
addons/lua502.vdf
Normal file
5
addons/lua502.vdf
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"Plugin"
|
||||
{
|
||||
"file" "gmod9/addons/lua502.dll"
|
||||
}
|
||||
|
||||
33
build
Normal file
33
build
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# If you don't want to use make, run this script.
|
||||
# But make sure you read config to see what can be customized.
|
||||
|
||||
|
||||
# Easiest way to build bin/lua:
|
||||
# cc -O2 -o bin/lua -Iinclude -Isrc src/*.c src/lib/*.c src/lua/*.c -lm -ldl
|
||||
|
||||
|
||||
# Easiest way to build Lua libraries and executables:
|
||||
echo -n 'building core library... '
|
||||
cd src
|
||||
cc -O2 -c -I../include *.c
|
||||
ar rc ../lib/liblua.a *.o
|
||||
rm -f *.o
|
||||
|
||||
echo -n 'standard library... '
|
||||
cd lib
|
||||
cc -O2 -c -I../../include *.c
|
||||
ar rc ../../lib/liblualib.a *.o
|
||||
rm -f *.o
|
||||
|
||||
echo -n 'lua... '
|
||||
cd ../lua
|
||||
cc -O2 -o ../../bin/lua -I../../include *.c ../../lib/*.a -lm -ldl
|
||||
|
||||
echo -n 'luac... '
|
||||
cd ../luac
|
||||
cc -O2 -o ../../bin/luac -I../../include -I.. *.c -DLUA_OPNAMES ../lopcodes.c ../../lib/*.a
|
||||
|
||||
echo 'done'
|
||||
|
||||
cd ../..
|
||||
bin/lua test/hello.lua
|
||||
178
config
Normal file
178
config
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
# configuration file for making Lua 5.0
|
||||
# see INSTALL for installation instructions
|
||||
|
||||
# These are default values. Skip this section and see the explanations below.
|
||||
|
||||
LOADLIB=
|
||||
DLLIB=
|
||||
NUMBER=
|
||||
POPEN=
|
||||
TMPNAM=
|
||||
DEGREES=
|
||||
USERCONF=
|
||||
|
||||
# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT =======================
|
||||
|
||||
# --------------------------------------------------------------- Lua libraries
|
||||
|
||||
# Support for dynamically loading C libraries for Lua is a very important
|
||||
# feature, which we strongly recommend be enabled. By default, this support is
|
||||
# enabled on Windows systems (see below) but disabled on other systems because
|
||||
# it relies on system-dependent code that is not part of ANSI C. For more
|
||||
# information on dynamic loading, read the comments in src/lib/liolib.c .
|
||||
#
|
||||
# To enable support for dynamic loading on Unix systems that support the dlfcn
|
||||
# interface (e.g., Linux, Solaris, IRIX, BSD, AIX, HPUX, and probably others),
|
||||
# uncomment the next two lines.
|
||||
#
|
||||
#LOADLIB= -DUSE_DLOPEN=1
|
||||
#DLLIB= -ldl
|
||||
#
|
||||
# In Linux with gcc, you should also uncomment the next definition for
|
||||
# MYLDFLAGS, which passes -E (= -export-dynamic) to the linker. This option
|
||||
# allows dynamic libraries to link back to the `lua' program, so that they do
|
||||
# not need the Lua libraries. (Other systems may have an equivalent facility.)
|
||||
#
|
||||
#MYLDFLAGS= -Wl,-E
|
||||
#
|
||||
# On Windows systems. support for dynamic loading is enabled by default.
|
||||
# To disable this support, uncomment the next line.
|
||||
#
|
||||
#LOADLIB= -DUSE_DLL=0
|
||||
|
||||
# The Lua IO library (src/lib/liolib.c) has support for pipes using popen and
|
||||
# pclose. This support is enabled by default on POSIX systems.
|
||||
# If your system is not POSIX but has popen and pclose, define USE_POPEN=1.
|
||||
# If you don't want to support pipes, define USE_POPEN=0.
|
||||
#
|
||||
#POPEN= -DUSE_POPEN=1
|
||||
#POPEN= -DUSE_POPEN=0
|
||||
#
|
||||
# The form below will probably work in (some) Windows systems.
|
||||
#
|
||||
#POPEN= -DUSE_POPEN=1 -Dpopen=_popen -Dpclose=_pclose
|
||||
|
||||
# The Lua OS library (src/lib/liolib.c) exports an interface to the C function
|
||||
# tmpnam, which gcc now thinks is `dangerous'. So, support for tmpnam is
|
||||
# disabled by default when compiling with gcc.
|
||||
# If you still want to use tmpnam, define USE_TMPNAME=1. If you don't want to
|
||||
# use tmpnam even if you're not compiling with gcc, define USE_TMPNAME=0.
|
||||
#
|
||||
#TMPNAM= -DUSE_TMPNAME=1
|
||||
#TMPNAM= -DUSE_TMPNAME=0
|
||||
|
||||
# The Lua math library (src/lib/lmathlib.c) now operates in radians, unlike
|
||||
# previous versions of Lua, which used degrees. To use degrees instead of
|
||||
# radians, define USE_DEGREES.
|
||||
#
|
||||
#DEGREES= -DUSE_DEGREES
|
||||
|
||||
# ------------------------------------------------------------------ Lua core
|
||||
|
||||
# Lua uses double for numbers. To change this, uncomment and edit the following
|
||||
# line, changing USE_XXX to one of USE_DOUBLE, USE_FLOAT, USE_LONG, USE_INT.
|
||||
#
|
||||
#NUMBER= -DLUA_USER_H='"../etc/luser_number.h"' -DUSE_XXX
|
||||
|
||||
# When compiling Lua with gcc on a Pentium machine, using a fast rounding
|
||||
# method for the conversion of doubles to ints can give around 20% speed
|
||||
# improvement. To use this rounding method, uncomment the following line.
|
||||
#NUMBER= -DLUA_USER_H='"../etc/luser_number.h"' -DUSE_FASTROUND
|
||||
|
||||
# For partial compatibility with old upvalue syntax, define LUA_COMPATUPSYNTAX.
|
||||
# For partial compatibility with old upvalue behavior in C functions, define
|
||||
# LUA_COMPATUPVALUES. Add these definitions to MYCFLAGS.
|
||||
#
|
||||
# -DLUA_COMPATUPSYNTAX -DLUA_COMPATUPVALUES
|
||||
|
||||
# ------------------------------------------------------------- Lua interpreter
|
||||
|
||||
# The stand-alone Lua interpreter needs the math functions, which are usually
|
||||
# in libm.a (-lm). If your C library already includes the math functions,
|
||||
# or if you are using a modified interpreter that does not need them,
|
||||
# then comment the following line or add the appropriates libraries.
|
||||
#
|
||||
EXTRA_LIBS= -lm
|
||||
|
||||
# If you want to customize the stand-alone Lua interpreter, uncomment and
|
||||
# edit the following two lines; also edit etc/saconfig.c to suit your needs.
|
||||
# -DUSE_READLINE adds line editing and history to the interpreter. You need
|
||||
# to add -lreadline (and perhaps also -lhistory and -lcurses or -lncurses)
|
||||
# to EXTRA_LIBS.
|
||||
#
|
||||
#USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
|
||||
#EXTRA_LIBS= -lm -ldl -lreadline # -lhistory -lcurses -lncurses
|
||||
|
||||
# ------------------------------------------------------------------ C compiler
|
||||
|
||||
# You need an ANSI C compiler. gcc is a popular one. We do not use -ansi in
|
||||
# WARN because it disables POSIX features used in the libraries.
|
||||
#
|
||||
CC= gcc
|
||||
WARN= -Wall
|
||||
|
||||
# ------------------------------------------------------------------ C options
|
||||
|
||||
# Write here any options you may need for your C compiler.
|
||||
# If you are using gcc, -O3 will get you a faster but larger code. You can
|
||||
# also add -fomit-frame-pointer to get even faster code at the cost of losing
|
||||
# debug information. If you only want the shared libraries, you may want to
|
||||
# add -fPIC to MYCFLAGS.
|
||||
#
|
||||
MYCFLAGS= -O2
|
||||
#MYCFLAGS= -O3 -fomit-frame-pointer # -fPIC
|
||||
|
||||
# Write here any options you may need for your C linker.
|
||||
#MYLDFLAGS=
|
||||
|
||||
# ------------------------------------------------------------------ librarian
|
||||
|
||||
# This should work in all Unix systems.
|
||||
#
|
||||
AR= ar rcu
|
||||
|
||||
# If your system doesn't have (or need) ranlib, use RANLIB=true.
|
||||
# On some systems, "ar s" does what ranlib would do.
|
||||
#
|
||||
RANLIB= ranlib
|
||||
#RANLIB= ar s
|
||||
#RANLIB= true
|
||||
|
||||
# ------------------------------------------------------------------ stripper
|
||||
|
||||
# This should work in all Unix systems, but you may want to add options.
|
||||
#
|
||||
STRIP= strip
|
||||
|
||||
# ------------------------------------------------------------------ install
|
||||
|
||||
# Locations for "make install". You may need to be root do "make install".
|
||||
#
|
||||
INSTALL_ROOT= /usr/local
|
||||
INSTALL_BIN= $(INSTALL_ROOT)/bin
|
||||
INSTALL_INC= $(INSTALL_ROOT)/include
|
||||
INSTALL_LIB= $(INSTALL_ROOT)/lib
|
||||
INSTALL_MAN= $(INSTALL_ROOT)/man/man1
|
||||
|
||||
# You may prefer to use "install" instead of "cp" if you have it.
|
||||
# If you use "install", you may also want to change the permissions after -m.
|
||||
#
|
||||
INSTALL_EXEC= cp
|
||||
INSTALL_DATA= cp
|
||||
#INSTALL_EXEC= install -m 0755
|
||||
#INSTALL_DATA= install -m 0644
|
||||
|
||||
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
|
||||
|
||||
V=5.0
|
||||
|
||||
BIN= $(LUA)/bin
|
||||
INC= $(LUA)/include
|
||||
LIB= $(LUA)/lib
|
||||
|
||||
INCS= -I$(INC) $(EXTRA_INCS)
|
||||
DEFS= $(NUMBER) $(EXTRA_DEFS)
|
||||
|
||||
CFLAGS= $(MYCFLAGS) $(WARN) $(INCS) $(DEFS)
|
||||
|
||||
# (end of config)
|
||||
9
configure
vendored
Normal file
9
configure
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Lua does not use GNU autoconf; just edit ./config if needed to suit your
|
||||
# platform and then run make.
|
||||
|
||||
# This shows the parameters currently set in ./config:
|
||||
make echo
|
||||
|
||||
# If you want config as a Lua program, run "make lecho".
|
||||
123
doc/contents.html
Normal file
123
doc/contents.html
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Lua: 5.0 reference manual - contents</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
|
||||
<HR>
|
||||
<H1>
|
||||
<A HREF="http://www.lua.org/home.html"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A>
|
||||
Reference manual for Lua 5.0
|
||||
</H1>
|
||||
|
||||
<A HREF="manual.html">Lua 5.0 Reference Manual</A>
|
||||
[
|
||||
<A HREF="manual.html">top</A>
|
||||
|
|
||||
<A HREF="http://www.lua.org/ftp/refman-5.0.ps.gz">ps</A>
|
||||
|
|
||||
<A HREF="http://www.lua.org/ftp/refman-5.0.pdf">pdf</A>
|
||||
]
|
||||
<P>
|
||||
|
||||
<SMALL>
|
||||
<A HREF="http://www.lua.org/copyright.html">Copyright</A>
|
||||
© 2003 Tecgraf, PUC-Rio. All rights reserved.</SMALL>
|
||||
<HR>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#1">1 - Introduction</A>
|
||||
<LI><A HREF="manual.html#2">2 - The Language</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.1">2.1 - Lexical Conventions</A>
|
||||
<LI><A HREF="manual.html#2.2">2.2 - Values and Types</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.2.1">2.2.1 - Coercion</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#2.3">2.3 - Variables</A>
|
||||
<LI><A HREF="manual.html#2.4">2.4 - Statements</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.4.1">2.4.1 - Chunks</A>
|
||||
<LI><A HREF="manual.html#2.4.2">2.4.2 - Blocks</A>
|
||||
<LI><A HREF="manual.html#2.4.3">2.4.3 - Assignment</A>
|
||||
<LI><A HREF="manual.html#2.4.4">2.4.4 - Control Structures</A>
|
||||
<LI><A HREF="manual.html#2.4.5">2.4.5 - For Statement</A>
|
||||
<LI><A HREF="manual.html#2.4.6">2.4.6 - Function Calls as Statements</A>
|
||||
<LI><A HREF="manual.html#2.4.7">2.4.7 - Local Declarations</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#2.5">2.5 - Expressions</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.5.1">2.5.1 - Arithmetic Operators</A>
|
||||
<LI><A HREF="manual.html#2.5.2">2.5.2 - Relational Operators</A>
|
||||
<LI><A HREF="manual.html#2.5.3">2.5.3 - Logical Operators</A>
|
||||
<LI><A HREF="manual.html#2.5.4">2.5.4 - Concatenation</A>
|
||||
<LI><A HREF="manual.html#2.5.5">2.5.5 - Precedence</A>
|
||||
<LI><A HREF="manual.html#2.5.6">2.5.6 - Table Constructors</A>
|
||||
<LI><A HREF="manual.html#2.5.7">2.5.7 - Function Calls</A>
|
||||
<LI><A HREF="manual.html#2.5.8">2.5.8 - Function Definitions</A>
|
||||
</UL>
|
||||
</UL>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.6">2.6 - Visibility Rules</A>
|
||||
<LI><A HREF="manual.html#2.7">2.7 - Error Handling</A>
|
||||
<LI><A HREF="manual.html#2.8">2.8 - Metatables</A>
|
||||
<LI><A HREF="manual.html#2.9">2.9 - Garbage Collection</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#2.9.1">2.9.1 - Garbage-Collection Metamethods</A>
|
||||
<LI><A HREF="manual.html#2.9.2">2.9.2 - Weak Tables</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#2.10">2.10 - Coroutines</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#3">3 - The Application Program Interface</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#3.1">3.1 - States</A>
|
||||
<LI><A HREF="manual.html#3.2">3.2 - The Stack and Indices</A>
|
||||
<LI><A HREF="manual.html#3.3">3.3 - Stack Manipulation</A>
|
||||
<LI><A HREF="manual.html#3.4">3.4 - Querying the Stack</A>
|
||||
<LI><A HREF="manual.html#3.5">3.5 - Getting Values from the Stack</A>
|
||||
<LI><A HREF="manual.html#3.6">3.6 - Pushing Values onto the Stack</A>
|
||||
<LI><A HREF="manual.html#3.7">3.7 - Controlling Garbage Collection</A>
|
||||
<LI><A HREF="manual.html#3.8">3.8 - Userdata</A>
|
||||
<LI><A HREF="manual.html#3.9">3.9 - Metatables</A>
|
||||
<LI><A HREF="manual.html#3.10">3.10 - Loading Lua Chunks</A>
|
||||
<LI><A HREF="manual.html#3.11">3.11 - Manipulating Tables</A>
|
||||
<LI><A HREF="manual.html#3.12">3.12 - Manipulating Environments</A>
|
||||
<LI><A HREF="manual.html#3.13">3.13 - Using Tables as Arrays</A>
|
||||
<LI><A HREF="manual.html#3.14">3.14 - Calling Functions</A>
|
||||
<LI><A HREF="manual.html#3.15">3.15 - Protected Calls</A>
|
||||
<LI><A HREF="manual.html#3.16">3.16 - Defining C Functions</A>
|
||||
<LI><A HREF="manual.html#3.17">3.17 - Defining C Closures</A>
|
||||
<LI><A HREF="manual.html#3.18">3.18 - Registry</A>
|
||||
<LI><A HREF="manual.html#3.19">3.19 - Error Handling in C</A>
|
||||
<LI><A HREF="manual.html#3.20">3.20 - Threads</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#4">4 - The Debug Interface</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#4.1">4.1 - Stack and Function Information</A>
|
||||
<LI><A HREF="manual.html#4.2">4.2 - Manipulating Local Variables and Upvalues</A>
|
||||
<LI><A HREF="manual.html#4.3">4.3 - Hooks</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#5">5 - Standard Libraries</A>
|
||||
<UL>
|
||||
<LI><A HREF="manual.html#5.1">5.1 - Basic Functions</A>
|
||||
<LI><A HREF="manual.html#5.2">5.2 - Coroutine Manipulation</A>
|
||||
<LI><A HREF="manual.html#5.3">5.3 - String Manipulation</A>
|
||||
<LI><A HREF="manual.html#5.4">5.4 - Table Manipulation</A>
|
||||
<LI><A HREF="manual.html#5.5">5.5 - Mathematical Functions</A>
|
||||
<LI><A HREF="manual.html#5.6">5.6 - Input and Output Facilities</A>
|
||||
<LI><A HREF="manual.html#5.7">5.7 - Operating System Facilities</A>
|
||||
<LI><A HREF="manual.html#5.8">5.8 - The Reflexive Debug Interface</A>
|
||||
</UL>
|
||||
<LI><A HREF="manual.html#6">6 - Lua Stand-alone</A>
|
||||
<LI><A HREF="manual.html#BNF">The Complete Syntax of Lua</A>
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<SMALL>
|
||||
Last update:
|
||||
Wed May 7 18:34:34 EST 2003
|
||||
</SMALL>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
BIN
doc/logo.gif
Normal file
BIN
doc/logo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
167
doc/lua.1
Normal file
167
doc/lua.1
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
.\" lua.man,v 1.8 2003/04/02 00:05:20 lhf Exp
|
||||
.TH LUA 1 "2003/04/02 00:05:20"
|
||||
.SH NAME
|
||||
lua \- Lua interpreter
|
||||
.SH SYNOPSIS
|
||||
.B lua
|
||||
[
|
||||
.I options
|
||||
]
|
||||
[
|
||||
.I script
|
||||
[
|
||||
.I args
|
||||
]
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.B lua
|
||||
is the stand-alone Lua interpreter.
|
||||
It loads and executes Lua programs,
|
||||
either in textual source form or
|
||||
in precompiled binary form.
|
||||
(Precompiled binaries are output by
|
||||
.BR luac ,
|
||||
the Lua compiler.)
|
||||
.B lua
|
||||
can be used as a batch interpreter and also interactively.
|
||||
.LP
|
||||
The given
|
||||
.I options
|
||||
(see below)
|
||||
are executed and then
|
||||
the Lua program in file
|
||||
.I script
|
||||
is loaded and executed.
|
||||
The given
|
||||
.I args
|
||||
are available to
|
||||
.I script
|
||||
as strings in a global table named
|
||||
.BR arg .
|
||||
If these arguments contain spaces or other characters special to the shell,
|
||||
then they should be quoted
|
||||
(but note that the quotes will be removed by the shell).
|
||||
The arguments in
|
||||
.B arg
|
||||
start at 0,
|
||||
which contains the string
|
||||
.RI ` script '.
|
||||
The index of the last argument is stored in
|
||||
.BR "arg.n" .
|
||||
The arguments given in the command line before
|
||||
.IR script ,
|
||||
including the name of the interpreter,
|
||||
are available in negative indices in
|
||||
.BR arg .
|
||||
.LP
|
||||
At the very start,
|
||||
before even handling the command line,
|
||||
.B lua
|
||||
executes the contents of the environment variable
|
||||
.BR LUA_INIT ,
|
||||
if it is defined.
|
||||
If the value of
|
||||
.B LUA_INIT
|
||||
is of the form
|
||||
.RI `@ filename ',
|
||||
then
|
||||
.I filename
|
||||
is executed.
|
||||
Otherwise, the string is assumed to be a Lua statement and is executed.
|
||||
.LP
|
||||
Options start with
|
||||
.B \-
|
||||
and are described below.
|
||||
You can use
|
||||
.B "\--"
|
||||
to signal the end of options.
|
||||
.LP
|
||||
If no arguments are given,
|
||||
then
|
||||
.B "\-v \-i"
|
||||
is assumed when the standard input is a terminal;
|
||||
otherwise,
|
||||
.B "\-"
|
||||
is assumed.
|
||||
.LP
|
||||
In interactive mode,
|
||||
.B lua
|
||||
prompts the user,
|
||||
reads lines from the standard input,
|
||||
and executes them as they are read.
|
||||
If a line does not contain a complete statement,
|
||||
then a secondary prompt is displayed and
|
||||
lines are read until a complete statement is formed or
|
||||
a syntax error is found.
|
||||
So, one way to interrupt the reading of an incomplete statement is
|
||||
to force a syntax error:
|
||||
adding a
|
||||
.B `;'
|
||||
in the middle of a statement is a sure way of forcing a syntax error
|
||||
(except inside multiline strings and comments; these must be closed explicitly).
|
||||
If a line starts with
|
||||
.BR `=' ,
|
||||
then
|
||||
.B lua
|
||||
displays the values of all the expressions in the remainder of the
|
||||
line. The expressions must be separated by commas.
|
||||
The primary prompt is the value of the global variable
|
||||
.BR _PROMPT ,
|
||||
if this value is a string;
|
||||
otherwise, the default prompt is used.
|
||||
Similarly, the secondary prompt is the value of the global variable
|
||||
.BR _PROMPT2 .
|
||||
So,
|
||||
to change the prompts,
|
||||
set the corresponding variable to a string of your choice.
|
||||
You can do that after calling the interpreter
|
||||
or on the command line with
|
||||
.BR "_PROMPT" "=\'lua: \'" ,
|
||||
for example.
|
||||
(Note the need for quotes, because the string contains a space.)
|
||||
The default prompts are ``> '' and ``>> ''.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-
|
||||
load and execute the standard input as a file,
|
||||
that is,
|
||||
not interactively,
|
||||
even when the standard input is a terminal.
|
||||
.TP
|
||||
.BI \-e " stat"
|
||||
execute statement
|
||||
.IR stat .
|
||||
You need to quote
|
||||
.I stat
|
||||
if it contains spaces, quotes,
|
||||
or other characters special to the shell.
|
||||
.TP
|
||||
.B \-i
|
||||
enter interactive mode after
|
||||
.I script
|
||||
is executed.
|
||||
.TP
|
||||
.BI \-l " file"
|
||||
call
|
||||
.BI require( file )
|
||||
before executing
|
||||
.IR script.
|
||||
Typically used to load libraries
|
||||
(hence the letter
|
||||
.IR l ).
|
||||
.TP
|
||||
.B \-v
|
||||
show version information.
|
||||
.SH "SEE ALSO"
|
||||
.BR luac (1)
|
||||
.br
|
||||
http://www.lua.org/
|
||||
.SH DIAGNOSTICS
|
||||
Error messages should be self explanatory.
|
||||
.SH AUTHORS
|
||||
R. Ierusalimschy,
|
||||
L. H. de Figueiredo,
|
||||
and
|
||||
W. Celes
|
||||
(lua@tecgraf.puc-rio.br)
|
||||
.\" EOF
|
||||
175
doc/lua.html
Normal file
175
doc/lua.html
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
<!-- lua.man,v 1.8 2003/04/02 00:05:20 lhf Exp -->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>LUA man page</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
|
||||
<H1>NAME</H1>
|
||||
lua - Lua interpreter
|
||||
<H1>SYNOPSIS</H1>
|
||||
<B>lua</B>
|
||||
[
|
||||
<I>options</I>
|
||||
]
|
||||
[
|
||||
<I>script</I>
|
||||
[
|
||||
<I>args</I>
|
||||
]
|
||||
]
|
||||
<H1>DESCRIPTION</H1>
|
||||
<B>lua</B>
|
||||
is the stand-alone Lua interpreter.
|
||||
It loads and executes Lua programs,
|
||||
either in textual source form or
|
||||
in precompiled binary form.
|
||||
(Precompiled binaries are output by
|
||||
<B>luac</B>,
|
||||
the Lua compiler.)
|
||||
<B>lua</B>
|
||||
can be used as a batch interpreter and also interactively.
|
||||
<P>
|
||||
The given
|
||||
<I>options</I>
|
||||
(see below)
|
||||
are executed and then
|
||||
the Lua program in file
|
||||
<I>script</I>
|
||||
is loaded and executed.
|
||||
The given
|
||||
<I>args</I>
|
||||
are available to
|
||||
<I>script</I>
|
||||
as strings in a global table named
|
||||
<B>arg</B>.
|
||||
If these arguments contain spaces or other characters special to the shell,
|
||||
then they should be quoted
|
||||
(but note that the quotes will be removed by the shell).
|
||||
The arguments in
|
||||
<B>arg</B>
|
||||
start at 0,
|
||||
which contains the string
|
||||
`<I>script</I>'.
|
||||
The index of the last argument is stored in
|
||||
<B>"arg.n"</B>.
|
||||
The arguments given in the command line before
|
||||
<I>script</I>,
|
||||
including the name of the interpreter,
|
||||
are available in negative indices in
|
||||
<B>arg</B>.
|
||||
<P>
|
||||
At the very start,
|
||||
before even handling the command line,
|
||||
<B>lua</B>
|
||||
executes the contents of the environment variable
|
||||
<B>LUA_INIT</B>,
|
||||
if it is defined.
|
||||
If the value of
|
||||
<B>LUA_INIT</B>
|
||||
is of the form
|
||||
`@<I>filename</I>',
|
||||
then
|
||||
<I>filename</I>
|
||||
is executed.
|
||||
Otherwise, the string is assumed to be a Lua statement and is executed.
|
||||
<P>
|
||||
Options start with
|
||||
<B>-</B>
|
||||
and are described below.
|
||||
You can use
|
||||
<B>"--"</B>
|
||||
to signal the end of options.
|
||||
<P>
|
||||
If no arguments are given,
|
||||
then
|
||||
<B>"-v -i"</B>
|
||||
is assumed when the standard input is a terminal;
|
||||
otherwise,
|
||||
<B>"-"</B>
|
||||
is assumed.
|
||||
<P>
|
||||
In interactive mode,
|
||||
<B>lua</B>
|
||||
prompts the user,
|
||||
reads lines from the standard input,
|
||||
and executes them as they are read.
|
||||
If a line does not contain a complete statement,
|
||||
then a secondary prompt is displayed and
|
||||
lines are read until a complete statement is formed or
|
||||
a syntax error is found.
|
||||
So, one way to interrupt the reading of an incomplete statement is
|
||||
to force a syntax error:
|
||||
adding a
|
||||
<B>`;' </B>
|
||||
in the middle of a statement is a sure way of forcing a syntax error
|
||||
(except inside multiline strings and comments; these must be closed explicitly).
|
||||
If a line starts with
|
||||
<B>`='</B>,
|
||||
then
|
||||
<B>lua</B>
|
||||
displays the values of all the expressions in the remainder of the
|
||||
line. The expressions must be separated by commas.
|
||||
The primary prompt is the value of the global variable
|
||||
<B>_PROMPT</B>,
|
||||
if this value is a string;
|
||||
otherwise, the default prompt is used.
|
||||
Similarly, the secondary prompt is the value of the global variable
|
||||
<B>_PROMPT2</B>.
|
||||
So,
|
||||
to change the prompts,
|
||||
set the corresponding variable to a string of your choice.
|
||||
You can do that after calling the interpreter
|
||||
or on the command line with
|
||||
<B>"_PROMPT" "=\'lua: \'"</B>,
|
||||
for example.
|
||||
(Note the need for quotes, because the string contains a space.)
|
||||
The default prompts are ``> '' and ``>> ''.
|
||||
<H1>OPTIONS</H1>
|
||||
<P>
|
||||
<B>-</B>
|
||||
load and execute the standard input as a file,
|
||||
that is,
|
||||
not interactively,
|
||||
even when the standard input is a terminal.
|
||||
<P>
|
||||
<B>-e "</B><I>stat"</I>
|
||||
execute statement
|
||||
<I>stat</I>.
|
||||
You need to quote
|
||||
<I>stat </I>
|
||||
if it contains spaces, quotes,
|
||||
or other characters special to the shell.
|
||||
<P>
|
||||
<B>-i</B>
|
||||
enter interactive mode after
|
||||
<I>script</I>
|
||||
is executed.
|
||||
<P>
|
||||
<B>-l "</B><I>file"</I>
|
||||
call
|
||||
<B>require( file</B><I>)</I>
|
||||
before executing
|
||||
<I></I>script.
|
||||
Typically used to load libraries
|
||||
(hence the letter
|
||||
<I>l</I>).
|
||||
<P>
|
||||
<B>-v</B>
|
||||
show version information.
|
||||
<H1>SEE ALSO</H1>
|
||||
<B>luac</B>(1)
|
||||
<BR>
|
||||
<A HREF="http://www.lua.org/">http://www.lua.org/</A>
|
||||
<H1>DIAGNOSTICS</H1>
|
||||
Error messages should be self explanatory.
|
||||
<H1>AUTHORS</H1>
|
||||
R. Ierusalimschy,
|
||||
L. H. de Figueiredo,
|
||||
and
|
||||
W. Celes
|
||||
(<A HREF="mailto:lua-NO-SPAM-THANKS@tecgraf.puc-rio.br">lua AT tecgraf.puc-rio.br</A>)
|
||||
<!-- EOF -->
|
||||
</BODY>
|
||||
</HTML>
|
||||
136
doc/luac.1
Normal file
136
doc/luac.1
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
.\" luac.man,v 1.25 2002/12/13 11:45:12 lhf Exp
|
||||
.TH LUAC 1 "2002/12/13 11:45:12"
|
||||
.SH NAME
|
||||
luac \- Lua compiler
|
||||
.SH SYNOPSIS
|
||||
.B luac
|
||||
[
|
||||
.I options
|
||||
] [
|
||||
.I filenames
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.B luac
|
||||
is the Lua compiler.
|
||||
It translates programs written in the Lua programming language
|
||||
into binary files that can be latter loaded and executed.
|
||||
.LP
|
||||
The main advantages of precompiling chunks are:
|
||||
faster loading,
|
||||
protecting source code from user changes,
|
||||
and
|
||||
off-line syntax checking.
|
||||
.LP
|
||||
Pre-compiling does not imply faster execution
|
||||
because in Lua chunks are always compiled into bytecodes before being executed.
|
||||
.B luac
|
||||
simply allows those bytecodes to be saved in a file for later execution.
|
||||
.LP
|
||||
.B luac
|
||||
produces a single output file containing the bytecodes
|
||||
for all source files given.
|
||||
By default,
|
||||
the output file is named
|
||||
.BR luac.out ,
|
||||
but you can change this with the
|
||||
.B \-o
|
||||
option.
|
||||
.LP
|
||||
The binary files created by
|
||||
.B luac
|
||||
are portable to all architectures with the same word size.
|
||||
This means that
|
||||
binary files created on a 32-bit platform (such as Intel)
|
||||
can be read without change in another 32-bit platform (such as Sparc),
|
||||
even if the byte order (``endianness'') is different.
|
||||
On the other hand,
|
||||
binary files created on a 16-bit platform cannot be read in a 32-bit platform,
|
||||
nor vice-versa.
|
||||
.LP
|
||||
In the command line,
|
||||
you can mix
|
||||
text files containing Lua source and
|
||||
binary files containing precompiled chunks.
|
||||
This is useful to combine several precompiled chunks,
|
||||
even from different (but compatible) platforms,
|
||||
into a single precompiled chunk.
|
||||
.LP
|
||||
You can use
|
||||
.B "\-"
|
||||
to indicate the standard input as a source file
|
||||
and
|
||||
.B "\--"
|
||||
to signal the end of options
|
||||
(that is,
|
||||
all remaining arguments will be treated as files even if they start with
|
||||
.BR "\-" ).
|
||||
.LP
|
||||
The internal format of the binary files produced by
|
||||
.B luac
|
||||
is likely to change when a new version of Lua is released.
|
||||
So,
|
||||
save the source files of all Lua programs that you precompile.
|
||||
.LP
|
||||
.SH OPTIONS
|
||||
Options must be separate.
|
||||
.TP
|
||||
.B \-l
|
||||
produce a listing of the compiled bytecode for Lua's virtual machine.
|
||||
Listing bytecodes is useful to learn about Lua's virtual machine.
|
||||
If no files are given, then
|
||||
.B luac
|
||||
loads
|
||||
.B luac.out
|
||||
and lists its contents.
|
||||
.TP
|
||||
.BI \-o " file"
|
||||
output to
|
||||
.IR file ,
|
||||
instead of the default
|
||||
.BR luac.out .
|
||||
The output file may be a source file because
|
||||
all files are loaded before the output file is written.
|
||||
Be careful not to overwrite precious files.
|
||||
.TP
|
||||
.B \-p
|
||||
load files but do not generate any output file.
|
||||
Used mainly for syntax checking and for testing precompiled chunks:
|
||||
corrupted files will probably generate errors when loaded.
|
||||
Lua always performs a thorough integrity test on precompiled chunks.
|
||||
Bytecode that passes this test is completely safe,
|
||||
in the sense that it will not break the interpreter.
|
||||
However,
|
||||
there is no guarantee that such code does anything sensible.
|
||||
(None can be given, because the halting problem is unsolvable.)
|
||||
If no files are given, then
|
||||
.B luac
|
||||
loads
|
||||
.B luac.out
|
||||
and tests its contents.
|
||||
No messages are displayed if the file passes the integrity test.
|
||||
.TP
|
||||
.B \-s
|
||||
strip debug information before writing the output file.
|
||||
This saves some space in very large chunks,
|
||||
but if errors occur when running these chunks,
|
||||
then the error messages may not contain the full information they usually do
|
||||
(line numbers and names of locals are lost).
|
||||
.TP
|
||||
.B \-v
|
||||
show version information.
|
||||
.SH FILES
|
||||
.TP 15
|
||||
.B luac.out
|
||||
default output file
|
||||
.SH "SEE ALSO"
|
||||
.BR lua (1)
|
||||
.br
|
||||
http://www.lua.org/
|
||||
.SH DIAGNOSTICS
|
||||
Error messages should be self explanatory.
|
||||
.SH AUTHORS
|
||||
L. H. de Figueiredo,
|
||||
R. Ierusalimschy and
|
||||
W. Celes
|
||||
(lua@tecgraf.puc-rio.br)
|
||||
.\" EOF
|
||||
144
doc/luac.html
Normal file
144
doc/luac.html
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
<!-- luac.man,v 1.25 2002/12/13 11:45:12 lhf Exp -->
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>LUAC man page</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
|
||||
<H1>NAME</H1>
|
||||
luac - Lua compiler
|
||||
<H1>SYNOPSIS</H1>
|
||||
<B>luac</B>
|
||||
[
|
||||
<I>options</I>
|
||||
] [
|
||||
<I>filenames</I>
|
||||
]
|
||||
<H1>DESCRIPTION</H1>
|
||||
<B>luac</B>
|
||||
is the Lua compiler.
|
||||
It translates programs written in the Lua programming language
|
||||
into binary files that can be latter loaded and executed.
|
||||
<P>
|
||||
The main advantages of precompiling chunks are:
|
||||
faster loading,
|
||||
protecting source code from user changes,
|
||||
and
|
||||
off-line syntax checking.
|
||||
<P>
|
||||
Pre-compiling does not imply faster execution
|
||||
because in Lua chunks are always compiled into bytecodes before being executed.
|
||||
<B>luac</B>
|
||||
simply allows those bytecodes to be saved in a file for later execution.
|
||||
<P>
|
||||
<B>luac</B>
|
||||
produces a single output file containing the bytecodes
|
||||
for all source files given.
|
||||
By default,
|
||||
the output file is named
|
||||
<B>luac.out</B>,
|
||||
but you can change this with the
|
||||
<B>-o</B>
|
||||
option.
|
||||
<P>
|
||||
The binary files created by
|
||||
<B>luac</B>
|
||||
are portable to all architectures with the same word size.
|
||||
This means that
|
||||
binary files created on a 32-bit platform (such as Intel)
|
||||
can be read without change in another 32-bit platform (such as Sparc),
|
||||
even if the byte order (``endianness'') is different.
|
||||
On the other hand,
|
||||
binary files created on a 16-bit platform cannot be read in a 32-bit platform,
|
||||
nor vice-versa.
|
||||
<P>
|
||||
In the command line,
|
||||
you can mix
|
||||
text files containing Lua source and
|
||||
binary files containing precompiled chunks.
|
||||
This is useful to combine several precompiled chunks,
|
||||
even from different (but compatible) platforms,
|
||||
into a single precompiled chunk.
|
||||
<P>
|
||||
You can use
|
||||
<B>"-"</B>
|
||||
to indicate the standard input as a source file
|
||||
and
|
||||
<B>"--"</B>
|
||||
to signal the end of options
|
||||
(that is,
|
||||
all remaining arguments will be treated as files even if they start with
|
||||
<B>"-"</B>).
|
||||
<P>
|
||||
The internal format of the binary files produced by
|
||||
<B>luac</B>
|
||||
is likely to change when a new version of Lua is released.
|
||||
So,
|
||||
save the source files of all Lua programs that you precompile.
|
||||
<P>
|
||||
<H1>OPTIONS</H1>
|
||||
Options must be separate.
|
||||
<P>
|
||||
<B>-l</B>
|
||||
produce a listing of the compiled bytecode for Lua's virtual machine.
|
||||
Listing bytecodes is useful to learn about Lua's virtual machine.
|
||||
If no files are given, then
|
||||
<B>luac</B>
|
||||
loads
|
||||
<B>luac.out</B>
|
||||
and lists its contents.
|
||||
<P>
|
||||
<B>-o "</B><I>file"</I>
|
||||
output to
|
||||
<I>file</I>,
|
||||
instead of the default
|
||||
<B>luac.out</B>.
|
||||
The output file may be a source file because
|
||||
all files are loaded before the output file is written.
|
||||
Be careful not to overwrite precious files.
|
||||
<P>
|
||||
<B>-p</B>
|
||||
load files but do not generate any output file.
|
||||
Used mainly for syntax checking and for testing precompiled chunks:
|
||||
corrupted files will probably generate errors when loaded.
|
||||
Lua always performs a thorough integrity test on precompiled chunks.
|
||||
Bytecode that passes this test is completely safe,
|
||||
in the sense that it will not break the interpreter.
|
||||
However,
|
||||
there is no guarantee that such code does anything sensible.
|
||||
(None can be given, because the halting problem is unsolvable.)
|
||||
If no files are given, then
|
||||
<B>luac</B>
|
||||
loads
|
||||
<B>luac.out</B>
|
||||
and tests its contents.
|
||||
No messages are displayed if the file passes the integrity test.
|
||||
<P>
|
||||
<B>-s</B>
|
||||
strip debug information before writing the output file.
|
||||
This saves some space in very large chunks,
|
||||
but if errors occur when running these chunks,
|
||||
then the error messages may not contain the full information they usually do
|
||||
(line numbers and names of locals are lost).
|
||||
<P>
|
||||
<B>-v</B>
|
||||
show version information.
|
||||
<H1>FILES</H1>
|
||||
<P>
|
||||
<B>luac.out</B>
|
||||
default output file
|
||||
<H1>SEE ALSO</H1>
|
||||
<B>lua</B>(1)
|
||||
<BR>
|
||||
<A HREF="http://www.lua.org/">http://www.lua.org/</A>
|
||||
<H1>DIAGNOSTICS</H1>
|
||||
Error messages should be self explanatory.
|
||||
<H1>AUTHORS</H1>
|
||||
L. H. de Figueiredo,
|
||||
R. Ierusalimschy and
|
||||
W. Celes
|
||||
(<A HREF="mailto:lua-NO-SPAM-THANKS@tecgraf.puc-rio.br">lua AT tecgraf.puc-rio.br</A>)
|
||||
<!-- EOF -->
|
||||
</BODY>
|
||||
</HTML>
|
||||
4612
doc/manual.html
Normal file
4612
doc/manual.html
Normal file
File diff suppressed because it is too large
Load diff
35
doc/readme.html
Normal file
35
doc/readme.html
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Lua documentation</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY BGCOLOR="#FFFFFF">
|
||||
|
||||
<HR>
|
||||
<H1>
|
||||
<A HREF="http://www.lua.org/"><IMG SRC="logo.gif" ALT="Lua" BORDER=0></A>
|
||||
Documentation
|
||||
</H1>
|
||||
|
||||
<UL>
|
||||
<LI><A HREF="http://www.lua.org/">Official web site</A>
|
||||
<LI><A HREF="contents.html">Reference manual</A>
|
||||
<LI><A HREF="lua.html">lua man page</A>
|
||||
<LI><A HREF="luac.html">luac man page</A>
|
||||
<LI><A HREF="../README">lua/README</A>
|
||||
<LI><A HREF="../src/README">lua/src/README</A>
|
||||
<LI><A HREF="../src/lib/README">lua/src/lib/README</A>
|
||||
<LI><A HREF="../src/lua/README">lua/src/lua/README</A>
|
||||
<LI><A HREF="../src/luac/README">lua/src/luac/README</A>
|
||||
<LI><A HREF="../etc/README">lua/etc/README</A>
|
||||
<LI><A HREF="../test/README">lua/test/README</A>
|
||||
</UL>
|
||||
|
||||
<HR>
|
||||
<SMALL>
|
||||
Last update:
|
||||
Thu Mar 11 23:08:56 BRT 2004
|
||||
</SMALL>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
42
etc/Makefile
Normal file
42
etc/Makefile
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# makefile for Lua etc
|
||||
|
||||
LUA= ..
|
||||
|
||||
include $(LUA)/config
|
||||
|
||||
LIBLUA=$(LIB)/liblua.a
|
||||
ALL= bin2c min trace noparser luab
|
||||
|
||||
all:
|
||||
@echo 'choose a target:' $(ALL)
|
||||
|
||||
bin2c: bin2c.c
|
||||
$(CC) $(CFLAGS) -o $@ $@.c
|
||||
|
||||
min: min.c $(LIBLUA)
|
||||
$(CC) $(CFLAGS) -o $@ $@.c -L$(LIB) -llua
|
||||
|
||||
trace: trace.c $(LIBLUA)
|
||||
$(CC) -g $(CFLAGS) -o $@ $@.c -L$(LIB) -llua -llualib $(EXTRA_LIBS)
|
||||
|
||||
noparser: noparser.c
|
||||
$(CC) $(CFLAGS) -I$(LUA)/src -o $@.o -c $@.c
|
||||
|
||||
luab: noparser $(LIBLUA)
|
||||
cc -o $@ noparser.o $(LUA)/src/lua/lua.o -L$(LIB) -llua -llualib $(EXTRA_LIBS)
|
||||
$(BIN)/luac $(LUA)/test/hello.lua
|
||||
$@ luac.out
|
||||
-$@ -e'a=1'
|
||||
|
||||
flat:
|
||||
cd ..; mkdir flat; mv include/*.h src/*.[ch] src/*/*.[ch] flat
|
||||
|
||||
$(LIBLUA):
|
||||
cd ../src; $(MAKE)
|
||||
|
||||
clean:
|
||||
rm -f $(ALL) a.out core *.o luac.out
|
||||
|
||||
luser_tests.h: RCS/ltests.h,v
|
||||
co -q -M ltests.h
|
||||
mv -f ltests.h $@
|
||||
54
etc/README
Normal file
54
etc/README
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
This directory contains some useful files and code.
|
||||
Unlike the code in ../src, everything here is in the public domain.
|
||||
|
||||
bin2c.c
|
||||
This program converts files to byte arrays that are automatically run
|
||||
with lua_dobuffer. This allows C programs to include all necessary Lua
|
||||
code, even in precompiled form. Even if the code is included in source
|
||||
form, bin2c is useful because it avoids the hassle of having to quote
|
||||
special characters in C strings.
|
||||
Example of usage: Run bin2c file1 file2 ... > init.h. Then, in your
|
||||
C program, just do #include "init.h" anywhere in the *body* of a
|
||||
function. This will be equivalent to calling
|
||||
lua_dofile(L,"file1"); lua_dofile(L,"file2"); ...
|
||||
Note that the Lua state is called "L". If you use a different name,
|
||||
say "mystate", just #define L mystate before you #include "init.h".
|
||||
|
||||
compat.lua
|
||||
A compatibility module for Lua 4.0 functions.
|
||||
|
||||
doall.lua
|
||||
Emulate the command line behaviour of Lua 4.0
|
||||
|
||||
lua.ico
|
||||
A Lua icon for Windows.
|
||||
Drawn by hand by Markus Gritsch <gritsch@iue.tuwien.ac.at>.
|
||||
|
||||
lua.magic
|
||||
Data for teaching file(1) about Lua precompiled chunks.
|
||||
|
||||
lua.xpm
|
||||
The same icon as lua.ico, but in XPM format.
|
||||
It was converted with ImageMagick by Andy Tai <andy@exp.com>.
|
||||
|
||||
luser_number.h
|
||||
Number type configuration for Lua core.
|
||||
|
||||
luser_tests.h
|
||||
Self-test configuration for Lua core.
|
||||
|
||||
min.c
|
||||
A minimal Lua interpreter.
|
||||
Good for learning and for starting your own.
|
||||
|
||||
noparser.c
|
||||
Linking with noparser.o avoids loading the parsing modules in lualib.a.
|
||||
Do "make luab" to build a sample Lua intepreter that does not parse
|
||||
Lua programs, only loads precompiled programs.
|
||||
|
||||
saconfig.c
|
||||
Configuration for Lua interpreter.
|
||||
|
||||
trace.c
|
||||
A simple execution tracer.
|
||||
An example of how to use the debug hooks in C.
|
||||
67
etc/bin2c.c
Normal file
67
etc/bin2c.c
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* bin2c.c
|
||||
* convert files to byte arrays for automatic loading with lua_dobuffer
|
||||
* Luiz Henrique de Figueiredo (lhf@tecgraf.puc-rio.br)
|
||||
* 02 Apr 2003 20:44:31
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void dump(FILE* f, int n)
|
||||
{
|
||||
printf("static const unsigned char B%d[]={\n",n);
|
||||
for (n=1;;n++)
|
||||
{
|
||||
int c=getc(f);
|
||||
if (c==EOF) break;
|
||||
printf("%3u,",c);
|
||||
if (n==20) { putchar('\n'); n=0; }
|
||||
}
|
||||
printf("\n};\n\n");
|
||||
}
|
||||
|
||||
static void fdump(const char* fn, int n)
|
||||
{
|
||||
FILE* f= fopen(fn,"rb"); /* must open in binary mode */
|
||||
if (f==NULL)
|
||||
{
|
||||
fprintf(stderr,"bin2c: cannot open ");
|
||||
perror(fn);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("/* %s */\n",fn);
|
||||
dump(f,n);
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
static void emit(const char* fn, int n)
|
||||
{
|
||||
printf(" lua_dobuffer(L,(const char*)B%d,sizeof(B%d),\"%s\");\n",n,n,fn);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
printf("/* code automatically generated by bin2c -- DO NOT EDIT */\n");
|
||||
printf("{\n");
|
||||
if (argc<2)
|
||||
{
|
||||
dump(stdin,0);
|
||||
emit("=stdin",0);
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
printf("/* #include'ing this file in a C program is equivalent to calling\n");
|
||||
for (i=1; i<argc; i++) printf(" lua_dofile(L,\"%s\");\n",argv[i]);
|
||||
printf("*/\n");
|
||||
for (i=1; i<argc; i++) fdump(argv[i],i);
|
||||
for (i=1; i<argc; i++) emit(argv[i],i);
|
||||
}
|
||||
printf("}\n");
|
||||
return 0;
|
||||
}
|
||||
192
etc/compat.lua
Normal file
192
etc/compat.lua
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
-------------------------------------------------------------------
|
||||
-- Real globals
|
||||
-- _ALERT
|
||||
-- _ERRORMESSAGE
|
||||
-- _VERSION
|
||||
-- _G
|
||||
-- assert
|
||||
-- error
|
||||
-- metatable
|
||||
-- next
|
||||
-- print
|
||||
-- require
|
||||
-- tonumber
|
||||
-- tostring
|
||||
-- type
|
||||
-- unpack
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- collectgarbage
|
||||
-- gcinfo
|
||||
|
||||
-- globals
|
||||
|
||||
-- call -> protect(f, err)
|
||||
-- loadfile
|
||||
-- loadstring
|
||||
|
||||
-- rawget
|
||||
-- rawset
|
||||
|
||||
-- getargs = Main.getargs ??
|
||||
|
||||
|
||||
function do_ (f, err)
|
||||
if not f then print(err); return end
|
||||
local a,b = pcall(f)
|
||||
if not a then print(b); return nil
|
||||
else return b or true
|
||||
end
|
||||
end
|
||||
|
||||
function dostring(s) return do_(loadstring(s)) end
|
||||
-- function dofile(s) return do_(loadfile(s)) end
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Table library
|
||||
local tab = table
|
||||
foreach = tab.foreach
|
||||
foreachi = tab.foreachi
|
||||
getn = tab.getn
|
||||
tinsert = tab.insert
|
||||
tremove = tab.remove
|
||||
sort = tab.sort
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- Debug library
|
||||
local dbg = debug
|
||||
getinfo = dbg.getinfo
|
||||
getlocal = dbg.getlocal
|
||||
setcallhook = function () error"`setcallhook' is deprecated" end
|
||||
setlinehook = function () error"`setlinehook' is deprecated" end
|
||||
setlocal = dbg.setlocal
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- math library
|
||||
local math = math
|
||||
abs = math.abs
|
||||
acos = function (x) return math.deg(math.acos(x)) end
|
||||
asin = function (x) return math.deg(math.asin(x)) end
|
||||
atan = function (x) return math.deg(math.atan(x)) end
|
||||
atan2 = function (x,y) return math.deg(math.atan2(x,y)) end
|
||||
ceil = math.ceil
|
||||
cos = function (x) return math.cos(math.rad(x)) end
|
||||
deg = math.deg
|
||||
exp = math.exp
|
||||
floor = math.floor
|
||||
frexp = math.frexp
|
||||
ldexp = math.ldexp
|
||||
log = math.log
|
||||
log10 = math.log10
|
||||
max = math.max
|
||||
min = math.min
|
||||
mod = math.mod
|
||||
PI = math.pi
|
||||
--??? pow = math.pow
|
||||
rad = math.rad
|
||||
random = math.random
|
||||
randomseed = math.randomseed
|
||||
sin = function (x) return math.sin(math.rad(x)) end
|
||||
sqrt = math.sqrt
|
||||
tan = function (x) return math.tan(math.rad(x)) end
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- string library
|
||||
local str = string
|
||||
strbyte = str.byte
|
||||
strchar = str.char
|
||||
strfind = str.find
|
||||
format = str.format
|
||||
gsub = str.gsub
|
||||
strlen = str.len
|
||||
strlower = str.lower
|
||||
strrep = str.rep
|
||||
strsub = str.sub
|
||||
strupper = str.upper
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- os library
|
||||
clock = os.clock
|
||||
date = os.date
|
||||
difftime = os.difftime
|
||||
execute = os.execute --?
|
||||
exit = os.exit
|
||||
getenv = os.getenv
|
||||
remove = os.remove
|
||||
rename = os.rename
|
||||
setlocale = os.setlocale
|
||||
time = os.time
|
||||
tmpname = os.tmpname
|
||||
|
||||
-------------------------------------------------------------------
|
||||
-- compatibility only
|
||||
getglobal = function (n) return _G[n] end
|
||||
setglobal = function (n,v) _G[n] = v end
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
local io, tab = io, table
|
||||
|
||||
-- IO library (files)
|
||||
_STDIN = io.stdin
|
||||
_STDERR = io.stderr
|
||||
_STDOUT = io.stdout
|
||||
_INPUT = io.stdin
|
||||
_OUTPUT = io.stdout
|
||||
seek = io.stdin.seek -- sick ;-)
|
||||
tmpfile = io.tmpfile
|
||||
closefile = io.close
|
||||
openfile = io.open
|
||||
|
||||
function flush (f)
|
||||
if f then f:flush()
|
||||
else _OUTPUT:flush()
|
||||
end
|
||||
end
|
||||
|
||||
function readfrom (name)
|
||||
if name == nil then
|
||||
local f, err, cod = io.close(_INPUT)
|
||||
_INPUT = io.stdin
|
||||
return f, err, cod
|
||||
else
|
||||
local f, err, cod = io.open(name, "r")
|
||||
_INPUT = f or _INPUT
|
||||
return f, err, cod
|
||||
end
|
||||
end
|
||||
|
||||
function writeto (name)
|
||||
if name == nil then
|
||||
local f, err, cod = io.close(_OUTPUT)
|
||||
_OUTPUT = io.stdout
|
||||
return f, err, cod
|
||||
else
|
||||
local f, err, cod = io.open(name, "w")
|
||||
_OUTPUT = f or _OUTPUT
|
||||
return f, err, cod
|
||||
end
|
||||
end
|
||||
|
||||
function appendto (name)
|
||||
local f, err, cod = io.open(name, "a")
|
||||
_OUTPUT = f or _OUTPUT
|
||||
return f, err, cod
|
||||
end
|
||||
|
||||
function read (...)
|
||||
local f = _INPUT
|
||||
if type(arg[1]) == 'userdata' then
|
||||
f = tab.remove(arg, 1)
|
||||
end
|
||||
return f:read(unpack(arg))
|
||||
end
|
||||
|
||||
function write (...)
|
||||
local f = _OUTPUT
|
||||
if type(arg[1]) == 'userdata' then
|
||||
f = tab.remove(arg, 1)
|
||||
end
|
||||
return f:write(unpack(arg))
|
||||
end
|
||||
|
||||
6
etc/doall.lua
Normal file
6
etc/doall.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
-- emulate the command line behaviour of Lua 4.0
|
||||
-- usage: lua doall.lua f1.lua f2.lua f3.lua ...
|
||||
|
||||
for i=1,table.getn(arg) do
|
||||
dofile(arg[i])
|
||||
end
|
||||
BIN
etc/lua.ico
Normal file
BIN
etc/lua.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
12
etc/lua.magic
Normal file
12
etc/lua.magic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
# Lua precompiled files. Versions 2.3 and 4.1 were never officially released.
|
||||
0 string \33Lua precompiled chunk for Lua
|
||||
>4 byte 0x23 2.3*
|
||||
>4 byte 0x24 2.4
|
||||
>4 byte 0x25 2.5
|
||||
>4 byte 0x30 3.0
|
||||
>4 byte 0x31 3.1
|
||||
>4 byte 0x32 3.2
|
||||
>4 byte 0x40 4.0
|
||||
>4 byte 0x41 4.1*
|
||||
>4 byte 0x50 5.0
|
||||
44
etc/lua.xpm
Normal file
44
etc/lua.xpm
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/* XPM */
|
||||
static char *magick[] = {
|
||||
/* columns rows colors chars-per-pixel */
|
||||
"32 32 6 1",
|
||||
" c Gray0",
|
||||
". c #000000008080",
|
||||
"X c #808080808080",
|
||||
"o c #c0c0c0c0c0c0",
|
||||
"O c Gray100",
|
||||
"+ c None",
|
||||
/* pixels */
|
||||
"++++++++++++++++++++++++++ooo+++",
|
||||
"++++++++++++++++++++++++oX...Xo+",
|
||||
"++++++++++++++++++++++++X.....X+",
|
||||
"+++++++++++++++++++++++o.......o",
|
||||
"+++++++++XX......XX++++o.......o",
|
||||
"+++++++X............X++o.......o",
|
||||
"+++++o................o+X.....X+",
|
||||
"++++X..................XoX...Xo+",
|
||||
"+++X..............XXX...X+ooo+++",
|
||||
"++o.............XoOOOoX..o++++++",
|
||||
"++..............oOOOOOo...++++++",
|
||||
"+X.............XOOOOOOOX..X+++++",
|
||||
"+..............XOOOOOOOX...+++++",
|
||||
"X..............XOOOOOOOX...X++++",
|
||||
"X...............oOOOOOo....X++++",
|
||||
"................XoOOOoX.....++++",
|
||||
"....XO............XXX.......++++",
|
||||
"....XO......................++++",
|
||||
"....XO.....OX..OX.XOOOo.....++++",
|
||||
"....XO.....OX..OX.OoXXOX....++++",
|
||||
"....XO.....OX..OX....XOX....++++",
|
||||
"X...XO.....OX..OX..OOoOX...X++++",
|
||||
"X...XO.....OX..OX.OX..OX...X++++",
|
||||
"+...XOXXXX.OoXoOX.OXXXOX...+++++",
|
||||
"+X..XOOOOO.XOOXOX.XOOOXo..X+++++",
|
||||
"++........................++++++",
|
||||
"++o......................o++++++",
|
||||
"+++X....................X+++++++",
|
||||
"++++X..................X++++++++",
|
||||
"+++++o................o+++++++++",
|
||||
"+++++++X............X+++++++++++",
|
||||
"+++++++++XX......XX+++++++++++++"
|
||||
};
|
||||
34
etc/luser_number.h
Normal file
34
etc/luser_number.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/* luser_number.h -- number type configuration for Lua core
|
||||
*
|
||||
* #define LUA_USER_H to this file and #define one of USE_* below
|
||||
*/
|
||||
|
||||
#ifdef USE_DOUBLE
|
||||
#define LUA_NUMBER double
|
||||
#define LUA_NUMBER_SCAN "%lf"
|
||||
#define LUA_NUMBER_FMT "%.14g"
|
||||
#endif
|
||||
|
||||
#ifdef USE_FLOAT
|
||||
#define LUA_NUMBER float
|
||||
#define LUA_NUMBER_SCAN "%f"
|
||||
#define LUA_NUMBER_FMT "%.5g"
|
||||
#endif
|
||||
|
||||
#ifdef USE_LONG
|
||||
#define LUA_NUMBER long
|
||||
#define LUA_NUMBER_SCAN "%ld"
|
||||
#define LUA_NUMBER_FMT "%ld"
|
||||
#define lua_str2number(s,p) strtol((s), (p), 10)
|
||||
#endif
|
||||
|
||||
#ifdef USE_INT
|
||||
#define LUA_NUMBER int
|
||||
#define LUA_NUMBER_SCAN "%d"
|
||||
#define LUA_NUMBER_FMT "%d"
|
||||
#define lua_str2number(s,p) ((int) strtol((s), (p), 10))
|
||||
#endif
|
||||
|
||||
#ifdef USE_FASTROUND
|
||||
#define lua_number2int(i,d) __asm__("fldl %1\nfistpl %0":"=m"(i):"m"(d))
|
||||
#endif
|
||||
68
etc/luser_tests.h
Normal file
68
etc/luser_tests.h
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
** $Id: ltests.h,v 1.20 2002/12/04 17:29:05 roberto Exp $
|
||||
** Internal Header for Debugging of the Lua Implementation
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
#ifndef ltests_h
|
||||
#define ltests_h
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#define LUA_DEBUG
|
||||
|
||||
#define LUA_OPNAMES
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#define lua_assert(c) assert(c)
|
||||
#define check_exp(c,e) (lua_assert(c), (e))
|
||||
#define api_check(L, o) lua_assert(o)
|
||||
|
||||
|
||||
/* to avoid warnings, and to make sure value is really unused */
|
||||
#define UNUSED(x) (x=0, (void)(x))
|
||||
|
||||
|
||||
/* memory allocator control variables */
|
||||
extern unsigned long memdebug_numblocks;
|
||||
extern unsigned long memdebug_total;
|
||||
extern unsigned long memdebug_maxmem;
|
||||
extern unsigned long memdebug_memlimit;
|
||||
|
||||
|
||||
#define l_realloc(b, os, s) debug_realloc(b, os, s)
|
||||
#define l_free(b, os) debug_realloc(b, os, 0)
|
||||
|
||||
void *debug_realloc (void *block, size_t oldsize, size_t size);
|
||||
|
||||
|
||||
|
||||
/* test for lock/unlock */
|
||||
extern int islocked;
|
||||
#define LUA_USERSTATE int *
|
||||
#define getlock(l) (*(cast(LUA_USERSTATE *, l) - 1))
|
||||
#define lua_userstateopen(l) if (l != NULL) getlock(l) = &islocked;
|
||||
#define lua_lock(l) lua_assert((*getlock(l))++ == 0)
|
||||
#define lua_unlock(l) lua_assert(--(*getlock(l)) == 0)
|
||||
|
||||
|
||||
int luaB_opentests (lua_State *L);
|
||||
|
||||
#define LUA_EXTRALIBS { "tests", luaB_opentests },
|
||||
|
||||
|
||||
/* real main will be defined at `ltests.c' */
|
||||
int l_main (int argc, char *argv[]);
|
||||
#define main l_main
|
||||
|
||||
|
||||
|
||||
/* change some sizes to give some bugs a chance */
|
||||
|
||||
#define LUAL_BUFFERSIZE 27
|
||||
#define MINSTRTABSIZE 2
|
||||
|
||||
#endif
|
||||
46
etc/min.c
Normal file
46
etc/min.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* min.c -- a minimal Lua interpreter
|
||||
* loads stdin only with minimal error handling.
|
||||
* no interaction, and no standard library, only a "print" function.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "lua.h"
|
||||
|
||||
static int print(lua_State *L)
|
||||
{
|
||||
int n=lua_gettop(L);
|
||||
int i;
|
||||
for (i=1; i<=n; i++)
|
||||
{
|
||||
if (i>1) printf("\t");
|
||||
if (lua_isstring(L,i))
|
||||
printf("%s",lua_tostring(L,i));
|
||||
else if (lua_isnil(L,i))
|
||||
printf("%s","nil");
|
||||
else if (lua_isboolean(L,i))
|
||||
printf("%s",lua_toboolean(L,i) ? "true" : "false");
|
||||
else
|
||||
printf("%s:%p",lua_typename(L,lua_type(L,i)),lua_topointer(L,i));
|
||||
}
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *getF(lua_State *L, void *ud, size_t *size)
|
||||
{
|
||||
FILE *f=(FILE *)ud;
|
||||
static char buff[512];
|
||||
if (feof(f)) return NULL;
|
||||
*size=fread(buff,1,sizeof(buff),f);
|
||||
return (*size>0) ? buff : NULL;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
lua_State *L=lua_open();
|
||||
lua_register(L,"print",print);
|
||||
if (lua_load(L,getF,stdin,"=stdin") || lua_pcall(L,0,0,0))
|
||||
fprintf(stderr,"%s\n",lua_tostring(L,-1));
|
||||
return 0;
|
||||
}
|
||||
26
etc/noparser.c
Normal file
26
etc/noparser.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* The code below can be used to make a Lua core that does not contain the
|
||||
* parsing modules (lcode, llex, lparser), which represent 35% of the total core.
|
||||
* You'll only be able to load binary files and strings, precompiled with luac.
|
||||
* (Of course, you'll have to build luac with the original parsing modules!)
|
||||
*
|
||||
* To use this module, simply compile it ("make noparser" does that) and
|
||||
* list its object file before the Lua libraries. The linker should then not
|
||||
* load the parsing modules. To try it, do "make luab".
|
||||
*/
|
||||
|
||||
#include "llex.h"
|
||||
#include "lparser.h"
|
||||
#include "lzio.h"
|
||||
|
||||
void luaX_init (lua_State *L) {
|
||||
UNUSED(L);
|
||||
}
|
||||
|
||||
Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff) {
|
||||
UNUSED(z);
|
||||
UNUSED(buff);
|
||||
lua_pushstring(L,"parser not loaded");
|
||||
lua_error(L);
|
||||
return NULL;
|
||||
}
|
||||
87
etc/saconfig.c
Normal file
87
etc/saconfig.c
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/* sa-config.c -- configuration for stand-alone Lua interpreter
|
||||
*
|
||||
* #define LUA_USERCONFIG to this file
|
||||
*
|
||||
* Here are the features that can be customized using #define:
|
||||
*
|
||||
*** Line edit and history:
|
||||
* #define USE_READLINE to use the GNU readline library.
|
||||
*
|
||||
* To use another library for this, use the code below as a start.
|
||||
* Make sure you #define lua_readline and lua_saveline accordingly.
|
||||
* If you do not #define lua_readline, you'll get a version based on fgets
|
||||
* that uses a static buffer of size MAXINPUT.
|
||||
*
|
||||
*
|
||||
*** Static Lua libraries to be loaded at startup:
|
||||
* #define lua_userinit(L) to a Lua function that loads libraries; typically
|
||||
* #define lua_userinit(L) openstdlibs(L);myinit(L)
|
||||
* or
|
||||
* #define lua_userinit(L) myinit(L)
|
||||
*
|
||||
* Another way is to add the prototypes of the init functions here and
|
||||
* #define LUA_EXTRALIBS accordingly. For example,
|
||||
* #define LUA_EXTRALIBS {"mylib","luaopen_mylib"},
|
||||
* Note the ending comma!
|
||||
*
|
||||
*
|
||||
*** Prompts:
|
||||
* The stand-alone Lua interpreter uses two prompts: PROMPT and PROMPT2.
|
||||
* PROMPT is the primary prompt, shown when the intepreter is ready to receive
|
||||
* a new statement. PROMPT2 is the secondary prompt, shown while a statement
|
||||
* is being entered but is still incomplete.
|
||||
*
|
||||
*
|
||||
*** Program name:
|
||||
* Error messages usually show argv[0] as a program name. In systems that do
|
||||
* not give a valid string as argv[0], error messages show PROGNAME instead.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef USE_READLINE
|
||||
/*
|
||||
* This section implements of lua_readline and lua_saveline for lua.c using
|
||||
* the GNU readline and history libraries. It should also work with drop-in
|
||||
* replacements such as editline and libedit (you may have to include
|
||||
* different headers, though).
|
||||
*
|
||||
*/
|
||||
|
||||
#define lua_readline myreadline
|
||||
#define lua_saveline mysaveline
|
||||
|
||||
#include <ctype.h>
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
|
||||
static int myreadline (lua_State *L, const char *prompt) {
|
||||
char *s=readline(prompt);
|
||||
if (s==NULL)
|
||||
return 0;
|
||||
else {
|
||||
lua_pushstring(L,s);
|
||||
lua_pushliteral(L,"\n");
|
||||
lua_concat(L,2);
|
||||
free(s);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void mysaveline (lua_State *L, const char *s) {
|
||||
const char *p;
|
||||
for (p=s; isspace(*p); p++)
|
||||
;
|
||||
if (*p!=0) {
|
||||
size_t n=strlen(s)-1;
|
||||
if (s[n]!='\n')
|
||||
add_history(s);
|
||||
else {
|
||||
lua_pushlstring(L,s,n);
|
||||
s=lua_tostring(L,-1);
|
||||
add_history(s);
|
||||
lua_remove(L,-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
55
etc/trace.c
Normal file
55
etc/trace.c
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* trace.c -- a simple execution tracer for Lua
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
static FILE* LOG; /* log file */
|
||||
static int I=0; /* indentation level */
|
||||
|
||||
static void hook(lua_State *L, lua_Debug *ar)
|
||||
{
|
||||
const char* s="";
|
||||
switch (ar->event)
|
||||
{
|
||||
case LUA_HOOKTAILRET: ar->event=LUA_HOOKRET;
|
||||
case LUA_HOOKRET: s="return"; break;
|
||||
case LUA_HOOKCALL: s="call"; break;
|
||||
case LUA_HOOKLINE: s="line"; break;
|
||||
default: break;
|
||||
}
|
||||
fprintf(LOG,"[%d]\t%*s%s\t-- %d\n",I,I,"",s,ar->currentline);
|
||||
if (ar->event==LUA_HOOKCALL) ++I; else if (ar->event==LUA_HOOKRET) --I;
|
||||
}
|
||||
|
||||
static void start_trace(lua_State *L, FILE* logfile)
|
||||
{
|
||||
lua_sethook(L,hook,LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE, 0);
|
||||
LOG=logfile;
|
||||
}
|
||||
|
||||
static void stop_trace(lua_State *L)
|
||||
{
|
||||
lua_sethook(L,NULL,0,0);
|
||||
fclose(LOG);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int rc;
|
||||
lua_State *L=lua_open();
|
||||
lua_baselibopen(L);
|
||||
lua_tablibopen(L);
|
||||
lua_iolibopen(L);
|
||||
lua_strlibopen(L);
|
||||
lua_mathlibopen(L);
|
||||
lua_dblibopen(L);
|
||||
start_trace(L,stderr);
|
||||
rc=lua_dofile(L,NULL);
|
||||
stop_trace(L);
|
||||
return rc;
|
||||
}
|
||||
17
include/Makefile
Normal file
17
include/Makefile
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# makefile for Lua distribution (includes)
|
||||
|
||||
LUA= ..
|
||||
|
||||
include $(LUA)/config
|
||||
|
||||
SRCS= lua.h lualib.h lauxlib.h
|
||||
|
||||
all:
|
||||
|
||||
clean:
|
||||
|
||||
co:
|
||||
co -q -f -M $(SRCS)
|
||||
|
||||
klean: clean
|
||||
rm -f $(SRCS)
|
||||
145
include/lauxlib.h
Normal file
145
include/lauxlib.h
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
** $Id: lauxlib.h,v 1.60 2003/04/03 13:35:34 roberto Exp $
|
||||
** Auxiliary functions for building Lua libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef lauxlib_h
|
||||
#define lauxlib_h
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
|
||||
#ifndef LUALIB_API
|
||||
#define LUALIB_API LUA_API
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct luaL_reg {
|
||||
const char *name;
|
||||
lua_CFunction func;
|
||||
} luaL_reg;
|
||||
|
||||
|
||||
LUALIB_API void luaL_openlib (lua_State *L, const char *libname,
|
||||
const luaL_reg *l, int nup);
|
||||
LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *e);
|
||||
LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e);
|
||||
LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname);
|
||||
LUALIB_API int luaL_argerror (lua_State *L, int numarg, const char *extramsg);
|
||||
LUALIB_API const char *luaL_checklstring (lua_State *L, int numArg, size_t *l);
|
||||
LUALIB_API const char *luaL_optlstring (lua_State *L, int numArg,
|
||||
const char *def, size_t *l);
|
||||
LUALIB_API lua_Number luaL_checknumber (lua_State *L, int numArg);
|
||||
LUALIB_API lua_Number luaL_optnumber (lua_State *L, int nArg, lua_Number def);
|
||||
|
||||
LUALIB_API void luaL_checkstack (lua_State *L, int sz, const char *msg);
|
||||
LUALIB_API void luaL_checktype (lua_State *L, int narg, int t);
|
||||
LUALIB_API void luaL_checkany (lua_State *L, int narg);
|
||||
|
||||
LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname);
|
||||
LUALIB_API void luaL_getmetatable (lua_State *L, const char *tname);
|
||||
LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname);
|
||||
|
||||
LUALIB_API void luaL_where (lua_State *L, int lvl);
|
||||
LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...);
|
||||
|
||||
LUALIB_API int luaL_findstring (const char *st, const char *const lst[]);
|
||||
|
||||
LUALIB_API int luaL_ref (lua_State *L, int t);
|
||||
LUALIB_API void luaL_unref (lua_State *L, int t, int ref);
|
||||
|
||||
LUALIB_API int luaL_getn (lua_State *L, int t);
|
||||
LUALIB_API void luaL_setn (lua_State *L, int t, int n);
|
||||
|
||||
LUALIB_API int luaL_loadfile (lua_State *L, const char *filename);
|
||||
LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t sz,
|
||||
const char *name);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ===============================================================
|
||||
** some useful macros
|
||||
** ===============================================================
|
||||
*/
|
||||
|
||||
#define luaL_argcheck(L, cond,numarg,extramsg) if (!(cond)) \
|
||||
luaL_argerror(L, numarg,extramsg)
|
||||
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
|
||||
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
|
||||
#define luaL_checkint(L,n) ((int)luaL_checknumber(L, n))
|
||||
#define luaL_checklong(L,n) ((long)luaL_checknumber(L, n))
|
||||
#define luaL_optint(L,n,d) ((int)luaL_optnumber(L, n,(lua_Number)(d)))
|
||||
#define luaL_optlong(L,n,d) ((long)luaL_optnumber(L, n,(lua_Number)(d)))
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
** Generic Buffer manipulation
|
||||
** =======================================================
|
||||
*/
|
||||
|
||||
|
||||
#ifndef LUAL_BUFFERSIZE
|
||||
#define LUAL_BUFFERSIZE BUFSIZ
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct luaL_Buffer {
|
||||
char *p; /* current position in buffer */
|
||||
int lvl; /* number of strings in the stack (level) */
|
||||
lua_State *L;
|
||||
char buffer[LUAL_BUFFERSIZE];
|
||||
} luaL_Buffer;
|
||||
|
||||
#define luaL_putchar(B,c) \
|
||||
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
|
||||
(*(B)->p++ = (char)(c)))
|
||||
|
||||
#define luaL_addsize(B,n) ((B)->p += (n))
|
||||
|
||||
LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B);
|
||||
LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B);
|
||||
LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
|
||||
LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s);
|
||||
LUALIB_API void luaL_addvalue (luaL_Buffer *B);
|
||||
LUALIB_API void luaL_pushresult (luaL_Buffer *B);
|
||||
|
||||
|
||||
/* }====================================================== */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** Compatibility macros and functions
|
||||
*/
|
||||
|
||||
LUALIB_API int lua_dofile (lua_State *L, const char *filename);
|
||||
LUALIB_API int lua_dostring (lua_State *L, const char *str);
|
||||
LUALIB_API int lua_dobuffer (lua_State *L, const char *buff, size_t sz,
|
||||
const char *n);
|
||||
|
||||
|
||||
#define luaL_check_lstr luaL_checklstring
|
||||
#define luaL_opt_lstr luaL_optlstring
|
||||
#define luaL_check_number luaL_checknumber
|
||||
#define luaL_opt_number luaL_optnumber
|
||||
#define luaL_arg_check luaL_argcheck
|
||||
#define luaL_check_string luaL_checkstring
|
||||
#define luaL_opt_string luaL_optstring
|
||||
#define luaL_check_int luaL_checkint
|
||||
#define luaL_check_long luaL_checklong
|
||||
#define luaL_opt_int luaL_optint
|
||||
#define luaL_opt_long luaL_optlong
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
395
include/lua.h
Normal file
395
include/lua.h
Normal file
|
|
@ -0,0 +1,395 @@
|
|||
/*
|
||||
** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $
|
||||
** Lua - An Extensible Extension Language
|
||||
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
||||
** http://www.lua.org mailto:info@lua.org
|
||||
** See Copyright Notice at the end of this file
|
||||
*/
|
||||
|
||||
|
||||
#ifndef lua_h
|
||||
#define lua_h
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
#define LUA_VERSION "Lua 5.0.2"
|
||||
#define LUA_COPYRIGHT "Copyright (C) 1994-2004 Tecgraf, PUC-Rio"
|
||||
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
|
||||
|
||||
|
||||
|
||||
/* option for multiple returns in `lua_pcall' and `lua_call' */
|
||||
#define LUA_MULTRET (-1)
|
||||
|
||||
|
||||
/*
|
||||
** pseudo-indices
|
||||
*/
|
||||
#define LUA_REGISTRYINDEX (-10000)
|
||||
#define LUA_GLOBALSINDEX (-10001)
|
||||
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
|
||||
|
||||
|
||||
/* error codes for `lua_load' and `lua_pcall' */
|
||||
#define LUA_ERRRUN 1
|
||||
#define LUA_ERRFILE 2
|
||||
#define LUA_ERRSYNTAX 3
|
||||
#define LUA_ERRMEM 4
|
||||
#define LUA_ERRERR 5
|
||||
|
||||
|
||||
typedef struct lua_State lua_State;
|
||||
|
||||
typedef int (*lua_CFunction) (lua_State *L);
|
||||
|
||||
|
||||
/*
|
||||
** functions that read/write blocks when loading/dumping Lua chunks
|
||||
*/
|
||||
typedef const char * (*lua_Chunkreader) (lua_State *L, void *ud, size_t *sz);
|
||||
|
||||
typedef int (*lua_Chunkwriter) (lua_State *L, const void* p,
|
||||
size_t sz, void* ud);
|
||||
|
||||
|
||||
/*
|
||||
** basic types
|
||||
*/
|
||||
#define LUA_TNONE (-1)
|
||||
|
||||
#define LUA_TNIL 0
|
||||
#define LUA_TBOOLEAN 1
|
||||
#define LUA_TLIGHTUSERDATA 2
|
||||
#define LUA_TNUMBER 3
|
||||
#define LUA_TSTRING 4
|
||||
#define LUA_TTABLE 5
|
||||
#define LUA_TFUNCTION 6
|
||||
#define LUA_TUSERDATA 7
|
||||
#define LUA_TTHREAD 8
|
||||
|
||||
|
||||
/* minimum Lua stack available to a C function */
|
||||
#define LUA_MINSTACK 20
|
||||
|
||||
|
||||
/*
|
||||
** generic extra include file
|
||||
*/
|
||||
#ifdef LUA_USER_H
|
||||
#include LUA_USER_H
|
||||
#endif
|
||||
|
||||
|
||||
/* type of numbers in Lua */
|
||||
#ifndef LUA_NUMBER
|
||||
typedef double lua_Number;
|
||||
#else
|
||||
typedef LUA_NUMBER lua_Number;
|
||||
#endif
|
||||
|
||||
|
||||
/* mark for all API functions */
|
||||
#ifndef LUA_API
|
||||
#ifndef LUA_DLL
|
||||
# define LUA_API extern "C"
|
||||
#else
|
||||
# define LUA_API extern "C" __declspec(dllexport)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** state manipulation
|
||||
*/
|
||||
LUA_API lua_State *lua_open (void);
|
||||
LUA_API void lua_close (lua_State *L);
|
||||
LUA_API lua_State *lua_newthread (lua_State *L);
|
||||
|
||||
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
|
||||
|
||||
|
||||
/*
|
||||
** basic stack manipulation
|
||||
*/
|
||||
LUA_API int lua_gettop (lua_State *L);
|
||||
LUA_API void lua_settop (lua_State *L, int idx);
|
||||
LUA_API void lua_pushvalue (lua_State *L, int idx);
|
||||
LUA_API void lua_remove (lua_State *L, int idx);
|
||||
LUA_API void lua_insert (lua_State *L, int idx);
|
||||
LUA_API void lua_replace (lua_State *L, int idx);
|
||||
LUA_API int lua_checkstack (lua_State *L, int sz);
|
||||
|
||||
LUA_API void lua_xmove (lua_State *from, lua_State *to, int n);
|
||||
|
||||
|
||||
/*
|
||||
** access functions (stack -> C)
|
||||
*/
|
||||
|
||||
LUA_API int lua_isnumber (lua_State *L, int idx);
|
||||
LUA_API int lua_isstring (lua_State *L, int idx);
|
||||
LUA_API int lua_iscfunction (lua_State *L, int idx);
|
||||
LUA_API int lua_isuserdata (lua_State *L, int idx);
|
||||
LUA_API int lua_type (lua_State *L, int idx);
|
||||
LUA_API const char *lua_typename (lua_State *L, int tp);
|
||||
|
||||
LUA_API int lua_equal (lua_State *L, int idx1, int idx2);
|
||||
LUA_API int lua_rawequal (lua_State *L, int idx1, int idx2);
|
||||
LUA_API int lua_lessthan (lua_State *L, int idx1, int idx2);
|
||||
|
||||
LUA_API lua_Number lua_tonumber (lua_State *L, int idx);
|
||||
LUA_API int lua_toboolean (lua_State *L, int idx);
|
||||
LUA_API const char *lua_tostring (lua_State *L, int idx);
|
||||
LUA_API size_t lua_strlen (lua_State *L, int idx);
|
||||
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx);
|
||||
LUA_API void *lua_touserdata (lua_State *L, int idx);
|
||||
LUA_API lua_State *lua_tothread (lua_State *L, int idx);
|
||||
LUA_API const void *lua_topointer (lua_State *L, int idx);
|
||||
|
||||
|
||||
/*
|
||||
** push functions (C -> stack)
|
||||
*/
|
||||
LUA_API void lua_pushnil (lua_State *L);
|
||||
LUA_API void lua_pushnumber (lua_State *L, lua_Number n);
|
||||
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t l);
|
||||
LUA_API void lua_pushstring (lua_State *L, const char *s);
|
||||
LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt,
|
||||
va_list argp);
|
||||
LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
|
||||
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
|
||||
LUA_API void lua_pushboolean (lua_State *L, int b);
|
||||
LUA_API void lua_pushlightuserdata (lua_State *L, void *p);
|
||||
|
||||
|
||||
/*
|
||||
** get functions (Lua -> stack)
|
||||
*/
|
||||
LUA_API void lua_gettable (lua_State *L, int idx);
|
||||
LUA_API void lua_rawget (lua_State *L, int idx);
|
||||
LUA_API void lua_rawgeti (lua_State *L, int idx, int n);
|
||||
LUA_API void lua_newtable (lua_State *L);
|
||||
LUA_API void *lua_newuserdata (lua_State *L, size_t sz);
|
||||
LUA_API int lua_getmetatable (lua_State *L, int objindex);
|
||||
LUA_API void lua_getfenv (lua_State *L, int idx);
|
||||
|
||||
|
||||
/*
|
||||
** set functions (stack -> Lua)
|
||||
*/
|
||||
LUA_API void lua_settable (lua_State *L, int idx);
|
||||
LUA_API void lua_rawset (lua_State *L, int idx);
|
||||
LUA_API void lua_rawseti (lua_State *L, int idx, int n);
|
||||
LUA_API int lua_setmetatable (lua_State *L, int objindex);
|
||||
LUA_API int lua_setfenv (lua_State *L, int idx);
|
||||
|
||||
|
||||
/*
|
||||
** `load' and `call' functions (load and run Lua code)
|
||||
*/
|
||||
LUA_API void lua_call (lua_State *L, int nargs, int nresults);
|
||||
LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);
|
||||
LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);
|
||||
LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *dt,
|
||||
const char *chunkname);
|
||||
|
||||
LUA_API int lua_dump (lua_State *L, lua_Chunkwriter writer, void *data);
|
||||
|
||||
|
||||
/*
|
||||
** coroutine functions
|
||||
*/
|
||||
LUA_API int lua_yield (lua_State *L, int nresults);
|
||||
LUA_API int lua_resume (lua_State *L, int narg);
|
||||
|
||||
/*
|
||||
** garbage-collection functions
|
||||
*/
|
||||
LUA_API int lua_getgcthreshold (lua_State *L);
|
||||
LUA_API int lua_getgccount (lua_State *L);
|
||||
LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold);
|
||||
|
||||
/*
|
||||
** miscellaneous functions
|
||||
*/
|
||||
|
||||
LUA_API const char *lua_version (void);
|
||||
|
||||
LUA_API int lua_error (lua_State *L);
|
||||
|
||||
LUA_API int lua_next (lua_State *L, int idx);
|
||||
|
||||
LUA_API void lua_concat (lua_State *L, int n);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** ===============================================================
|
||||
** some useful macros
|
||||
** ===============================================================
|
||||
*/
|
||||
|
||||
#define lua_boxpointer(L,u) \
|
||||
(*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
|
||||
|
||||
#define lua_unboxpointer(L,i) (*(void **)(lua_touserdata(L, i)))
|
||||
|
||||
#define lua_pop(L,n) lua_settop(L, -(n)-1)
|
||||
|
||||
#define lua_register(L,n,f) \
|
||||
(lua_pushstring(L, n), \
|
||||
lua_pushcfunction(L, f), \
|
||||
lua_settable(L, LUA_GLOBALSINDEX))
|
||||
|
||||
#define lua_pushcfunction(L,f) lua_pushcclosure(L, f, 0)
|
||||
|
||||
#define lua_isfunction(L,n) (lua_type(L,n) == LUA_TFUNCTION)
|
||||
#define lua_istable(L,n) (lua_type(L,n) == LUA_TTABLE)
|
||||
#define lua_islightuserdata(L,n) (lua_type(L,n) == LUA_TLIGHTUSERDATA)
|
||||
#define lua_isnil(L,n) (lua_type(L,n) == LUA_TNIL)
|
||||
#define lua_isboolean(L,n) (lua_type(L,n) == LUA_TBOOLEAN)
|
||||
#define lua_isnone(L,n) (lua_type(L,n) == LUA_TNONE)
|
||||
#define lua_isnoneornil(L, n) (lua_type(L,n) <= 0)
|
||||
|
||||
#define lua_pushliteral(L, s) \
|
||||
lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** compatibility macros and functions
|
||||
*/
|
||||
|
||||
|
||||
LUA_API int lua_pushupvalues (lua_State *L);
|
||||
|
||||
#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
|
||||
#define lua_setglobal(L,s) \
|
||||
(lua_pushstring(L, s), lua_insert(L, -2), lua_settable(L, LUA_GLOBALSINDEX))
|
||||
|
||||
#define lua_getglobal(L,s) \
|
||||
(lua_pushstring(L, s), lua_gettable(L, LUA_GLOBALSINDEX))
|
||||
|
||||
|
||||
/* compatibility with ref system */
|
||||
|
||||
/* pre-defined references */
|
||||
#define LUA_NOREF (-2)
|
||||
#define LUA_REFNIL (-1)
|
||||
|
||||
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
|
||||
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
|
||||
|
||||
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
|
||||
|
||||
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, ref)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================================
|
||||
** useful definitions for Lua kernel and libraries
|
||||
** =======================================================================
|
||||
*/
|
||||
|
||||
/* formats for Lua numbers */
|
||||
#ifndef LUA_NUMBER_SCAN
|
||||
#define LUA_NUMBER_SCAN "%lf"
|
||||
#endif
|
||||
|
||||
#ifndef LUA_NUMBER_FMT
|
||||
#define LUA_NUMBER_FMT "%.14g"
|
||||
#endif
|
||||
|
||||
/* }====================================================================== */
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================================
|
||||
** Debug API
|
||||
** =======================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
** Event codes
|
||||
*/
|
||||
#define LUA_HOOKCALL 0
|
||||
#define LUA_HOOKRET 1
|
||||
#define LUA_HOOKLINE 2
|
||||
#define LUA_HOOKCOUNT 3
|
||||
#define LUA_HOOKTAILRET 4
|
||||
|
||||
|
||||
/*
|
||||
** Event masks
|
||||
*/
|
||||
#define LUA_MASKCALL (1 << LUA_HOOKCALL)
|
||||
#define LUA_MASKRET (1 << LUA_HOOKRET)
|
||||
#define LUA_MASKLINE (1 << LUA_HOOKLINE)
|
||||
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
|
||||
|
||||
typedef struct lua_Debug lua_Debug; /* activation record */
|
||||
|
||||
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
|
||||
|
||||
|
||||
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
|
||||
LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
|
||||
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
|
||||
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
|
||||
LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
|
||||
LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
|
||||
|
||||
LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
|
||||
LUA_API lua_Hook lua_gethook (lua_State *L);
|
||||
LUA_API int lua_gethookmask (lua_State *L);
|
||||
LUA_API int lua_gethookcount (lua_State *L);
|
||||
|
||||
|
||||
#define LUA_IDSIZE 60
|
||||
|
||||
struct lua_Debug {
|
||||
int event;
|
||||
const char *name; /* (n) */
|
||||
const char *namewhat; /* (n) `global', `local', `field', `method' */
|
||||
const char *what; /* (S) `Lua', `C', `main', `tail' */
|
||||
const char *source; /* (S) */
|
||||
int currentline; /* (l) */
|
||||
int nups; /* (u) number of upvalues */
|
||||
int linedefined; /* (S) */
|
||||
char short_src[LUA_IDSIZE]; /* (S) */
|
||||
/* private part */
|
||||
int i_ci; /* active function */
|
||||
};
|
||||
|
||||
/* }====================================================================== */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#endif
|
||||
56
include/lualib.h
Normal file
56
include/lualib.h
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
** $Id: lualib.h,v 1.28 2003/03/18 12:24:26 roberto Exp $
|
||||
** Lua standard libraries
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#ifndef lualib_h
|
||||
#define lualib_h
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
|
||||
#ifndef LUALIB_API
|
||||
#define LUALIB_API LUA_API
|
||||
#endif
|
||||
|
||||
|
||||
#define LUA_COLIBNAME "coroutine"
|
||||
LUALIB_API int luaopen_base (lua_State *L);
|
||||
|
||||
#define LUA_TABLIBNAME "table"
|
||||
LUALIB_API int luaopen_table (lua_State *L);
|
||||
|
||||
#define LUA_IOLIBNAME "io"
|
||||
#define LUA_OSLIBNAME "os"
|
||||
LUALIB_API int luaopen_io (lua_State *L);
|
||||
|
||||
#define LUA_STRLIBNAME "string"
|
||||
LUALIB_API int luaopen_string (lua_State *L);
|
||||
|
||||
#define LUA_MATHLIBNAME "math"
|
||||
LUALIB_API int luaopen_math (lua_State *L);
|
||||
|
||||
#define LUA_DBLIBNAME "debug"
|
||||
LUALIB_API int luaopen_debug (lua_State *L);
|
||||
|
||||
|
||||
LUALIB_API int luaopen_loadlib (lua_State *L);
|
||||
|
||||
|
||||
/* to help testing the libraries */
|
||||
#ifndef lua_assert
|
||||
#define lua_assert(c) /* empty */
|
||||
#endif
|
||||
|
||||
|
||||
/* compatibility code */
|
||||
#define lua_baselibopen luaopen_base
|
||||
#define lua_tablibopen luaopen_table
|
||||
#define lua_iolibopen luaopen_io
|
||||
#define lua_strlibopen luaopen_string
|
||||
#define lua_mathlibopen luaopen_math
|
||||
#define lua_dblibopen luaopen_debug
|
||||
|
||||
#endif
|
||||
74
lua/502_plugin/502_plugin.vcxproj
Normal file
74
lua/502_plugin/502_plugin.vcxproj
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{7159FC3C-3F14-4884-B97F-C2D80765A104}</ProjectGuid>
|
||||
<RootNamespace>My502_plugin</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>..\..\..\GMod9_Server\gmod9\lua\bin</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>D:\lua502\lua\lua502_sdk;D:\source2006\public\tier1;D:\source2006\public\tier0;D:\source2006\public;D:\source2006\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>D:\lua502\lua\Release;D:\source2006\lib\public;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>tier0.lib;tier1.lib;lua502_sdk.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
lua/502_plugin/502_plugin.vcxproj.filters
Normal file
22
lua/502_plugin/502_plugin.vcxproj.filters
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Файлы исходного кода">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Заголовочные файлы">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Файлы исходного кода</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
lua/502_plugin/502_plugin.vcxproj.user
Normal file
3
lua/502_plugin/502_plugin.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
10
lua/502_plugin/Release/502_plugin.dll.intermediate.manifest
Normal file
10
lua/502_plugin/Release/502_plugin.dll.intermediate.manifest
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
|
||||
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
2
lua/502_plugin/Release/502_plugin.lastbuildstate
Normal file
2
lua/502_plugin/Release/502_plugin.lastbuildstate
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#v4.0:v100:false
|
||||
Release|Win32|D:\lua502\lua\|
|
||||
23
lua/502_plugin/Release/502_plugin.log
Normal file
23
lua/502_plugin/Release/502_plugin.log
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Build started 27.10.2017 17:32:40.
|
||||
1>Project "D:\lua502\lua\502_plugin\502_plugin.vcxproj" on node 2 (build target(s)).
|
||||
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(299,5): warning MSB8004: каталог Output заканчивается не косой чертой. Этот экземпляр построения добавит косую черту, поскольку она необходима для правильного определения каталога Output.
|
||||
1>InitializeBuildStatus:
|
||||
Touching "Release\502_plugin.unsuccessfulbuild".
|
||||
ClCompile:
|
||||
All outputs are up-to-date.
|
||||
Link:
|
||||
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"..\..\..\GMod9_Server\gmod9\lua\bin\502_plugin.dll" /NOLOGO /LIBPATH:D:\lua502\lua\Release /LIBPATH:D:\source2006\lib\public tier0.lib tier1.lib lua502_sdk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /NODEFAULTLIB:LIBCMT.lib /MANIFEST /ManifestFile:"Release\502_plugin.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"D:\GMod9_Server\gmod9\lua\bin\502_plugin.pdb" /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"..\..\..\GMod9_Server\gmod9\lua\bin\502_plugin.lib" /MACHINE:X86 /DLL Release\main.obj
|
||||
Создается библиотека ..\..\..\GMod9_Server\gmod9\lua\bin\502_plugin.lib и объект ..\..\..\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
Создание кода
|
||||
Создание кода завершено
|
||||
502_plugin.vcxproj -> D:\lua502\lua\502_plugin\..\..\..\GMod9_Server\gmod9\lua\bin\502_plugin.dll
|
||||
Manifest:
|
||||
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /outputresource:"..\..\..\GMod9_Server\gmod9\lua\bin\502_plugin.dll;#2" /manifest Release\502_plugin.dll.intermediate.manifest
|
||||
FinalizeBuildStatus:
|
||||
Deleting file "Release\502_plugin.unsuccessfulbuild".
|
||||
Touching "Release\502_plugin.lastbuildstate".
|
||||
1>Done Building Project "D:\lua502\lua\502_plugin\502_plugin.vcxproj" (build target(s)).
|
||||
|
||||
Построение успешно завершено.
|
||||
|
||||
Time Elapsed 00:00:01.61
|
||||
Binary file not shown.
30
lua/502_plugin/Release/502_plugin.write.1.tlog
Normal file
30
lua/502_plugin/Release/502_plugin.write.1.tlog
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
^D:\lua502\lua\502_plugin\502_plugin.vcxproj
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
^D:\lua502\lua\502_plugin\502_plugin.vcxproj
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
^D:\lua502\lua\502_plugin\502_plugin.vcxproj
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
^D:\lua502\lua\502_plugin\502_plugin.vcxproj
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
^D:\lua502\lua\502_plugin\502_plugin.vcxproj
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
^D:\lua502\lua\502_plugin\502_plugin.vcxproj
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_plugin.exp
|
||||
BIN
lua/502_plugin/Release/CL.read.1.tlog
Normal file
BIN
lua/502_plugin/Release/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/CL.write.1.tlog
Normal file
BIN
lua/502_plugin/Release/CL.write.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/cl.command.1.tlog
Normal file
BIN
lua/502_plugin/Release/cl.command.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/link.command.1.tlog
Normal file
BIN
lua/502_plugin/Release/link.command.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/link.read.1.tlog
Normal file
BIN
lua/502_plugin/Release/link.read.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/link.write.1.tlog
Normal file
BIN
lua/502_plugin/Release/link.write.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/main.obj
Normal file
BIN
lua/502_plugin/Release/main.obj
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/mt.command.1.tlog
Normal file
BIN
lua/502_plugin/Release/mt.command.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/mt.read.1.tlog
Normal file
BIN
lua/502_plugin/Release/mt.read.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/mt.write.1.tlog
Normal file
BIN
lua/502_plugin/Release/mt.write.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/plugin.obj
Normal file
BIN
lua/502_plugin/Release/plugin.obj
Normal file
Binary file not shown.
BIN
lua/502_plugin/Release/vc100.pdb
Normal file
BIN
lua/502_plugin/Release/vc100.pdb
Normal file
Binary file not shown.
38
lua/502_plugin/main.cpp
Normal file
38
lua/502_plugin/main.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include "plugin.h"
|
||||
|
||||
DECLARE_PLUGIN(CTestPlugin)
|
||||
virtual bool GlobalInit(ILua502*);
|
||||
virtual bool LuaInit(lua_State*);
|
||||
|
||||
virtual void LevelInit(const char*);
|
||||
virtual void ClientPutInServer(edict_t*,const char*);
|
||||
END_PLUGIN(CTestPlugin,"testplugin");
|
||||
|
||||
bool CTestPlugin::GlobalInit(ILua502* pLua502)
|
||||
{
|
||||
BaseClass::GlobalInit(pLua502);
|
||||
Msg("CTestPlugin::GlobalInit!\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CTestPlugin::LuaInit(lua_State* L)
|
||||
{
|
||||
BaseClass::LuaInit(L);
|
||||
|
||||
lua_pushnumber(L,1234);
|
||||
lua_setglobal(L,"magic");
|
||||
|
||||
Msg("CTestPlugin::LuaInit!\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
void CTestPlugin::LevelInit(const char* pLevel)
|
||||
{
|
||||
Msg("CTestPlugin::LevelInit %s\n",pLevel);
|
||||
}
|
||||
|
||||
void CTestPlugin::ClientPutInServer(edict_t* pEdict,
|
||||
const char* pName)
|
||||
{
|
||||
Msg("Player %s (%) put in server!\n",pEdict,pName);
|
||||
}
|
||||
67
lua/502_ppcore/502_ppcore.vcxproj
Normal file
67
lua/502_ppcore/502_ppcore.vcxproj
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{A7610399-FAFB-4296-9352-58698BF87ED3}</ProjectGuid>
|
||||
<RootNamespace>My502_ppcore</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup />
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
17
lua/502_ppcore/502_ppcore.vcxproj.filters
Normal file
17
lua/502_ppcore/502_ppcore.vcxproj.filters
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Файлы исходного кода">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Заголовочные файлы">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
lua/502_ppcore/502_ppcore.vcxproj.user
Normal file
3
lua/502_ppcore/502_ppcore.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
73
lua/502_test/502_test.vcxproj
Normal file
73
lua/502_test/502_test.vcxproj
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4F4C4E60-2C90-44D8-AA4A-B01874B76A5B}</ProjectGuid>
|
||||
<RootNamespace>My502_test</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>..\..\..\GMod9_Server\gmod9\lua\bin</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>D:\source2006\public;D:\lua502\lua\lua502_sdk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalLibraryDirectories>..\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>lua502_sdk.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
22
lua/502_test/502_test.vcxproj.filters
Normal file
22
lua/502_test/502_test.vcxproj.filters
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Файлы исходного кода">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Заголовочные файлы">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Файлы исходного кода</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
lua/502_test/502_test.vcxproj.user
Normal file
3
lua/502_test/502_test.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
9
lua/502_test/Release/502_test.Build.CppClean.log
Normal file
9
lua/502_test/Release/502_test.Build.CppClean.log
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
D:\lua502\lua\502_test\Release\502_test.write.1.tlog
|
||||
D:\lua502\lua\502_test\Release\cl.command.1.tlog
|
||||
D:\lua502\lua\502_test\Release\CL.read.1.tlog
|
||||
D:\lua502\lua\502_test\Release\CL.write.1.tlog
|
||||
D:\lua502\lua\502_test\Release\link.command.1.tlog
|
||||
D:\lua502\lua\502_test\Release\link.read.1.tlog
|
||||
D:\lua502\lua\502_test\Release\link.write.1.tlog
|
||||
D:\LUA502\LUA\502_TEST\RELEASE\MAIN.OBJ
|
||||
D:\LUA502\LUA\502_TEST\RELEASE\VC100.PDB
|
||||
10
lua/502_test/Release/502_test.dll.intermediate.manifest
Normal file
10
lua/502_test/Release/502_test.dll.intermediate.manifest
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
|
||||
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
2
lua/502_test/Release/502_test.lastbuildstate
Normal file
2
lua/502_test/Release/502_test.lastbuildstate
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#v4.0:v100:false
|
||||
Release|Win32|D:\lua502\lua\|
|
||||
24
lua/502_test/Release/502_test.log
Normal file
24
lua/502_test/Release/502_test.log
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Build started 05.10.2017 1:14:38.
|
||||
1>Project "D:\lua502\lua\502_test\502_test.vcxproj" on node 2 (build target(s)).
|
||||
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(299,5): warning MSB8004: каталог Output заканчивается не косой чертой. Этот экземпляр построения добавит косую черту, поскольку она необходима для правильного определения каталога Output.
|
||||
1>InitializeBuildStatus:
|
||||
Touching "Release\502_test.unsuccessfulbuild".
|
||||
ClCompile:
|
||||
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ID:\source2006\public /ID:\lua502\lua\lua502_sdk /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D _WINDLL /D _MBCS /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Release\\" /Fd"Release\vc100.pdb" /Gd /TP /analyze- /errorReport:prompt main.cpp
|
||||
main.cpp
|
||||
Link:
|
||||
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"..\..\..\GMod9_Server\gmod9\lua\bin\502_test.dll" /NOLOGO /LIBPATH:..\Release lua502_sdk.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"Release\502_test.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"D:\GMod9_Server\gmod9\lua\bin\502_test.pdb" /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"..\..\..\GMod9_Server\gmod9\lua\bin\502_test.lib" /MACHINE:X86 /DLL Release\main.obj
|
||||
Создается библиотека ..\..\..\GMod9_Server\gmod9\lua\bin\502_test.lib и объект ..\..\..\GMod9_Server\gmod9\lua\bin\502_test.exp
|
||||
Создание кода
|
||||
Создание кода завершено
|
||||
502_test.vcxproj -> D:\lua502\lua\502_test\..\..\..\GMod9_Server\gmod9\lua\bin\502_test.dll
|
||||
Manifest:
|
||||
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\mt.exe /nologo /verbose /outputresource:"..\..\..\GMod9_Server\gmod9\lua\bin\502_test.dll;#2" /manifest Release\502_test.dll.intermediate.manifest
|
||||
FinalizeBuildStatus:
|
||||
Deleting file "Release\502_test.unsuccessfulbuild".
|
||||
Touching "Release\502_test.lastbuildstate".
|
||||
1>Done Building Project "D:\lua502\lua\502_test\502_test.vcxproj" (build target(s)).
|
||||
|
||||
Построение успешно завершено.
|
||||
|
||||
Time Elapsed 00:00:02.32
|
||||
5
lua/502_test/Release/502_test.write.1.tlog
Normal file
5
lua/502_test/Release/502_test.write.1.tlog
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
^D:\lua502\lua\502_test\502_test.vcxproj
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_test.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_test.lib
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_test.exp
|
||||
D:\GMod9_Server\gmod9\lua\bin\502_test.exp
|
||||
BIN
lua/502_test/Release/CL.read.1.tlog
Normal file
BIN
lua/502_test/Release/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/CL.write.1.tlog
Normal file
BIN
lua/502_test/Release/CL.write.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/cl.command.1.tlog
Normal file
BIN
lua/502_test/Release/cl.command.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/link.command.1.tlog
Normal file
BIN
lua/502_test/Release/link.command.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/link.read.1.tlog
Normal file
BIN
lua/502_test/Release/link.read.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/link.write.1.tlog
Normal file
BIN
lua/502_test/Release/link.write.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/main.obj
Normal file
BIN
lua/502_test/Release/main.obj
Normal file
Binary file not shown.
BIN
lua/502_test/Release/mt.command.1.tlog
Normal file
BIN
lua/502_test/Release/mt.command.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/mt.read.1.tlog
Normal file
BIN
lua/502_test/Release/mt.read.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/mt.write.1.tlog
Normal file
BIN
lua/502_test/Release/mt.write.1.tlog
Normal file
Binary file not shown.
BIN
lua/502_test/Release/vc100.pdb
Normal file
BIN
lua/502_test/Release/vc100.pdb
Normal file
Binary file not shown.
130
lua/502_test/main.cpp
Normal file
130
lua/502_test/main.cpp
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
#include <Windows.h>
|
||||
#include <stdio.h>
|
||||
#include "lauxlib.h"
|
||||
#include "lua502.h"
|
||||
#include "appframework/iappsystemgroup.h"
|
||||
#include "tier1/strtools.h"
|
||||
#include "tier1/interface.h"
|
||||
#include "tier1/utlvector.h"
|
||||
#include "tier1/utldict.h"
|
||||
|
||||
int Init(lua_State*);
|
||||
int Exit(lua_State*);
|
||||
DECLARE_GMOD9_PLUGIN2(Init,Exit,"testmodule");
|
||||
|
||||
/*class CAppSystemGroup
|
||||
{
|
||||
public:
|
||||
virtual int LoadModule( const char *pDLLName ) = 0;
|
||||
virtual IAppSystem *AddSystem( int module, const char *pInterfaceName ) = 0;
|
||||
virtual void *FindSystem( const char *pSystemName ) = 0;
|
||||
virtual CreateInterfaceFn GetFactory() = 0;
|
||||
|
||||
CUtlVector<CSysModule*> m_Modules;
|
||||
CUtlVector<IAppSystem*> m_Systems;
|
||||
CUtlDict<int, unsigned short> m_SystemDict;
|
||||
};*/
|
||||
|
||||
int lua_MessageBox(lua_State* L)
|
||||
{
|
||||
luaL_checktype(L,1,LUA_TSTRING);
|
||||
luaL_checktype(L,2,LUA_TSTRING);
|
||||
luaL_checktype(L,3,LUA_TNUMBER);
|
||||
|
||||
lua_pushnumber(L,MessageBox(NULL,lua_tostring(L,1),
|
||||
lua_tostring(L,2),(UINT)lua_tonumber(L,3)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int lua_strcmp(lua_State* L)
|
||||
{
|
||||
luaL_checktype(L,1,LUA_TSTRING);
|
||||
luaL_checktype(L,2,LUA_TSTRING);
|
||||
|
||||
lua_pushnumber(L,V_strcmp(lua_tostring(L,1),
|
||||
lua_tostring(L,2)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int lua_EngineError(lua_State* L)
|
||||
{
|
||||
luaL_checktype(L,1,LUA_TSTRING);
|
||||
Error("%s",lua_tostring(L,1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef void* (*GetInterfaceFn_t)();
|
||||
typedef struct interfacereg_s {
|
||||
GetInterfaceFn_t m_fnGetInterface;
|
||||
const char* m_pName;
|
||||
struct interfacereg_s* m_pNext;
|
||||
} interfacereg_t;
|
||||
|
||||
void DumpCreateInterface(CreateInterfaceFn fnFactory)
|
||||
{
|
||||
interfacereg_t* pReg = **(interfacereg_t***)((char*)fnFactory+0x05);
|
||||
while(pReg)
|
||||
{
|
||||
Msg("\t%s %p\n",pReg->m_pName,pReg->m_fnGetInterface());
|
||||
pReg = pReg->m_pNext;
|
||||
}
|
||||
}
|
||||
|
||||
typedef CreateInterfaceFn (*GetFactoryFn)();
|
||||
|
||||
void DumpAppFactoryGroup(CAppSystemGroup* pAppSystemGroup,int tier = 0)
|
||||
{
|
||||
unsigned short i = pAppSystemGroup->m_SystemDict.First();
|
||||
Msg("== TIER %d ==\npAppSystemGroup %p\n",tier,pAppSystemGroup);
|
||||
CUtlVector<int> LegalSystems;
|
||||
while(pAppSystemGroup->m_SystemDict.IsValidIndex(i))
|
||||
{
|
||||
const char* pName = pAppSystemGroup->m_SystemDict.GetElementName(i);
|
||||
int iAppID;
|
||||
LegalSystems.AddToTail((iAppID = pAppSystemGroup->m_SystemDict.Element(i)));
|
||||
|
||||
IAppSystem* pAppSystem = pAppSystemGroup->m_Systems.Element(iAppID);
|
||||
Msg("\t%s %p\n",(pName?pName:"(null)"),pAppSystem);
|
||||
i = pAppSystemGroup->m_SystemDict.Next(i);
|
||||
}
|
||||
|
||||
if(pAppSystemGroup->m_pParentAppSystem)
|
||||
{
|
||||
if(pAppSystemGroup->m_nErrorStage != CAppSystemGroup::NONE) return;
|
||||
DumpAppFactoryGroup(pAppSystemGroup->m_pParentAppSystem,tier+1);
|
||||
}
|
||||
}
|
||||
|
||||
int Init(lua_State* L)
|
||||
{
|
||||
lua_pushcfunction(L,lua_MessageBox);
|
||||
lua_setglobal(L,"MessageBox");
|
||||
|
||||
lua_pushcfunction(L,lua_strcmp);
|
||||
lua_setglobal(L,"strcmp");
|
||||
|
||||
lua_pushcfunction(L,lua_EngineError);
|
||||
lua_setglobal(L,"EngineError");
|
||||
|
||||
g_pLua502->Print("Hello World from ILua502!\n");
|
||||
g_pLua502->Print("AppFactory %p GameFactory %p\n",
|
||||
g_PluginInfo.m_fnAppFactory,g_PluginInfo.m_fnGameFactory);
|
||||
|
||||
CAppSystemGroup* pAppSystemGroup = **(CAppSystemGroup***)(
|
||||
(char*)g_PluginInfo.m_fnAppFactory+0x06);
|
||||
DumpAppFactoryGroup(pAppSystemGroup);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Exit(lua_State* L)
|
||||
{
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L,"MessageBox");
|
||||
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L,"strcmp");
|
||||
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L,"EngineError");
|
||||
return 0;
|
||||
}
|
||||
BIN
lua/Release/502_test.pdb
Normal file
BIN
lua/Release/502_test.pdb
Normal file
Binary file not shown.
BIN
lua/Release/a2s_rules.exe
Normal file
BIN
lua/Release/a2s_rules.exe
Normal file
Binary file not shown.
BIN
lua/Release/a2s_rules.pdb
Normal file
BIN
lua/Release/a2s_rules.pdb
Normal file
Binary file not shown.
BIN
lua/Release/gm9_cvar.dll
Normal file
BIN
lua/Release/gm9_cvar.dll
Normal file
Binary file not shown.
BIN
lua/Release/gm9_cvar.exp
Normal file
BIN
lua/Release/gm9_cvar.exp
Normal file
Binary file not shown.
BIN
lua/Release/gm9_cvar.lib
Normal file
BIN
lua/Release/gm9_cvar.lib
Normal file
Binary file not shown.
BIN
lua/Release/gm9_cvar.pdb
Normal file
BIN
lua/Release/gm9_cvar.pdb
Normal file
Binary file not shown.
BIN
lua/Release/gm9_fsdump.dll
Normal file
BIN
lua/Release/gm9_fsdump.dll
Normal file
Binary file not shown.
BIN
lua/Release/gm9_fsdump.pdb
Normal file
BIN
lua/Release/gm9_fsdump.pdb
Normal file
Binary file not shown.
BIN
lua/Release/gm9_interface.dll
Normal file
BIN
lua/Release/gm9_interface.dll
Normal file
Binary file not shown.
BIN
lua/Release/gm9_interface.pdb
Normal file
BIN
lua/Release/gm9_interface.pdb
Normal file
Binary file not shown.
BIN
lua/Release/gm9_internal.dll
Normal file
BIN
lua/Release/gm9_internal.dll
Normal file
Binary file not shown.
BIN
lua/Release/gm9_internal.pdb
Normal file
BIN
lua/Release/gm9_internal.pdb
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.dll
Normal file
BIN
lua/Release/gm9_src7.dll
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.exp
Normal file
BIN
lua/Release/gm9_src7.exp
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.id0
Normal file
BIN
lua/Release/gm9_src7.id0
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.id1
Normal file
BIN
lua/Release/gm9_src7.id1
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.id2
Normal file
BIN
lua/Release/gm9_src7.id2
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.lib
Normal file
BIN
lua/Release/gm9_src7.lib
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.nam
Normal file
BIN
lua/Release/gm9_src7.nam
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.pdb
Normal file
BIN
lua/Release/gm9_src7.pdb
Normal file
Binary file not shown.
BIN
lua/Release/gm9_src7.til
Normal file
BIN
lua/Release/gm9_src7.til
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue