diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-12-13 13:54:21 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-12-13 13:54:21 -0200 |
| commit | 5dfd17dd769d159a3b0722ddf82b385ff7271d53 (patch) | |
| tree | 5e4329c717d7276191c711a80ea9323bf0560a4c /opcode.c | |
| parent | ce4fb88b34421bc4426db7985314ba7ed757a284 (diff) | |
| download | lua-github-5dfd17dd769d159a3b0722ddf82b385ff7271d53.tar.gz | |
new API function 'lua_pushliteral'
Diffstat (limited to 'opcode.c')
| -rw-r--r-- | opcode.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -3,7 +3,7 @@ ** TecCGraf - PUC-Rio */ -char *rcs_opcode="$Id: opcode.c,v 3.23 1994/11/30 21:20:37 roberto Exp roberto $"; +char *rcs_opcode="$Id: opcode.c,v 3.24 1994/12/06 14:27:18 roberto Exp roberto $"; #include <setjmp.h> #include <stdio.h> @@ -644,6 +644,19 @@ int lua_pushstring (char *s) } /* +** Push an object (tag=string) on stack and register it on the constant table. + Return 0 on success or 1 on error. +*/ +int lua_pushliteral (char *s) +{ + lua_checkstack(top-stack+1); + tsvalue(top) = lua_constant[luaI_findconstant(lua_constcreate(s))]; + tag(top) = LUA_T_STRING; + top++; + return 0; +} + +/* ** Push an object (tag=cfunction) to stack. Return 0 on success or 1 on error. */ int lua_pushcfunction (lua_CFunction fn) |
