kailua icon indicating copy to clipboard operation
kailua copied to clipboard

General Feedback/Wishlist

Open JamesKim2998 opened this issue 7 years ago • 0 comments

Hi :)

Previously I applied kailua to my small Unity project. While doing that, I fell some shorting comings like syntax inconvenience.

I'm not sure this is right feedback or no. But anyway I consider sharing is important, so I wrote these rough feedback.

  • OSX Support My dev enviroment is optimized for OSX. Also all games from my company are developed using iMac... I want to participate to support OSX, but not sure I can be helpful.

  • namespace support For medium to large scale OOP project, I think namespace is essential. Even now I can denote namespace with underscore, like UnityEngine_GameObject, but this make code bloat easily and eventually this will blind core semantics of the script.

  • Sugar syntax for redundant function declaration I think function signature declaration has some redundant keywords. For example, in below code, we have two function, two weapon, two velocity.

    --v function(weapon: WeaponComponent, velocity: Vector3) --> Projectile
    function ShootWeapon(weapon, velocity)
        return some_projectile
    end
    

    Why not just do this like,

    --v (WeaponComponent, Vector3) --> Projectile
    function ShootWeapon(weapon, velocity)
        return some_projectile
    end
    
  • File load rules support I cannot understand what file loading rule is. I mean, when some lua file require other file, kailua emits a warning like it cannot find required file,. I have looked README.md several times, but I cannot figure it out what package.path and package.cpath really mean. So how about have file load rules in kailua.json. Something like,

    {
      "search_paths": [
        "path/to/lua/scripts/.*.kailua",
        "path/to/lua/scripts/.*.lua",
        "other/path/to/lua/scripts/.*.kailua.txt"
        "other/path/to/lua/scripts/.*.lua.txt"
      ]
    }
    

    Using regex rules is much clear for me.

  • Simple casting syntax I think assume syntax is redundant in some case, considering assume syntax is widely used. (used for destructuring and casting)

      local tmpComp = gameObject:AddComponent(typeof(WeaponComponent))
      --# assume tmpComp: WeaponComponent
      character.weapon = tmpComp
    

    So how about attach to previous statement, if it doesn't have name part like,

      character.weapon = gameObject:AddComponent(typeof(WeaponComponent)) --^ assume WeaponComponent
    

    Or more simply,

      character.weapon = gameObject:AddComponent(typeof(WeaponComponent)) --& WeaponComponent
    

The below wishlist is not that important, but it can be helpful in some situations.

  • Metatable Support For Vector3 type, it can be really useful, if two Vector3 can be added with + operator.

  • Custom file extension support Now require statement in kailua only searches files with extension .lua. But for some annoying reason, Unity force file to have .txt to be considered as text file. :(

  • Rename class member It seems renaming class member is not supported. I hope this feature implemented but not that important except huge project.

  • Generic type support I know kailua already have vector<> and map<,>, but cannot figure it out how to declare new generic type. Is generic type not just documented or not supported yet?

JamesKim2998 avatar May 07 '17 07:05 JamesKim2998