Coder Social home page Coder Social logo

lni's Introduction

Build status

lni

一种类似于ini的标记语言。语法上参考了ini和lua,目标是作为lua程序的配置语言。

语法

[ABC]  
a = 'Hello'  
b = 1.0  
c = {'1', '2', '3'}  
'd' = {  
  x = 2,  
  y = 4,  
}  
10 =  
[[ | H  
   | e  
   | l  
   | l  
   | o  
]]  

等价的lua为

{  
ABC = {  
a = 'Hello',  
b = 1.0,  
c = {'1', '2', '3'},  
d = { x = 2, y = 4 },  
[10] =  
[[ | H  
   | e  
   | l  
   | l  
   | o  
]]  
}  
}  

default

default是内置的对象,每个对象初始化时会复制一遍它的值。

[default]  
a = 1  
b = 2  
[A]  
b = 11  
[B]  
a = 10  

等价的lua为

{  
  A = { a = 1, b = 11 },  
  B = { a = 10, b = 2 },  
}  

enum

enum是内置对象,其他对象可以直接访问到它的元素。

[enum]  
YES = 1  
NO = 0  
[A]  
a = YES  
b = NO  

等价的lua为

{
 A = { a = 1, b = 0 }  
}

继承

对象可以继承一个已经定义的对象

[A]  
a = 1  
b = 2  
[B:A]  
c = 3  

等价的lua为

{  
  A = { a = 1, b = 2 },  
  B = { a = 1, b = 2, c = 3 },  
}  

lni's People

Contributors

actboy168 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.