Note: This is taken from the Chicken Wiki, where a more recent version could be available.
This extension embeds the Lua interpreter into a CHICKEN extension.
Source code for the Lua VM is included (version 5.1).
http://www.call-with-current-conitnuation.org/eggs/lua.egg
[procedure] (lua-open)
Creates and returns a fresh Lua execution context containing all base libraries.
[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.
[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).
[procedure] (lua-run-file STATE PATHNAME)
Executes the statements in the file designated by PATHNAME and returns any result(s).
[procedure] (lua-eval STATE STRING)
Evaluates the Lua expression in STRING and returns any result(s).
[procedure] (lua-call LUAFUNCTION ARG ...)
Calls the Lua function LUAFUNCTION which must have been obtained through evaluation of Lua code with the given arguments.
[procedure] (lua-function? X)
Returns #t if X is a Lua function or #f otherwise.
[procedure] (lua-state? X)
Returns #t if X is a Lua execution context (as returned by lua-open) or #f otherwise.
[procedure] (lua-thread? X)
Returns #t if X is a Lua thread or #f otherwise.
[procedure] (lua-table? X)
Returns #t if X is a Lua table or #f otherwise.
[procedure] (lua-userdata? X)
Returns #t if X is a Lua userdata object or #f otherwise.
[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.
[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.
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 |
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 |
PUC-Rio, packaged as egg by felix winkelmann
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.