From 727f8725d29e9355a86414751a97268c970e3ef7 Mon Sep 17 00:00:00 2001 From: James Roseborough Date: Thu, 3 Apr 2008 15:33:51 +0000 Subject: [PATCH] Add LTable.put(String,int) utility function --- src/core/org/luaj/vm/LTable.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/org/luaj/vm/LTable.java b/src/core/org/luaj/vm/LTable.java index 40a4a23a..f2545ac3 100644 --- a/src/core/org/luaj/vm/LTable.java +++ b/src/core/org/luaj/vm/LTable.java @@ -146,6 +146,14 @@ public class LTable extends LValue { put( new LString( key ), value ); } + /** + * Utility method for putting a string key, int value directly, typically for + * initializing a table. Bypasses the metatable, if any. + */ + public void put( String key, int value ) { + put( new LString( key ), LInteger.valueOf(value) ); + } + /** * Method for putting an integer-keyed value. Bypasses the metatable, if * any.