mirror of
https://github.com/lua/lua
synced 2026-09-29 04:35:58 +03:00
new API function 'lua_pushliteral'
This commit is contained in:
parent
ce4fb88b34
commit
5dfd17dd76
4 changed files with 33 additions and 16 deletions
15
opcode.c
15
opcode.c
|
|
@ -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>
|
||||
|
|
@ -643,6 +643,19 @@ int lua_pushstring (char *s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
** 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.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue