---
title: "Lua语法"
author: "leon1509"
date: "2017-01-22T09:12:39Z"
tags: []
categories: ["企业架构"]
slug: "lua"
draft: false
lastmod: "2017-01-24T12:40:55Z"
id: 2354403
url: "https://leon1509.iteye.com/blog/2354403"
---

if not res then

    ngx.log()

    return ngx.exit(500)

end

ngx.log()

.....

==============================

local data = ngx.req.get\_body\_data()

             if data then

                 ngx.say("body data:")

                 ngx.print(data)

                 return

             end

==================================

local result, err = user\_model:query(user\_id)

if not result or err then

    ......

end

 

 

=========== 函数传多个参数=========

1. 

function \_M.isNulls(...)

    for i, v in ipairs(arg) do

       if isNull(v) then

            return false

       end

    end

end

2. 

function testcase(...)

local arg = {...}

a = arg\[1]

print(a)

ngx.say(a)

end

testcase("123", "456", "789")