Skip to content

Rust library for using Teeworlds external console

Notifications You must be signed in to change notification settings

gerdoe-jr/tw-econ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tw-econ

Description

Rust library provides you a simple synchronous interface to interconnect with Teeworlds external console.

Example

Let's say you have Teeworlds server running with ec_password zohan and ec_port 6060 and you want to use it's econ.

use tw_econ::Econ;

fn main() -> std::io::Result<()> {
    let mut econ = Econ::new();

    econ.connect("127.0.0.1:6060")?;

    let authed = econ.try_auth("nahoz")?;
    assert_eq!(authed, false);

    let authed = econ.try_auth("hozan")?;
    assert_eq!(authed, false);

    let authed = econ.try_auth("zohan")?;
    assert_eq!(authed, true);

    econ.send_line("echo \"Hi\"")?;
    
    println!("{}", econ.recv_line(true)?);

    Ok(())
}

Projects

About

Rust library for using Teeworlds external console

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages