Outdated egg!

This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

  1. Outdated egg!
  2. Lua
    1. Introduction
    2. Requires
    3. Download
    4. API
      1. lua-open
      2. lua-close
      3. lua-run-string
      4. lua-run-file
      5. lua-eval
      6. lua-call
      7. lua-function?
      8. lua-state?
      9. lua-thread?
      10. lua-table?
      11. lua-userdata?
      12. lua-global-ref
      13. lua-table-ref
    5. Mapping of Lua results to Scheme values
    6. Mapping of Scheme arguments to Lua values
    7. Authors
    8. License
    9. Version history

Lua

Introduction

This extension embeds the Lua interpreter into a CHICKEN extension.

Source code for the Lua VM is included (version 5.1).

Requires

dollar

Download

http://code.call-cc.org/legacy-eggs/3/lua.egg

API

lua-open

[procedure] (lua-open)

Creates and returns a fresh Lua execution context containing all base libraries.

lua-close

[procedure] (lua-close STATE)

Closes a Lua execution context and performs all necessary cleanup. The effect of using Lua data from the closed context is undefined.

lua-run-string

[procedure] (lua-run-string STATE STRING [NAME])

Executes the Lua statements in STRING and returns its result(s). The optional argument NAME can be given to identify the source of the Lua code (used in error messages).

lua-run-file

[procedure] (lua-run-file STATE PATHNAME)

Executes the statements in the file designated by PATHNAME and returns any result(s).

lua-eval

[procedure] (lua-eval STATE STRING)

Evaluates the Lua expression in STRING and returns any result(s).

lua-call

[procedure] (lua-call LUAFUNCTION ARG ...)

Calls the Lua function LUAFUNCTION which must have been obtained through evaluation of Lua code with the given arguments.

lua-function?

[procedure] (lua-function? X)

Returns #t if X is a Lua function or #f otherwise.

lua-state?

[procedure] (lua-state? X)

Returns #t if X is a Lua execution context (as returned by lua-open) or #f otherwise.

lua-thread?

[procedure] (lua-thread? X)

Returns #t if X is a Lua thread or #f otherwise.

lua-table?

[procedure] (lua-table? X)

Returns #t if X is a Lua table or #f otherwise.

lua-userdata?

[procedure] (lua-userdata? X)

Returns #t if X is a Lua userdata object or #f otherwise.

lua-global-ref

[procedure] (lua-global-ref STATE STRING)
[setter procedure] (set! (lua-global-ref STATE STRING) X)

Gets or sets the global variable named by STRING in the given Lua execution context.

lua-table-ref

[procedure] (lua-table-ref TABLE KEY)
[setter procedure] (set! (lua-table-ref TABLE KEY) X)

Gets or sets the table element in TABLE indexed by the Lua value KEY.

Mapping of Lua results to Scheme values

Lua Scheme
nil (void)
number number
boolean boolean
string string
light userdata pointer
userdata userdata record (opaque)
function procedure
thread thread record (opaque)
table table record

Mapping of Scheme arguments to Lua values

Scheme Lua
(void) nil
number number
boolean boolean
string or symbol string
char string (holding a single character)
pointer light userdata
userdata record userdata
function can not be passed as argument
thread record thread
table record table
vector or a-list table

Authors

PUC-Rio, packaged as egg by felix winkelmann

License

 Lua is licensed under the terms of the MIT license reproduced below.
 This means that Lua is free software and can be used for both academic
 and commercial purposes at absolutely no cost.
 For details and rationale, see http://www.lua.org/license.html .
 Copyright (C) 1994-2006 Lua.org, PUC-Rio.
 
 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.

Version history

0.2
Lua nil is handled as (void) [suggested by John Cowan]
0.1
initial release