package unluac.test;

public class LuaSpec {

  public enum NumberFormat {
    DEFAULT,
    FLOAT,
  }
  
  public LuaSpec() {
    this.isDefault = true;
    this.version = 0;
  }
  
  public LuaSpec(int version) {
    this.isDefault = false;
    this.version = version;
  }
  
  public void setNumberFormat(NumberFormat format) {
    this.numberFormat = format;
  }
  
  public String getLuaCName() {
    return "luac" + getVersionString() + getNumberFormatString();
  }
  
  private String getVersionString() {
    if(isDefault) {
      return "";
    } else {
      return Integer.toHexString(version);
    }
  }
  
  private String getNumberFormatString() {
    switch(numberFormat) {
      case DEFAULT:
        return "";
      case FLOAT:
        return "_float";
      default:
        throw new IllegalStateException();
    }
  }
  
  private boolean isDefault;
  private int version;
  private NumberFormat numberFormat;
  
}

@@ -181,16 +181,63 @@
 n = 0;%0D%0A
+    this.numberFormat = NumberFormat.DEFAULT;%0D%0A
   %7D%0D%0A  %0D
@@ -328,16 +328,63 @@
 rsion;%0D%0A
+    this.numberFormat = NumberFormat.DEFAULT;%0D%0A
   %7D%0D%0A  %0D

Fix LuaSpec default number format