forked from n3tael/labast
		
	Add "string" command
This commit is contained in:
		
							parent
							
								
									fddedb7828
								
							
						
					
					
						commit
						065df34eb1
					
				@ -70,6 +70,7 @@ pub fn execute(stack: &mut Stack, mut origin_stack: Option<&mut Stack>, mod_name
 | 
			
		||||
            "dup" => instructions::stack_manage::dup(&mut stack.memory),
 | 
			
		||||
            "swap" => instructions::stack_manage::swap(&mut stack.memory),
 | 
			
		||||
            "pick" => instructions::stack_manage::pick(&mut stack.memory, instruction.data),
 | 
			
		||||
            "string" => instructions::stack_manage::string(&mut stack.memory, instruction.arg.clone()),
 | 
			
		||||
 | 
			
		||||
            // Math operations
 | 
			
		||||
            "add" => instructions::math::add(&mut stack.memory),
 | 
			
		||||
 | 
			
		||||
@ -34,3 +34,11 @@ pub fn pick(memory: &mut StackVec, data: u16) {
 | 
			
		||||
            .expect(&format!("{}", RunError::PickOutOfBounds)),
 | 
			
		||||
    );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub fn string(memory: &mut StackVec, arg: String) {
 | 
			
		||||
    for i in arg.chars() {
 | 
			
		||||
        memory.push(i as u16);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    memory.push(arg.len() as u16);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user