Crate lua[−][src]

extern crate lua;

use lua::Index;

let mut state = lua::State::new();
state.open_libs();

state.eval(r#"
    print ('hello world')

    -- define global vars
    foo = 42
"#).unwrap();

state.get_global("foo").unwrap();

assert_eq!(Ok(42), state.get(-1));
assert_eq!(Ok("42"), state.get(-1));

Re-exports

pub use error::Error;
pub use functions::Function;
pub use index::Index;
pub use userdata::UserData;

Modules

error

Error type

ffi

Raw bindings from the Lua C API

functions

Traits to implement lua functions in Rust

index

Types for indexing the stack

userdata

Traits to work with user defined Types from lua

values

Implementations of FromLua and IntoLua for rust primitives.

Macros

lua_library

Macro that expands into a function that loads a table of functions into a global variable

Structs

Gc

To configure garbage collection

State

Type to perform operations over an underlying lua_State safely

Enums

Lib

Standard libraries

Traits

CheckLua

Trait for type checking

FromLua

Trait for types that can be read from the lua stack

IntoLua

Trait for types that can be pushed to the lua stack

Type Definitions

Result

Custom type to return lua errors