attempt to call field 'new' (a nil value)
makorne opened this issue · comments
local template = require "template"
-- Using template.new
local view = template.new "view.html"
Error:
attempt to call field 'new' (a nil value)
`
template: { ["escape"] = function: 0x40da3fb0,["print"] = function: 0x40db0210,["compile"] = function: 0x40da3888,["parse"] = function: 0x40da4b90,}
tarantool -v
Tarantool 2.1.2-143-g3edaaed6c
Target: Linux-x86_64-RelWithDebInfo
Build options: cmake . -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_BACKTRACE=ON
Compiler: /usr/bin/cc /usr/lib/ccache/g++
C_FLAGS:-g -O2 -fdebug-prefix-map=/build/tarantool-2.1.2.143=. -specs=/usr/share/dpkg/no-pie-compile.specs -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -std=c11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -fno-gnu89-inline -Wno-cast-function-type
CXX_FLAGS:-g -O2 -fdebug-prefix-map=/build/tarantool-2.1.2.143=. -specs=/usr/share/dpkg/no-pie-compile.specs -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fexceptions -funwind-tables -fno-omit-frame-pointer -fno-stack-protector -fno-common -fopenmp -msse2 -std=c++11 -Wall -Wextra -Wno-strict-aliasing -Wno-char-subscripts -Wno-format-truncation -Wno-invalid-offsetof -Wno-cast-function-type
`
Hello, sorry for delay
tarantool> template = require "template"
---
...
tarantool> template.new
---
- 'function: 0x010379f230'
...
tarantool> template.new "index.html"
---
- render: 'function: 0x010376c5e8'
...
tarantool> template
---
- precompile: 'function: 0x010379f268'
render: 'function: 0x010379f3e0'
_VERSION: '1.9'
escape: 'function: 0x01037a66e0'
print: 'function: builtin#110'
output: 'function: 0x01037a66a8'
cache: []
load: 'function: 0x0103793b60'
parse: 'function: 0x010379f328'
caching: 'function: 0x01037a6638'
compile: 'function: 0x010379f2a8'
new: 'function: 0x010379f230'
...
Describe, please, how do you use it?
If you pasted local template = ...
directly in console you can't use "template" as variable in following lines.
Put your code inside do ... end
block.
I hope you solved your problem. Feel free to reopen if you have any questions.