summary refs log tree commit diff stats
path: root/lib/newwrap/lua/lualib.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/newwrap/lua/lualib.nim')
-rw-r--r--lib/newwrap/lua/lualib.nim74
1 files changed, 74 insertions, 0 deletions
diff --git a/lib/newwrap/lua/lualib.nim b/lib/newwrap/lua/lualib.nim
new file mode 100644
index 000000000..c2c6cd97b
--- /dev/null
+++ b/lib/newwrap/lua/lualib.nim
@@ -0,0 +1,74 @@
+#*****************************************************************************
+# *                                                                            *
+# *  File:        lualib.pas                                                   *
+# *  Authors:     TeCGraf           (C headers + actual Lua libraries)         *
+# *               Lavergne Thomas   (original translation to Pascal)           *
+# *               Bram Kuijvenhoven (update to Lua 5.1.1 for FreePascal)       *
+# *  Description: Standard Lua libraries                                       *
+# *                                                                            *
+# *****************************************************************************
+#
+#** $Id: lualib.h,v 1.28 2003/03/18 12:24:26 roberto Exp $
+#** Lua standard libraries
+#** See Copyright Notice in lua.h
+#
+#
+#** Translated to pascal by Lavergne Thomas
+#** Bug reports :
+#**    - thomas.lavergne@laposte.net
+#**   In french or in english
+#
+
+import 
+  
+
+const 
+  COLIBNAME* = "coroutine"
+  TABLIBNAME* = "table"
+  IOLIBNAME* = "io"
+  OSLIBNAME* = "os"
+  STRLINAME* = "string"
+  MATHLIBNAME* = "math"
+  DBLIBNAME* = "debug"
+  LOADLIBNAME* = "package"
+
+proc open_base*(L: PState): cint{.cdecl, dynlib: LIB_NAME, 
+                                  importc: "luaopen_base".}
+proc open_table*(L: PState): cint{.cdecl, dynlib: LIB_NAME, 
+                                   importc: "luaopen_table".}
+proc open_io*(L: PState): cint{.cdecl, dynlib: LIB_NAME, importc: "luaopen_io".}
+proc open_string*(L: PState): cint{.cdecl, dynlib: LIB_NAME, 
+                                    importc: "luaopen_string".}
+proc open_math*(L: PState): cint{.cdecl, dynlib: LIB_NAME, 
+                                  importc: "luaopen_math".}
+proc open_debug*(L: PState): cint{.cdecl, dynlib: LIB_NAME, 
+                                   importc: "luaopen_debug".}
+proc open_package*(L: PState): cint{.cdecl, dynlib: LIB_NAME, 
+                                     importc: "luaopen_package".}
+proc L_openlibs*(L: PState){.cdecl, dynlib: LIB_NAME, importc: "luaL_openlibs".}
+  # compatibility code 
+proc baselibopen*(L: PState): Bool
+proc tablibopen*(L: PState): Bool
+proc iolibopen*(L: PState): Bool
+proc strlibopen*(L: PState): Bool
+proc mathlibopen*(L: PState): Bool
+proc dblibopen*(L: PState): Bool
+# implementation
+
+proc baselibopen(L: PState): Bool = 
+  Result = open_base(L) != 0'i32
+
+proc tablibopen(L: PState): Bool = 
+  Result = open_table(L) != 0'i32
+
+proc iolibopen(L: PState): Bool = 
+  Result = open_io(L) != 0'i32
+
+proc strlibopen(L: PState): Bool = 
+  Result = open_string(L) != 0'i32
+
+proc mathlibopen(L: PState): Bool = 
+  Result = open_math(L) != 0'i32
+
+proc dblibopen(L: PState): Bool = 
+  Result = open_debug(L) != 0'i32